Merge lp:~vanvugt/ubuntu/oneiric/compiz/fix-763005-oneiric into lp:ubuntu/oneiric-proposed/compiz

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: lp:~vanvugt/ubuntu/oneiric/compiz/fix-763005-oneiric
Merge into: lp:ubuntu/oneiric-proposed/compiz
Diff against target: 172 lines (+152/-0)
3 files modified
debian/changelog (+6/-0)
debian/patches/fix_slow_vsync_lp763005.patch (+145/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~vanvugt/ubuntu/oneiric/compiz/fix-763005-oneiric
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Needs Resubmitting
Ubuntu Development Team Pending
Review via email: mp+90254@code.launchpad.net

Description of the change

Fix slow/stuttering display with fglrx (LP: #763005)

This branch was proposed, approved, and marked as merged back in November. But somewhere a mistake was made and the fix never made it into any branch.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Daniel, thanks for you work there :)
There is a pending sru for compiz (which isn't approved yet as we need the fix to land in precise before it can go in oneiric). See http://people.canonical.com/~ubuntu-archive/pending-sru.html.

So, this one will go first (I hope we can get a first precise compiz release next week), and then, we can push this change for the next SRU (maybe with some more?)

Can you please just resubmit it when the new version lands in precise (and the SRU in oneiric-proposed) and subscribe me directly to it?

Oh, and btw, the versionning will be needed to be ubuntu6.2 now :)

review: Needs Resubmitting
Revision history for this message
Sebastien Bacher (seb128) wrote :

Daniel, I'm going to mark this one rejected, Omer is working on a SRU (see https://code.launchpad.net/~om26er/ubuntu/oneiric/compiz/sru-764330/+merge/92296) and will include your patch in his merge request so we can get both fixes in the same upload, technical it's superseded rather than rejected then ;-)

Unmerged revisions

254. By Daniel van Vugt

Fix slow/stuttering display with fglrx (LP: #763005)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-10-20 14:23:52 +0000
3+++ debian/changelog 2012-01-26 10:38:29 +0000
4@@ -1,3 +1,9 @@
5+compiz (1:0.9.6+bzr20110929-0ubuntu7) oneiric-proposed; urgency=low
6+
7+ * Fix slow/stuttering display with fglrx (LP: #763005)
8+
9+ -- Daniel van Vugt <vanvugt@gmail.com> Mon, 14 Nov 2011 16:22:01 +0800
10+
11 compiz (1:0.9.6+bzr20110929-0ubuntu6) oneiric-proposed; urgency=low
12
13 * debian/patches/rev_2821_fix_807487.patch:
14
15=== added file 'debian/patches/fix_slow_vsync_lp763005.patch'
16--- debian/patches/fix_slow_vsync_lp763005.patch 1970-01-01 00:00:00 +0000
17+++ debian/patches/fix_slow_vsync_lp763005.patch 2012-01-26 10:38:29 +0000
18@@ -0,0 +1,145 @@
19+Description: Fix slow/stuttering display when sync to Vblank is enabled.
20+ For fglrx the cause appears to be an ATI/AMD driver bug where
21+ glXGetVideoSyncSGI and glXWaitVideoSyncSGI are particularly slow, so we
22+ can't afford to call both on every redraw or we end up with 1/3-1/2 framerate.
23+ For intel and really all drivers, another cause appears to be excessive
24+ waiting in the compiz architecture not allowing enough CPU time to draw the
25+ full frame before the next vertical refresh.
26+ This patch addresses both possible problems, providing optimal framerates
27+ with sync-to-vblank support, most of the time.
28+Author: Daniel van Vugt <vanvugt@gmail.com>
29+Bug-Ubuntu: https://launchpad.net/bugs/763005
30+
31+===================================================================
32+--- old/plugins/opengl/src/screen.cpp 2011-09-12 08:09:46 +0000
33++++ new/plugins/opengl/src/screen.cpp 2011-09-30 06:19:53 +0000
34+@@ -36,6 +36,9 @@
35+ #include <math.h>
36+
37+ namespace GL {
38++ typedef int (*GLXSwapIntervalProc) (int interval);
39++
40++ GLXSwapIntervalProc swapInterval = NULL;
41+ GLXBindTexImageProc bindTexImage = NULL;
42+ GLXReleaseTexImageProc releaseTexImage = NULL;
43+ GLXQueryDrawableProc queryDrawable = NULL;
44+@@ -234,6 +237,12 @@
45+ getProcAddress ("glXWaitVideoSyncSGI");
46+ }
47+
48++ if (strstr (glxExtensions, "GLX_SGI_swap_control"))
49++ {
50++ GL::swapInterval = (GL::GLXSwapIntervalProc)
51++ getProcAddress ("glXSwapIntervalSGI");
52++ }
53++
54+ glXMakeCurrent (dpy, CompositeScreen::get (s)->output (), priv->ctx);
55+
56+ glExtensions = (const char *) glGetString (GL_EXTENSIONS);
57+@@ -999,21 +1008,41 @@
58+ priv->lastViewport.height);
59+ }
60+
61++namespace GL
62++{
63++
64++void
65++waitForVideoSync ()
66++{
67++ if (GL::waitVideoSync)
68++ {
69++ // Don't wait twice. Just in case.
70++ if (GL::swapInterval)
71++ (*GL::swapInterval) (0);
72++
73++ // Docs: http://www.opengl.org/registry/specs/SGI/video_sync.txt
74++ unsigned int frameno;
75++ (*GL::waitVideoSync) (1, 0, &frameno);
76++ }
77++}
78++
79++void
80++controlSwapVideoSync (bool sync)
81++{
82++ // Docs: http://www.opengl.org/registry/specs/SGI/swap_control.txt
83++ if (GL::swapInterval)
84++ (*GL::swapInterval) (sync ? 1 : 0);
85++ else if (sync)
86++ waitForVideoSync ();
87++}
88++
89++} // namespace GL
90++
91+ void
92+ PrivateGLScreen::waitForVideoSync ()
93+ {
94+- unsigned int sync;
95+-
96+- if (!optionGetSyncToVblank ())
97+- return;
98+-
99+- if (GL::getVideoSync)
100+- {
101+- glFlush ();
102+-
103+- (*GL::getVideoSync) (&sync);
104+- (*GL::waitVideoSync) (2, (sync + 1) % 2, &sync);
105+- }
106++ if (optionGetSyncToVblank ())
107++ GL::waitForVideoSync ();
108+ }
109+
110+ void
111+@@ -1085,10 +1114,23 @@
112+
113+ targetOutput = &screen->outputDevs ()[0];
114+
115+- waitForVideoSync ();
116++ glFlush ();
117+
118++ //
119++ // FIXME: Actually fix the composite plugin to be more efficient;
120++ // If GL::swapInterval == NULL && GL::waitVideoSync != NULL then the
121++ // composite plugin should not be imposing any framerate restriction
122++ // (ie. blocking the CPU) at all. Because the framerate will be controlled
123++ // and optimized here:
124++ //
125+ if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
126+ {
127++ //
128++ // controlSwapVideoSync is much faster than waitForVideoSync because
129++ // it won't block the CPU. The waiting is offloaded to the GPU.
130++ // Unfortunately it only works with glXSwapBuffers in most drivers.
131++ //
132++ GL::controlSwapVideoSync (optionGetSyncToVblank ());
133+ glXSwapBuffers (screen->dpy (), cScreen->output ());
134+ }
135+ else
136+@@ -1096,6 +1138,7 @@
137+ BoxPtr pBox;
138+ int nBox, y;
139+
140++ waitForVideoSync ();
141+ pBox = const_cast <Region> (tmpRegion.handle ())->rects;
142+ nBox = const_cast <Region> (tmpRegion.handle ())->numRects;
143+
144+@@ -1151,7 +1194,7 @@
145+ bool
146+ PrivateGLScreen::hasVSync ()
147+ {
148+- return (GL::getVideoSync && optionGetSyncToVblank ());
149++ return (GL::waitVideoSync && optionGetSyncToVblank ());
150+ }
151+
152+ void
153+@@ -1159,7 +1202,8 @@
154+ {
155+ if (pendingCommands)
156+ {
157+- glFinish ();
158++ // glFlush! glFinish would block the CPU, which is bad.
159++ glFlush ();
160+ pendingCommands = false;
161+ }
162+ }
163+
164
165=== modified file 'debian/patches/series'
166--- debian/patches/series 2011-10-20 14:23:52 +0000
167+++ debian/patches/series 2012-01-26 10:38:29 +0000
168@@ -18,3 +18,4 @@
169 rev_2884_fix_874004.patch
170 rev_2890_fix_879253.patch
171 fix-886978.patch
172+fix_slow_vsync_lp763005.patch

Subscribers

People subscribed via source and target branches