From fabffd626b6bdeed624c0980f36283a902b2f864 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 16 Jun 2022 18:30:43 +0200 Subject: wayland: log human readable SHM format names in debug builds --- wayland.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'wayland.c') diff --git a/wayland.c b/wayland.c index b15cd491..850b657b 100644 --- a/wayland.c +++ b/wayland.c @@ -27,6 +27,7 @@ #include "render.h" #include "selection.h" #include "shm.h" +#include "shm-formats.h" #include "util.h" #include "xmalloc.h" @@ -227,6 +228,22 @@ static void shm_format(void *data, struct wl_shm *wl_shm, uint32_t format) { struct wayland *wayl = data; + +#if defined(_DEBUG) + bool have_description = false; + + for (size_t i = 0; i < ALEN(shm_formats); i++) { + if (shm_formats[i].format == format) { + LOG_DBG("shm: 0x%08x: %s", format, shm_formats[i].description); + have_description = true; + break; + } + } + + if (!have_description) + LOG_DBG("shm: 0x%08x: unknown", format); +#endif + if (format == WL_SHM_FORMAT_ARGB8888) wayl->have_argb8888 = true; } -- cgit v1.3