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

Proposed by Sam Spilsbury on 2012-09-25
Status: Merged
Approved by: Daniel van Vugt on 2012-09-26
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 2012-09-25 Approve on 2012-09-26
jenkins (community) continuous-integration Approve on 2012-09-25
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.
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
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
=== modified file 'plugins/composite/include/composite/composite.h'
--- plugins/composite/include/composite/composite.h 2012-09-20 09:35:40 +0000
+++ plugins/composite/include/composite/composite.h 2012-09-25 11:20:51 +0000
@@ -30,7 +30,7 @@
3030
31#include <X11/extensions/Xcomposite.h>31#include <X11/extensions/Xcomposite.h>
3232
33#define COMPIZ_COMPOSITE_ABI 433#define COMPIZ_COMPOSITE_ABI 5
3434
35#include "core/pluginclasshandler.h"35#include "core/pluginclasshandler.h"
36#include "core/timer.h"36#include "core/timer.h"
@@ -106,6 +106,7 @@
106 const CompRegion &region) = 0;106 const CompRegion &region) = 0;
107107
108 virtual bool hasVSync () { return false; };108 virtual bool hasVSync () { return false; };
109 virtual bool requiredForcedRefreshRate () { return false; };
109110
110 virtual void prepareDrawing () {};111 virtual void prepareDrawing () {};
111 virtual bool compositingActive () { return false; };112 virtual bool compositingActive () { return false; };
112113
=== modified file 'plugins/composite/src/screen.cpp'
--- plugins/composite/src/screen.cpp 2012-09-20 09:35:40 +0000
+++ plugins/composite/src/screen.cpp 2012-09-25 11:20:51 +0000
@@ -427,6 +427,8 @@
427427
428 priv->pHnd = pHnd;428 priv->pHnd = pHnd;
429429
430 priv->detectRefreshRate ();
431
430 showOutputWindow ();432 showOutputWindow ();
431433
432 return true;434 return true;
@@ -457,6 +459,8 @@
457 priv->pHnd = NULL;459 priv->pHnd = NULL;
458 priv->paintTimer.stop ();460 priv->paintTimer.stop ();
459461
462 priv->detectRefreshRate ();
463
460 hideOutputWindow ();464 hideOutputWindow ();
461}465}
462466
@@ -650,7 +654,10 @@
650void654void
651PrivateCompositeScreen::detectRefreshRate ()655PrivateCompositeScreen::detectRefreshRate ()
652{656{
653 if (optionGetDetectRefreshRate ())657 const bool forceRefreshRate = (pHnd ? pHnd->requiredForcedRefreshRate () : false);
658 const bool detect = optionGetDetectRefreshRate () && !forceRefreshRate;
659
660 if (detect)
654 {661 {
655 CompString name;662 CompString name;
656 CompOption::Value value;663 CompOption::Value value;
657664
=== modified file 'plugins/opengl/src/privates.h'
--- plugins/opengl/src/privates.h 2012-09-20 09:35:40 +0000
+++ plugins/opengl/src/privates.h 2012-09-25 11:20:51 +0000
@@ -135,6 +135,7 @@
135 const CompRegion &region);135 const CompRegion &region);
136136
137 bool hasVSync ();137 bool hasVSync ();
138 bool requiredForcedRefreshRate ();
138139
139 void updateRenderMode ();140 void updateRenderMode ();
140141
@@ -199,6 +200,8 @@
199 std::vector<GLTexture::BindPixmapProc> bindPixmap;200 std::vector<GLTexture::BindPixmapProc> bindPixmap;
200 bool hasCompositing;201 bool hasCompositing;
201 bool commonFrontbuffer;202 bool commonFrontbuffer;
203 bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect
204 // refresh rate, causing us to miss vblanks
202205
203 GLIcon defaultIcon;206 GLIcon defaultIcon;
204207
205208
=== modified file 'plugins/opengl/src/screen.cpp'
--- plugins/opengl/src/screen.cpp 2012-09-25 08:11:48 +0000
+++ plugins/opengl/src/screen.cpp 2012-09-25 11:20:51 +0000
@@ -500,6 +500,8 @@
500 if (GL::textureFromPixmap)500 if (GL::textureFromPixmap)
501 registerBindPixmap (EglTexture::bindPixmapToTexture);501 registerBindPixmap (EglTexture::bindPixmapToTexture);
502502
503 priv->incorrectRefreshRate = false;
504
503 #else505 #else
504506
505 Display *dpy = screen->dpy ();507 Display *dpy = screen->dpy ();
@@ -509,6 +511,7 @@
509 GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };511 GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
510 GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };512 GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
511 const char *glRenderer;513 const char *glRenderer;
514 const char *glVendor;
512 CompOption::Vector o (0);515 CompOption::Vector o (0);
513516
514 priv->ctx = glXCreateContext (dpy, visinfo, NULL, True);517 priv->ctx = glXCreateContext (dpy, visinfo, NULL, True);
@@ -548,6 +551,7 @@
548 }551 }
549552
550 glRenderer = (const char *) glGetString (GL_RENDERER);553 glRenderer = (const char *) glGetString (GL_RENDERER);
554 glVendor = (const char *) glGetString (GL_VENDOR);
551 if (glRenderer != NULL &&555 if (glRenderer != NULL &&
552 (strcmp (glRenderer, "Software Rasterizer") == 0 ||556 (strcmp (glRenderer, "Software Rasterizer") == 0 ||
553 strcmp (glRenderer, "Mesa X11") == 0))557 strcmp (glRenderer, "Mesa X11") == 0))
@@ -560,6 +564,7 @@
560 }564 }
561565
562 priv->commonFrontbuffer = true;566 priv->commonFrontbuffer = true;
567 priv->incorrectRefreshRate = false;
563 if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe"))568 if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe"))
564 {569 {
565 /*570 /*
@@ -572,6 +577,14 @@
572 priv->commonFrontbuffer = false;577 priv->commonFrontbuffer = false;
573 }578 }
574579
580 if (glVendor != NULL && strstr (glVendor, "NVIDIA"))
581 {
582 /*
583 * NVIDIA provides an incorrect refresh rate, we need to
584 * force 60Hz */
585 priv->incorrectRefreshRate = true;
586 }
587
575 if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))588 if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
576 GL::textureNonPowerOfTwo = true;589 GL::textureNonPowerOfTwo = true;
577 GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;590 GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;
@@ -2086,6 +2099,12 @@
2086}2099}
20872100
2088bool2101bool
2102PrivateGLScreen::requiredForcedRefreshRate ()
2103{
2104 return incorrectRefreshRate;
2105}
2106
2107bool
2089PrivateGLScreen::compositingActive ()2108PrivateGLScreen::compositingActive ()
2090{2109{
2091 return true;2110 return true;
20922111
=== added file 'tests/manual/NVIDIAForceRefreshRate.txt'
--- tests/manual/NVIDIAForceRefreshRate.txt 1970-01-01 00:00:00 +0000
+++ tests/manual/NVIDIAForceRefreshRate.txt 2012-09-25 11:20:51 +0000
@@ -0,0 +1,12 @@
1NVIDIA REFRESH RATE
2===================
3Sam Spilsbury <sam.spilsbury@canonical.com>
4
5Force Refresh Rate
6------------------
7Actions
8#. Open ccsm and turn "Benchmark" on
9#. Hit Alt-F12
10#. Run glxgears
11#. Benchmark should display roughly under 60 frames per second
12 and not under 50 frames per second

Subscribers

People subscribed via source and target branches