Merge lp:~vanvugt/compiz/fastSwapInterval into lp:compiz/0.9.8

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3386
Merged at revision: 3386
Proposed branch: lp:~vanvugt/compiz/fastSwapInterval
Merge into: lp:compiz/0.9.8
Diff against target: 40 lines (+13/-3)
1 file modified
plugins/opengl/src/screen.cpp (+13/-3)
To merge this branch: bzr merge lp:~vanvugt/compiz/fastSwapInterval
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
jenkins (community) continuous-integration Approve
Review via email: mp+126148@code.launchpad.net

Commit message

Don't call glXSwapInterval on every frame when you don't need to.
Apparently doing so is slow for some people (LP: #1051286)

Description of the change

Don't call glXSwapInterval on every frame when you don't need to.
Apparently doing so is slow for some people (LP: #1051286)

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I'm a bit eh about merging code without tests, but better in than out.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/opengl/src/screen.cpp'
2--- plugins/opengl/src/screen.cpp 2012-09-20 09:35:40 +0000
3+++ plugins/opengl/src/screen.cpp 2012-09-25 04:15:29 +0000
4@@ -1674,6 +1674,17 @@
5 {
6
7 void
8+fastSwapInterval (int interval)
9+{
10+ static int prev = -1;
11+ if (GL::swapInterval && interval != prev)
12+ {
13+ (*GL::swapInterval) (interval);
14+ prev = interval;
15+ }
16+}
17+
18+void
19 waitForVideoSync ()
20 {
21 #ifndef USE_GLES
22@@ -1681,8 +1692,7 @@
23 if (GL::waitVideoSync)
24 {
25 // Don't wait twice. Just in case.
26- if (GL::swapInterval)
27- (*GL::swapInterval) (0);
28+ fastSwapInterval (0);
29
30 /*
31 * While glXSwapBuffers/glXCopySubBufferMESA are meant to do a
32@@ -1711,7 +1721,7 @@
33 // Docs: http://www.opengl.org/registry/specs/SGI/swap_control.txt
34 if (GL::swapInterval)
35 {
36- (*GL::swapInterval) (sync ? 1 : 0);
37+ fastSwapInterval (sync ? 1 : 0);
38 GL::unthrottledFrames++;
39 }
40 else if (sync)

Subscribers

People subscribed via source and target branches