From e9828f1fcdaa7ad6101343d68ce5397a61db11bb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 1 Oct 2021 12:56:05 -0400 Subject: [PATCH 1/2] Fix the build I messed this up when I changed how we build resources. --- gtk/meson.build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk/meson.build b/gtk/meson.build index 5aeaca6d3b..00b9f8a22b 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -887,10 +887,10 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad '@INPUT@']) # Create resource data file - gtk_resources_c = custom_target('gtk_resources.c', + gtk_resources_c = custom_target('gtkresources.c', input : gtk_gresources_xml, depends : theme_deps, - output : 'gtk_resources.c', + output : 'gtkresources.c', command : [glib_compile_resources, '--target=@OUTPUT@', '--sourcedir=' + meson.current_source_dir(), @@ -901,10 +901,10 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad '--manual-register', '@INPUT@']) - gtk_resources_h = custom_target('gtk_resources.h', + gtk_resources_h = custom_target('gtkresources.h', input : gtk_gresources_xml, depends : theme_deps, - output : 'gtk_resources.h', + output : 'gtkresources.h', command : [glib_compile_resources, '--target=@OUTPUT@', '--sourcedir=' + meson.current_source_dir(), @@ -916,9 +916,9 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad '@INPUT@']) # Create object file containing resource data - gtk_resources_binary = custom_target('gtk_resources.o', + gtk_resources_binary = custom_target('gtkresources_blob.o', input : gtk_gresource, - output : 'gtk_resources.o', + output : 'gtkresources_blob.o', command : [ld, '-r', '-b','binary', @@ -926,9 +926,9 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad '-o','@OUTPUT@']) # Rename symbol to match the one in the C file - gtk_resources_o = custom_target('gtk_resources2.o', + gtk_resources_o = custom_target('gtkresources_blob2.o', input : gtk_resources_binary, - output : 'gtk_resources2.o', + output : 'gtkresources_blob2.o', command : [objcopy, '--add-symbol','_gtk_resource_data=.data:0', '@INPUT@', From a9f401a9a03759ef64a895e988053cdbac1c5fc9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 1 Oct 2021 11:15:12 -0400 Subject: [PATCH 2/2] 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 | 73 ++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c index c6401ccbf2..834cbc8510 100644 --- a/gdk/wayland/gdkglcontext-wayland.c +++ b/gdk/wayland/gdkglcontext-wayland.c @@ -458,13 +458,72 @@ 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 +#ifdef G_ENABLE_DEBUG +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 (config == 0) + return g_strdup ("-"); + + 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 ("Unknown"); + + 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"); +} +#endif + GdkGLContext * gdk_wayland_display_init_gl (GdkDisplay *display, GError **error) @@ -576,19 +635,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,