[mythtv] PATCH: OpenGL vsync not working

Kyle Rose krose+mythtv at krose.org
Sat Dec 4 19:32:03 UTC 2004


"Flo Kohlert" <flokohlert at muenchen-mail.de> writes:

>> FWIW, OpenGL vsync wasn't working for me because vsync.cpp does some
>> of the GLX initialization in a non-portable way.  I didn't bother
>> trying to figure out which of the following modifications fix the
>> problem, but one of them does.
>> 
>> Is there a specific reason the following calls were made the way they
>> were?  I'd like to see this one checked in because it fixes my problem
>> and, if nothing else, it's closer to the way GLX calls *should* be
>> made.
>
> Wasn´t able to apply your patch allthough very interested.

I've mime-attached it to this email because your mailer was probably
munging it.  I hope it will get checked-in soon because there are
probably lots of folks out there who *think* they're using GL sync but
actually aren't.

Kyle
-------------- next part --------------
Index: vsync.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/vsync.cpp,v
retrieving revision 1.8
diff -u -r1.8 vsync.cpp
--- vsync.cpp	29 Nov 2004 22:21:54 -0000	1.8
+++ vsync.cpp	4 Dec 2004 19:30:20 -0000
@@ -429,14 +429,16 @@
     }
 
     /* Look for GLX at all */
-    if (glXQueryExtension(m_display, NULL, NULL) == 0)
+    int ndummy;
+    if (glXQueryExtension(m_display, &ndummy, &ndummy) == 0)
     {
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: OpenGL extension not present.");
         return false;
     }
 
     /* Look for video sync extension */
-    const char *xt = glXQueryExtensionsString(m_display, 0);
+    const char *xt = glXQueryExtensionsString(m_display, DefaultScreen(m_display));
+    VERBOSE(VB_PLAYBACK, QString("OpenGLVideoSync: GLX extensions: %1").arg(xt));
     if (strstr(xt, "GLX_SGI_video_sync") == NULL)
     {
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: GLX Video Sync"
@@ -453,20 +455,20 @@
     XSetWindowAttributes swa;
     Window w;
     
-    vis = glXChooseVisual(m_display, 0, attribList);
+    vis = glXChooseVisual(m_display, DefaultScreen(m_display), attribList);
     if (vis == NULL) 
     {
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: No appropriate visual found");
         return false;
     }
-    swa.colormap = XCreateColormap(m_display, RootWindow(m_display, 0),
+    swa.colormap = XCreateColormap(m_display, RootWindow(m_display, vis->screen),
                                    vis->visual, AllocNone);
     if (swa.colormap == 0)
     {
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: Failed to create colormap");
         return false;
     }
-    w = XCreateWindow(m_display, RootWindow(m_display, 0), 0, 0, 1, 1,
+    w = XCreateWindow(m_display, RootWindow(m_display, vis->screen), 0, 0, 1, 1,
                       0, vis->depth, InputOutput, vis->visual, 
                       CWColormap, &swa);
     if (w == 0)
@@ -474,7 +476,7 @@
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: Failed to create dummy window");
         return false;
     }
-    m_context = glXCreateContext(m_display, vis, NULL, GL_TRUE);
+    m_context = glXCreateContext(m_display, vis, None, GL_TRUE);
     if (m_context == NULL)
     {
         VERBOSE(VB_PLAYBACK, "OpenGLVideoSync: Failed to create GLX context");


More information about the mythtv-dev mailing list