[mutter] wayland-buffer: Add debug logging of pixel format in use
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland-buffer: Add debug logging of pixel format in use
- Date: Tue, 20 Oct 2020 10:06:38 +0000 (UTC)
commit 345976192decbc4cbf2c6df1d18b713875a2cb7f
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Wed Jul 29 18:01:40 2020 +0800
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
src/wayland/meta-wayland-buffer.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 0416edf87a..6c339e813a 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 &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]