ephyr: catch X errors if we try to create a core context and fail.

This stops Xephyr failing on GLXBadFBConfig.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2016-01-27 16:46:06 -08:00 committed by Eric Anholt
parent 50ca286d79
commit d8ecbe5639

View File

@ -280,9 +280,16 @@ ephyr_glamor_process_event(xcb_generic_event_t *xev)
XUnlockDisplay(dpy);
}
static int
ephyr_glx_error_handler(Display * _dpy, XErrorEvent * ev)
{
return 0;
}
struct ephyr_glamor *
ephyr_glamor_glx_screen_init(xcb_window_t win)
{
int (*oldErrorHandler) (Display *, XErrorEvent *);
static const float position[] = {
-1, -1,
1, -1,
@ -332,8 +339,11 @@ ephyr_glamor_glx_screen_init(xcb_window_t win)
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 (!ctx)
ctx = glXCreateContext(dpy, visual_info, NULL, True);
}