From: RĂ©mi Denis-Courmont Date: Sat, 12 Dec 2009 12:40:36 +0000 (+0200) Subject: XCB/GLX: check that GLX >= 1.2 is available on the server side X-Git-Tag: 1.1.0-ff~2018 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4734d55ba7ed19816ad28df17bf0e166d50e97ec;p=vlc XCB/GLX: check that GLX >= 1.2 is available on the server side --- diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c index c0f99af159..aada03cb5a 100644 --- a/modules/video_output/xcb/glx.c +++ b/modules/video_output/xcb/glx.c @@ -142,6 +142,27 @@ FindWindow (vout_display_t *vd, xcb_connection_t *conn, return screen; } +static bool CheckGLX (vout_display_t *vd, Display *dpy) +{ + int major, minor; + bool ok = false; + + if (!glXQueryVersion (dpy, &major, &minor)) + msg_Dbg (vd, "GLX extension not available"); + else + if (major != 1) + msg_Dbg (vd, "GLX extension version %d.%d unknown", major, minor); + else + if (minor < 2) + msg_Dbg (vd, "GLX extension version %d.%d too old", major, minor); + else + { + msg_Dbg (vd, "using GLX extension version %d.%d", major, minor); + ok = true; + } + return ok; +} + /** * Probe the X server. */ @@ -177,6 +198,9 @@ static int Open (vlc_object_t *obj) sys->ctx = NULL; XSetEventQueueOwner (dpy, XCBOwnsEventQueue); + if (!CheckGLX (vd, dpy)) + goto error; + xcb_connection_t *conn = XGetXCBConnection (dpy); assert (conn); RegisterMouseEvents (obj, conn, sys->embed->xid); @@ -294,9 +318,11 @@ static void Close (vlc_object_t *obj) if (sys->gl.sys != NULL) vout_display_opengl_Clean (&sys->vgl); - glXMakeCurrent (dpy, 0, NULL); if (sys->ctx != NULL) + { + glXMakeCurrent (dpy, 0, NULL); glXDestroyContext (dpy, sys->ctx); + } XCloseDisplay (dpy); vout_display_DeleteWindow (vd, sys->embed); free (sys);