From 68f236ebd4b268a9e525d623986999d230feb453 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 27 Jan 2016 16:11:17 -0800 Subject: [PATCH] ephyr: Make sure we have GLX_ARB_create_context before calling it. This should fix aborts()s from epoxy on old software stacks. Signed-off-by: Eric Anholt Reviewed-by: Dave Airlie Reviewed-by: Kenneth Graunke --- 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 0981144530..636150d6a2 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); }