diff options
author | Simon Ser <contact@emersion.fr> | 2022-09-07 10:47:48 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-09-14 12:13:17 +0200 |
commit | 4ad79d05ca1ade5cea2bacd72b4b2ab984c34c0d (patch) | |
tree | 6cd2aca4b0e051812eb9ce8b94a9e81c5ff8ea95 | |
parent | 1266f7424f711a3e67477b4aa5192b3c4285c7f4 (diff) |
render/egl: improve DMA-BUF format/modifier logging
For each format and modifier, log supported usage. Log a
human-readable format/modifier string.
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | render/egl.c | 41 |
2 files changed, 27 insertions, 16 deletions
diff --git a/meson.build b/meson.build index 58a64a0b..1473e238 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 9667207f..445dfe14 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 : "<unknown>", 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 : "<unknown>", 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); } + free(formats); - 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); + egl->has_modifiers = has_modifiers; wlr_log(WLR_DEBUG, "EGL DMA-BUF format modifiers %s", has_modifiers ? "supported" : "unsupported"); - free(str_formats); - - egl->has_modifiers = has_modifiers; - -out: - free(formats); } static struct wlr_egl *egl_create(void) { |