Merge lp:~compiz-team/compiz/compiz.workaround_92599 into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3388
Merged at revision: 3391
Proposed branch: lp:~compiz-team/compiz/compiz.workaround_92599
Merge into: lp:compiz/0.9.8
Diff against target: 157 lines (+44/-2)
5 files modified
plugins/composite/include/composite/composite.h (+2/-1)
plugins/composite/src/screen.cpp (+8/-1)
plugins/opengl/src/privates.h (+3/-0)
plugins/opengl/src/screen.cpp (+19/-0)
tests/manual/NVIDIAForceRefreshRate.txt (+12/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.workaround_92599
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
jenkins (community) continuous-integration Approve
Review via email: mp+126224@code.launchpad.net

Commit message

Workaround (LP: #92599) by forcing the user specified refresh rate on nvidia.

Description of the change

Workaround (LP: #92599) by forcing the user specified refresh rate on nvidia. There are no tests as I anticipate this feature will be removed once we hear about the correct way to handle this.

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
Daniel van Vugt (vanvugt) wrote :

No obvious regressions. I've only tested on intel though. Not Nvidia.

It's not important but I would have written:
    const bool forceRefreshRate = (pHnd ? pHnd->requiredForcedRefreshRate () : false);
as:
    const bool forceRefreshRate = pHnd && pHnd->requiredForcedRefreshRate ();
which is a little bit more readable.

What is important is this fix/workaround. Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/composite/include/composite/composite.h'
2--- plugins/composite/include/composite/composite.h 2012-09-20 09:35:40 +0000
3+++ plugins/composite/include/composite/composite.h 2012-09-25 11:20:51 +0000
4@@ -30,7 +30,7 @@
5
6 #include <X11/extensions/Xcomposite.h>
7
8-#define COMPIZ_COMPOSITE_ABI 4
9+#define COMPIZ_COMPOSITE_ABI 5
10
11 #include "core/pluginclasshandler.h"
12 #include "core/timer.h"
13@@ -106,6 +106,7 @@
14 const CompRegion &region) = 0;
15
16 virtual bool hasVSync () { return false; };
17+ virtual bool requiredForcedRefreshRate () { return false; };
18
19 virtual void prepareDrawing () {};
20 virtual bool compositingActive () { return false; };
21
22=== modified file 'plugins/composite/src/screen.cpp'
23--- plugins/composite/src/screen.cpp 2012-09-20 09:35:40 +0000
24+++ plugins/composite/src/screen.cpp 2012-09-25 11:20:51 +0000
25@@ -427,6 +427,8 @@
26
27 priv->pHnd = pHnd;
28
29+ priv->detectRefreshRate ();
30+
31 showOutputWindow ();
32
33 return true;
34@@ -457,6 +459,8 @@
35 priv->pHnd = NULL;
36 priv->paintTimer.stop ();
37
38+ priv->detectRefreshRate ();
39+
40 hideOutputWindow ();
41 }
42
43@@ -650,7 +654,10 @@
44 void
45 PrivateCompositeScreen::detectRefreshRate ()
46 {
47- if (optionGetDetectRefreshRate ())
48+ const bool forceRefreshRate = (pHnd ? pHnd->requiredForcedRefreshRate () : false);
49+ const bool detect = optionGetDetectRefreshRate () && !forceRefreshRate;
50+
51+ if (detect)
52 {
53 CompString name;
54 CompOption::Value value;
55
56=== modified file 'plugins/opengl/src/privates.h'
57--- plugins/opengl/src/privates.h 2012-09-20 09:35:40 +0000
58+++ plugins/opengl/src/privates.h 2012-09-25 11:20:51 +0000
59@@ -135,6 +135,7 @@
60 const CompRegion &region);
61
62 bool hasVSync ();
63+ bool requiredForcedRefreshRate ();
64
65 void updateRenderMode ();
66
67@@ -199,6 +200,8 @@
68 std::vector<GLTexture::BindPixmapProc> bindPixmap;
69 bool hasCompositing;
70 bool commonFrontbuffer;
71+ bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect
72+ // refresh rate, causing us to miss vblanks
73
74 GLIcon defaultIcon;
75
76
77=== modified file 'plugins/opengl/src/screen.cpp'
78--- plugins/opengl/src/screen.cpp 2012-09-25 08:11:48 +0000
79+++ plugins/opengl/src/screen.cpp 2012-09-25 11:20:51 +0000
80@@ -500,6 +500,8 @@
81 if (GL::textureFromPixmap)
82 registerBindPixmap (EglTexture::bindPixmapToTexture);
83
84+ priv->incorrectRefreshRate = false;
85+
86 #else
87
88 Display *dpy = screen->dpy ();
89@@ -509,6 +511,7 @@
90 GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
91 GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
92 const char *glRenderer;
93+ const char *glVendor;
94 CompOption::Vector o (0);
95
96 priv->ctx = glXCreateContext (dpy, visinfo, NULL, True);
97@@ -548,6 +551,7 @@
98 }
99
100 glRenderer = (const char *) glGetString (GL_RENDERER);
101+ glVendor = (const char *) glGetString (GL_VENDOR);
102 if (glRenderer != NULL &&
103 (strcmp (glRenderer, "Software Rasterizer") == 0 ||
104 strcmp (glRenderer, "Mesa X11") == 0))
105@@ -560,6 +564,7 @@
106 }
107
108 priv->commonFrontbuffer = true;
109+ priv->incorrectRefreshRate = false;
110 if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe"))
111 {
112 /*
113@@ -572,6 +577,14 @@
114 priv->commonFrontbuffer = false;
115 }
116
117+ if (glVendor != NULL && strstr (glVendor, "NVIDIA"))
118+ {
119+ /*
120+ * NVIDIA provides an incorrect refresh rate, we need to
121+ * force 60Hz */
122+ priv->incorrectRefreshRate = true;
123+ }
124+
125 if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
126 GL::textureNonPowerOfTwo = true;
127 GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;
128@@ -2086,6 +2099,12 @@
129 }
130
131 bool
132+PrivateGLScreen::requiredForcedRefreshRate ()
133+{
134+ return incorrectRefreshRate;
135+}
136+
137+bool
138 PrivateGLScreen::compositingActive ()
139 {
140 return true;
141
142=== added file 'tests/manual/NVIDIAForceRefreshRate.txt'
143--- tests/manual/NVIDIAForceRefreshRate.txt 1970-01-01 00:00:00 +0000
144+++ tests/manual/NVIDIAForceRefreshRate.txt 2012-09-25 11:20:51 +0000
145@@ -0,0 +1,12 @@
146+NVIDIA REFRESH RATE
147+===================
148+Sam Spilsbury <sam.spilsbury@canonical.com>
149+
150+Force Refresh Rate
151+------------------
152+Actions
153+#. Open ccsm and turn "Benchmark" on
154+#. Hit Alt-F12
155+#. Run glxgears
156+#. Benchmark should display roughly under 60 frames per second
157+ and not under 50 frames per second

Subscribers

People subscribed via source and target branches