[PATCH xserver 01/19] ephyr: Make sure we have GLX_ARB_create_context before calling it.

Eric Anholt eric at anholt.net
Wed Jan 27 17:56:30 PST 2016


This should fix aborts()s from epoxy on old software stacks.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 hw/kdrive/ephyr/ephyr_glamor_glx.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c b/hw/kdrive/ephyr/ephyr_glamor_glx.c
index 0981144..636150d 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -330,20 +330,26 @@ ephyr_glamor_glx_screen_init(xcb_window_t win)
                        "GLX_EXT_create_context_es2_profile\n");
         }
     } else {
-        static const int context_attribs[] = {
-            GLX_CONTEXT_PROFILE_MASK_ARB,
-            GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
-            GLX_CONTEXT_MAJOR_VERSION_ARB,
-            GLAMOR_GL_CORE_VER_MAJOR,
-            GLX_CONTEXT_MINOR_VERSION_ARB,
-            GLAMOR_GL_CORE_VER_MINOR,
-            0,
-        };
-        oldErrorHandler = XSetErrorHandler(ephyr_glx_error_handler);
-        ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
-                                         context_attribs);
-        XSync(dpy, False);
-        XSetErrorHandler(oldErrorHandler);
+        if (epoxy_has_glx_extension(dpy, DefaultScreen(dpy),
+                                    "GLX_ARB_create_context")) {
+            static const int context_attribs[] = {
+                GLX_CONTEXT_PROFILE_MASK_ARB,
+                GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
+                GLX_CONTEXT_MAJOR_VERSION_ARB,
+                GLAMOR_GL_CORE_VER_MAJOR,
+                GLX_CONTEXT_MINOR_VERSION_ARB,
+                GLAMOR_GL_CORE_VER_MINOR,
+                0,
+            };
+            oldErrorHandler = XSetErrorHandler(ephyr_glx_error_handler);
+            ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
+                                             context_attribs);
+            XSync(dpy, False);
+            XSetErrorHandler(oldErrorHandler);
+        } else {
+            ctx = NULL;
+        }
+
         if (!ctx)
             ctx = glXCreateContext(dpy, visual_info, NULL, True);
     }
-- 
2.6.4



More information about the xorg-devel mailing list