[gtk/matthiasc/color-profiles: 6/9] wayland: better debug for egl
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profiles: 6/9] wayland: better debug for egl
- Date: Fri, 1 Oct 2021 18:24:22 +0000 (UTC)
commit 740c74e6eab4e39441a517b0d06dd4c5eeb58151
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 1 11:15:12 2021 -0400
wayland: better debug for egl
Print the extensions one per line, and sort them
alphabetically, so it is actually possible to find
something in the list.
Also print a short description of the chosen config.
gdk/wayland/gdkglcontext-wayland.c | 68 +++++++++++++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index c6401ccbf2..93db8078f8 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -458,13 +458,67 @@ get_eglconfig (EGLDisplay dpy)
/* Pick first valid configuration i guess? */
if (!eglChooseConfig (dpy, attrs, &config, 1, &count) || count < 1)
- return NULL;
+ return NULL;
return config;
}
#undef MAX_EGL_ATTRS
+static int
+strvcmp (gconstpointer p1,
+ gconstpointer p2)
+{
+ const char * const *s1 = p1;
+ const char * const *s2 = p2;
+
+ return strcmp (*s1, *s2);
+}
+
+static char *
+describe_extensions (EGLDisplay dpy)
+{
+ const char *extensions;
+ char **exts;
+ char *ext;
+
+ extensions = eglQueryString (dpy, EGL_EXTENSIONS);
+
+ exts = g_strsplit (extensions, " ", -1);
+ qsort (exts, g_strv_length (exts), sizeof (char *), strvcmp);
+
+ ext = g_strjoinv ("\n\t", exts);
+ if (ext[0] == '\n')
+ ext[0] = ' ';
+
+ g_strfreev (exts);
+
+ return g_strstrip (ext);
+}
+
+static char *
+describe_egl_config (EGLDisplay dpy,
+ EGLConfig config)
+{
+ EGLint red, green, blue, alpha, type;
+
+ if (!eglGetConfigAttrib (dpy, config, EGL_RED_SIZE, &red) ||
+ !eglGetConfigAttrib (dpy, config, EGL_GREEN_SIZE, &green) ||
+ !eglGetConfigAttrib (dpy, config, EGL_BLUE_SIZE, &blue) ||
+ !eglGetConfigAttrib (dpy, config, EGL_ALPHA_SIZE, &alpha))
+ return g_strdup ("Undisclosed");
+
+ if (epoxy_has_egl_extension (dpy, "EGL_EXT_pixel_format_float"))
+ {
+ if (!eglGetConfigAttrib (dpy, config, EGL_COLOR_COMPONENT_TYPE_EXT, &type))
+ type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
+ }
+ else
+ type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
+
+ return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type ==
EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
+}
+
GdkGLContext *
gdk_wayland_display_init_gl (GdkDisplay *display,
GError **error)
@@ -576,19 +630,25 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
display_wayland->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage");
- GDK_DISPLAY_NOTE (display, OPENGL,
+ GDK_DISPLAY_NOTE (display, OPENGL, {
+ char *ext = describe_extensions (dpy);
+ char *cfg = describe_egl_config (dpy, display_wayland->egl_config);
g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
- "\t%s",
+ "\t%s\n"
+ " - Selected fbconfig: %s",
display_wayland->egl_major_version,
display_wayland->egl_minor_version,
eglQueryString (dpy, EGL_VENDOR),
eglQueryString (dpy, EGL_VERSION),
eglQueryString (dpy, EGL_CLIENT_APIS),
- eglQueryString (dpy, EGL_EXTENSIONS)));
+ ext, cfg);
+ g_free (cfg);
+ g_free (ext);
+ });
ctx = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
"display", display,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]