wayland: log human readable SHM format names in debug builds

This commit is contained in:
Daniel Eklöf 2022-06-16 18:30:43 +02:00
parent 8689389523
commit fabffd626b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 135 additions and 1 deletions

View file

@ -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;
}