vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Mon Feb 6 20:50:10 2012 +0200| [318bc3a12a625f60bd6c612062ce2f1e462ab1a6] | committer: Rémi Denis-Courmont
GLX: use separate XCB and Xlib connections (close #5698) Some GLX drivers, such as newer versions of the Intel drivers, depend on X11 events coming from Xlib. So VLC cannot steal them from the underlying XCB connection. I have no time and will to duplicate the XCB code found in the GLX plugin for windowing and events handling using Xlib. So lets make a separate X connection with XCB. This is inefficient, but it works. On the plus side, this patch removes the dependency on libx11-xcb. So it is now possible to compile and use GLX with an Xtrans-based Xlib (though libxcb must be present). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=318bc3a12a625f60bd6c612062ce2f1e462ab1a6 --- configure.ac | 5 ----- modules/video_output/xcb/glx.c | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 51f5656..2eee355 100644 --- a/configure.ac +++ b/configure.ac @@ -3010,11 +3010,6 @@ AS_IF([test "${enable_xcb}" != "no"], [ AS_IF([test "${have_gl}" != "yes"], [ AC_MSG_ERROR([${GL_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.]) ]) - PKG_CHECK_MODULES(XLIB_XCB, [x11-xcb], [ - VLC_ADD_PLUGIN([xcb_glx]) - ], [ - AC_MSG_ERROR([${XLIB_XCB_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.]) - ]) ]) ]) AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"]) diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c index 7ff3f18..5e5c043 100644 --- a/modules/video_output/xcb/glx.c +++ b/modules/video_output/xcb/glx.c @@ -29,7 +29,6 @@ #include <assert.h> #include <xcb/xcb.h> -#include <X11/Xlib-xcb.h> #include <GL/glx.h> #include <GL/glxext.h> @@ -227,23 +226,29 @@ static int Open (vlc_object_t *obj) } /* Connect to X server */ + xcb_connection_t *conn = xcb_connect (sys->embed->display.x11, NULL); + if (unlikely(xcb_connection_has_error (conn))) + { + vout_display_DeleteWindow (vd, sys->embed); + free (sys); + return VLC_EGENERIC; + } + Display *dpy = XOpenDisplay (sys->embed->display.x11); if (dpy == NULL) { + xcb_disconnect (conn); vout_display_DeleteWindow (vd, sys->embed); free (sys); return VLC_EGENERIC; } sys->display = dpy; + sys->conn = conn; sys->ctx = NULL; - XSetEventQueueOwner (dpy, XCBOwnsEventQueue); if (!CheckGLX (vd, dpy, &sys->v1_3)) goto error; - xcb_connection_t *conn = XGetXCBConnection (dpy); - assert (conn != NULL); - sys->conn = conn; RegisterMouseEvents (obj, conn, sys->embed->handle.xid); /* Find window parameters */ @@ -450,13 +455,14 @@ static void Close (vlc_object_t *obj) if (sys->v1_3) glXDestroyWindow (dpy, sys->glwin); } + XCloseDisplay (dpy); /* show the default cursor */ xcb_change_window_attributes (sys->conn, sys->embed->handle.xid, XCB_CW_CURSOR, &(uint32_t) { XCB_CURSOR_NONE }); xcb_flush (sys->conn); + xcb_disconnect (sys->conn); - XCloseDisplay (dpy); vout_display_DeleteWindow (vd, sys->embed); free (sys); } _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
