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 <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt 2016-01-27 16:11:17 -08:00
parent 623ff251dd
commit 68f236ebd4
1 changed files with 20 additions and 14 deletions

View File

@ -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);
}