diff --git a/meson.build b/meson.build index 58a64a0b3..1473e2389 100644 --- a/meson.build +++ b/meson.build @@ -107,7 +107,7 @@ wayland_server = dependency('wayland-server', ) drm = dependency('libdrm', - version: '>=2.4.112', + version: '>=2.4.113', fallback: 'libdrm', default_options: [ 'intel=false', diff --git a/render/egl.c b/render/egl.c index 9667207fd..445dfe143 100644 --- a/render/egl.c +++ b/render/egl.c @@ -99,6 +99,13 @@ static int get_egl_dmabuf_formats(struct wlr_egl *egl, int **formats); static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format, uint64_t **modifiers, EGLBoolean **external_only); +static void log_modifier(uint64_t modifier, bool external_only) { + char *mod_name = drmGetFormatModifierName(modifier); + wlr_log(WLR_DEBUG, " %s (0x%016"PRIX64"): ✓ texture %s render", + mod_name ? mod_name : "", modifier, external_only ? "✗" : "✓"); + free(mod_name); +} + static void init_dmabuf_formats(struct wlr_egl *egl) { int *formats; int formats_len = get_egl_dmabuf_formats(egl, &formats); @@ -106,6 +113,8 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { return; } + wlr_log(WLR_DEBUG, "Supported DMA-BUF formats:"); + bool has_modifiers = false; for (int i = 0; i < formats_len; i++) { uint32_t fmt = formats[i]; @@ -144,27 +153,29 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { } } + if (wlr_log_get_verbosity() >= WLR_DEBUG) { + char *fmt_name = drmGetFormatName(fmt); + wlr_log(WLR_DEBUG, " %s (0x%08"PRIX32")", + fmt_name ? fmt_name : "", fmt); + free(fmt_name); + + log_modifier(DRM_FORMAT_MOD_INVALID, false); + if (modifiers_len == 0) { + log_modifier(DRM_FORMAT_MOD_LINEAR, false); + } + for (int j = 0; j < modifiers_len; j++) { + log_modifier(modifiers[j], external_only[j]); + } + } + free(modifiers); free(external_only); } - - char *str_formats = malloc(formats_len * 5 + 1); - if (str_formats == NULL) { - goto out; - } - for (int i = 0; i < formats_len; i++) { - snprintf(&str_formats[i*5], (formats_len - i) * 5 + 1, "%.4s ", - (char*)&formats[i]); - } - wlr_log(WLR_DEBUG, "Supported DMA-BUF formats: %s", str_formats); - wlr_log(WLR_DEBUG, "EGL DMA-BUF format modifiers %s", - has_modifiers ? "supported" : "unsupported"); - free(str_formats); + free(formats); egl->has_modifiers = has_modifiers; - -out: - free(formats); + wlr_log(WLR_DEBUG, "EGL DMA-BUF format modifiers %s", + has_modifiers ? "supported" : "unsupported"); } static struct wlr_egl *egl_create(void) {