← Back to team overview

compiz team mailing list archive

[Merge] lp:~vanvugt/compiz/fix-763005-trunk into lp:compiz

 

Daniel van Vugt has proposed merging lp:~vanvugt/compiz/fix-763005-trunk into lp:compiz.

Requested reviews:
  compiz packagers (compiz)
Related bugs:
  Bug #763005 in fglrx-installer (Ubuntu): "Compiz's "Sync to Vblank" makes display stutter/slow with some drivers (like fglrx)"
  https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/763005

For more details, see:
https://code.launchpad.net/~vanvugt/compiz/fix-763005-trunk/+merge/68336

Fix slow/stuttering display when sync to Vblank is enabled. (LP: #763005)

This occurs with some drivers like fglrx where glXGetVideoSyncSGI and/or glXWaitVideoSyncSGI are particularly slow. Even calling glXGetVideoSyncSGI seems to skip a few frames so compiz runs at 20-30Hz. It's true ATI/AMD could improve the performance of their driver to avoid this bug, but simplifying the relevant compiz logic avoids the bug for any driver.

It is possible this might also fix similar nvidia issues where DynamicTwinView reduces the framerate; bug 762749 and maybe bug 92599...
-- 
https://code.launchpad.net/~vanvugt/compiz/fix-763005-trunk/+merge/68336
Your team compiz packagers is requested to review the proposed merge of lp:~vanvugt/compiz/fix-763005-trunk into lp:compiz.
=== added file 'debian/patches/092_fix_slow_vsync_lp763005.patch'
--- debian/patches/092_fix_slow_vsync_lp763005.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/092_fix_slow_vsync_lp763005.patch	2011-07-19 06:16:19 +0000
@@ -0,0 +1,82 @@
+Description: Fix slow/stuttering display when sync to Vblank is enabled.
+  This occurs with some drivers like fglrx where glXGetVideoSyncSGI and/or
+  glXWaitVideoSyncSGI are particularly slow. It's true ATI/AMD could improve
+  the performance of their driver to avoid this bug, but simplifying the
+  relevant compiz logic avoids the bug for any driver.
+Author: Daniel van Vugt <vanvugt@xxxxxxxxx>
+Bug-Ubuntu: https://launchpad.net/bugs/763005
+
+=== modified file 'plugins/opengl/include/opengl/opengl.h'
+--- old/plugins/opengl/include/opengl/opengl.h	2011-02-24 17:31:29 +0000
++++ new/plugins/opengl/include/opengl/opengl.h	2011-07-19 05:26:03 +0000
+@@ -98,7 +98,6 @@
+ 					  int	  width,
+ 					  int	  height);
+ 
+-    typedef int (*GLXGetVideoSyncProc)  (unsigned int *count);
+     typedef int (*GLXWaitVideoSyncProc) (int	  divisor,
+ 					 int	  remainder,
+ 					 unsigned int *count);
+@@ -163,7 +162,6 @@
+     extern GLXReleaseTexImageProc   releaseTexImage;
+     extern GLXQueryDrawableProc     queryDrawable;
+     extern GLXCopySubBufferProc     copySubBuffer;
+-    extern GLXGetVideoSyncProc      getVideoSync;
+     extern GLXWaitVideoSyncProc     waitVideoSync;
+     extern GLXGetFBConfigsProc      getFBConfigs;
+     extern GLXGetFBConfigAttribProc getFBConfigAttrib;
+
+=== modified file 'plugins/opengl/src/screen.cpp'
+--- old/plugins/opengl/src/screen.cpp	2011-04-06 19:37:45 +0000
++++ new/plugins/opengl/src/screen.cpp	2011-07-19 05:25:42 +0000
+@@ -36,7 +36,6 @@
+     GLXReleaseTexImageProc   releaseTexImage = NULL;
+     GLXQueryDrawableProc     queryDrawable = NULL;
+     GLXCopySubBufferProc     copySubBuffer = NULL;
+-    GLXGetVideoSyncProc      getVideoSync = NULL;
+     GLXWaitVideoSyncProc     waitVideoSync = NULL;
+     GLXGetFBConfigsProc      getFBConfigs = NULL;
+     GLXGetFBConfigAttribProc getFBConfigAttrib = NULL;
+@@ -227,9 +226,6 @@
+ 
+     if (strstr (glxExtensions, "GLX_SGI_video_sync"))
+     {
+-	GL::getVideoSync = (GL::GLXGetVideoSyncProc)
+-	    getProcAddress ("glXGetVideoSyncSGI");
+-
+ 	GL::waitVideoSync = (GL::GLXWaitVideoSyncProc)
+ 	    getProcAddress ("glXWaitVideoSyncSGI");
+     }
+@@ -1004,17 +1000,12 @@
+ void
+ PrivateGLScreen::waitForVideoSync ()
+ {
+-    unsigned int sync;
+-
+-    if (!optionGetSyncToVblank ())
+-	return;
+-
+-    if (GL::getVideoSync)
++    if (optionGetSyncToVblank () && GL::waitVideoSync)
+     {
+-	glFlush ();
+-
+-	(*GL::getVideoSync) (&sync);
+-	(*GL::waitVideoSync) (2, (sync + 1) % 2, &sync);
++        // Docs: http://www.opengl.org/registry/specs/SGI/video_sync.txt
++        unsigned int frameno;
++        glFlush ();
++        (*GL::waitVideoSync) (1, 0, &frameno);
+     }
+ }
+ 
+@@ -1153,7 +1144,7 @@
+ bool
+ PrivateGLScreen::hasVSync ()
+ {
+-   return (GL::getVideoSync && optionGetSyncToVblank ());
++   return (GL::waitVideoSync && optionGetSyncToVblank ());
+ }
+ 
+ void
+

=== modified file 'debian/patches/series'
--- debian/patches/series	2011-07-19 05:18:01 +0000
+++ debian/patches/series	2011-07-19 06:16:19 +0000
@@ -1,1 +1,2 @@
 01_don_t_init_a11y.patch
+092_fix_slow_vsync_lp763005.patch


Follow ups