[gtk/ebassi/egl-x11: 4/4] x11: Add debug toggle for preferring GLX




commit 44cd9afb4184a8f0dcfd719dcf6decbf19797eda
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon May 10 18:36:32 2021 +0100

    x11: Add debug toggle for preferring GLX
    
    Mostly as a way to compare the EGL and GLX implementations.

 gdk/gdk.c                  | 1 +
 gdk/gdkdebug.h             | 7 ++++---
 gdk/x11/gdkglcontext-x11.c | 9 ++++++---
 3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 5cd0e1922d..0970cbc8d1 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -126,6 +126,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
   { "gl-legacy",       GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
   { "gl-gles",         GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
   { "gl-debug",        GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
+  { "gl-glx",          GDK_DEBUG_GL_GLX, "Use GLX on X11" },
   { "vulkan-disable",  GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
   { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
   { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h
index 2098774739..e03b904ce4 100644
--- a/gdk/gdkdebug.h
+++ b/gdk/gdkdebug.h
@@ -41,9 +41,10 @@ typedef enum {
   GDK_DEBUG_GL_LEGACY       = 1 << 15,
   GDK_DEBUG_GL_GLES         = 1 << 16,
   GDK_DEBUG_GL_DEBUG        = 1 << 17,
-  GDK_DEBUG_VULKAN_DISABLE  = 1 << 18,
-  GDK_DEBUG_VULKAN_VALIDATE = 1 << 19,
-  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 20
+  GDK_DEBUG_GL_GLX          = 1 << 18,
+  GDK_DEBUG_VULKAN_DISABLE  = 1 << 19,
+  GDK_DEBUG_VULKAN_VALIDATE = 1 << 20,
+  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 21
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index a6807395e4..a8c052b2e6 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -238,9 +238,12 @@ gdk_x11_screen_init_gl (GdkX11Screen *screen)
   if (GDK_DISPLAY_DEBUG_CHECK (display, GL_DISABLE))
     return FALSE;
 
-  /* We favour EGL */
-  if (gdk_x11_screen_init_egl (screen))
-    return TRUE;
+  if (!GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX))
+    {
+      /* We favour EGL */
+      if (gdk_x11_screen_init_egl (screen))
+        return TRUE;
+    }
 
   if (gdk_x11_screen_init_glx (screen))
     return TRUE;


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