[vlc-devel] commit: XCB/GLX: check that GLX >= 1.2 is available on the server side ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Dec 12 13:45:55 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 12 14:40:36 2009 +0200| [4734d55ba7ed19816ad28df17bf0e166d50e97ec] | committer: Rémi Denis-Courmont 

XCB/GLX: check that GLX >= 1.2 is available on the server side

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4734d55ba7ed19816ad28df17bf0e166d50e97ec
---

 modules/video_output/xcb/glx.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index c0f99af..aada03c 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);




More information about the vlc-devel mailing list