diff options
author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2020-07-29 18:01:40 +0800 |
---|---|---|
committer | Jonas Ã…dahl <jadahl@gmail.com> | 2020-10-20 09:53:53 +0000 |
commit | 345976192decbc4cbf2c6df1d18b713875a2cb7f (patch) | |
tree | 5168a9ff8f619d4a79c00e1912224baf83cb14ab | |
parent | e480d0c71e0e947327aadf58dcf9d1f297fc76ea (diff) | |
download | mutter-345976192decbc4cbf2c6df1d18b713875a2cb7f.tar.gz |
wayland-buffer: Add debug logging of pixel format in use
Enable it with environment `MUTTER_DEBUG=wayland`.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387
-rw-r--r-- | src/wayland/meta-wayland-buffer.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index 0416edf87..6c339e813 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -61,6 +61,7 @@ #ifdef HAVE_NATIVE_BACKEND #include "backends/native/meta-drm-buffer-gbm.h" +#include "backends/native/meta-kms-utils.h" #include "backends/native/meta-renderer-native.h" #endif @@ -282,6 +283,28 @@ shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer, return TRUE; } +static const char * +shm_format_to_string (MetaDrmFormatBuf *format_buf, + uint32_t shm_format) +{ + const char *result; + + switch (shm_format) + { + case WL_SHM_FORMAT_ARGB8888: + result = "ARGB8888"; + break; + case WL_SHM_FORMAT_XRGB8888: + result = "XRGB8888"; + break; + default: + result = meta_drm_format_to_string (format_buf, shm_format); + break; + } + + return result; +} + static gboolean shm_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, @@ -296,6 +319,7 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, CoglTextureComponents components; CoglBitmap *bitmap; CoglTexture *new_texture; + MetaDrmFormatBuf format_buf; shm_buffer = wl_shm_buffer_get (buffer->resource); stride = wl_shm_buffer_get_stride (shm_buffer); @@ -308,6 +332,13 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, return FALSE; } + meta_topic (META_DEBUG_WAYLAND, + "[wl-shm] wl_buffer@%u wl_shm_format %s -> CoglPixelFormat %s", + wl_resource_get_id (meta_wayland_buffer_get_resource (buffer)), + shm_format_to_string (&format_buf, + wl_shm_buffer_get_format (shm_buffer)), + cogl_pixel_format_to_string (format)); + if (*texture && cogl_texture_get_width (*texture) == width && cogl_texture_get_height (*texture) == height && |