diff options
author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2020-07-29 16:39:32 +0800 |
---|---|---|
committer | Jonas Ã…dahl <jadahl@gmail.com> | 2020-10-20 09:53:52 +0000 |
commit | 0501d3020e0b2a86c38b7c30f97ee64373b0fe2a (patch) | |
tree | 8c52ee540a99c7a46b9c40de2cfc958871825021 | |
parent | d2f8a30625e8369371dd4740886586e35797e654 (diff) | |
download | mutter-0501d3020e0b2a86c38b7c30f97ee64373b0fe2a.tar.gz |
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
-rw-r--r-- | cogl/cogl/winsys/cogl-winsys-egl.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index 6b56d2151..b9b49af21 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: |