[mutter] cogl-winsys-egl: Log the color depth in use



commit 0501d3020e0b2a86c38b7c30f97ee64373b0fe2a
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Wed Jul 29 16:39:32 2020 +0800

    cogl-winsys-egl: Log the color depth in use
    
    Enable it with environment `COGL_DEBUG=winsys`.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387

 cogl/cogl/winsys/cogl-winsys-egl.c | 41 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
---
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
index 6b56d21516..b9b49af218 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -309,6 +309,45 @@ cleanup_context (CoglDisplay *display)
     egl_renderer->platform_vtable->cleanup_context (display);
 }
 
+static void
+print_attribs (EGLDisplay egl_display,
+               EGLConfig  egl_config)
+{
+  const EGLint names[] =
+    {
+      EGL_BUFFER_SIZE,
+      EGL_RED_SIZE,
+      EGL_GREEN_SIZE,
+      EGL_BLUE_SIZE,
+      EGL_ALPHA_SIZE,
+    };
+  struct
+    {
+      EGLint buffer_size;
+      EGLint red_size;
+      EGLint green_size;
+      EGLint blue_size;
+      EGLint alpha_size;
+    } values;
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS (names); i++)
+    {
+      if (!eglGetConfigAttrib (egl_display,
+                               egl_config,
+                               names[i],
+                               (EGLint *) &values + i))
+        ((EGLint *) &values)[i] = -1;
+    }
+
+  COGL_NOTE (WINSYS, "EGL color depth is %d-bit (R:G:B:A = %d:%d:%d:%d)",
+             (int) values.buffer_size,
+             (int) values.red_size,
+             (int) values.green_size,
+             (int) values.blue_size,
+             (int) values.alpha_size);
+}
+
 static gboolean
 try_create_context (CoglDisplay *display,
                     GError **error)
@@ -415,6 +454,8 @@ try_create_context (CoglDisplay *display,
       !egl_renderer->platform_vtable->context_created (display, error))
     return FALSE;
 
+  print_attribs (egl_renderer->edpy, config);
+
   return TRUE;
 
 fail:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]