From 72db0e5e7187513c884d08937001a31d763ae38c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 27 Mar 2013 11:34:25 +0100 Subject: [PATCH] remove GlVSync option (it has no UI anymore) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on (revision 2 of) https://git.reviewboard.kde.org/r/109086/ by Thomas Lübking REVIEW: 109086 --- glxbackend.cpp | 9 ++++++--- kwin.kcfg | 3 --- options.cpp | 23 +++++------------------ options.h | 10 ---------- 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/glxbackend.cpp b/glxbackend.cpp index b749e9c61d..c68bceeb36 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -96,7 +96,8 @@ void GlxBackend::init() initGL(GlxPlatformInterface); // Check whether certain features are supported haveSwapInterval = glXSwapIntervalMESA || glXSwapIntervalEXT || glXSwapIntervalSGI; - if (options->isGlVSync()) { + const bool wantSync = options->glPreferBufferSwap() != Options::NoSwapEncourage; + if (wantSync) { if (glXGetVideoSync && haveSwapInterval && glXIsDirect(display(), ctx)) { unsigned int sync; if (glXGetVideoSync(&sync) == 0) { @@ -108,14 +109,16 @@ void GlxBackend::init() // swapinterval (as of today) seems completely unsupported setHasWaitSync(true); setSwapInterval(1); - } - else + } else qWarning() << "NO VSYNC! glXWaitVideoSync(1,0,&uint) isn't 0 but" << glXWaitVideoSync(1, 0, &sync); } else qWarning() << "NO VSYNC! glXGetVideoSync(&uint) isn't 0 but" << glXGetVideoSync(&sync); } else qWarning() << "NO VSYNC! glXGetVideoSync, haveSwapInterval, glXIsDirect" << bool(glXGetVideoSync) << haveSwapInterval << glXIsDirect(display(), ctx); + } else { + // disable v-sync (if possible) + setSwapInterval(0); } if (glPlatform->isVirtualBox()) { // VirtualBox does not support glxQueryDrawable diff --git a/kwin.kcfg b/kwin.kcfg index 3d254fbf05..42822e868e 100644 --- a/kwin.kcfg +++ b/kwin.kcfg @@ -235,9 +235,6 @@ true - - true - 2 -1 diff --git a/options.cpp b/options.cpp index 46a939667e..6abd3f0142 100644 --- a/options.cpp +++ b/options.cpp @@ -151,7 +151,6 @@ Options::Options(QObject *parent) , m_hiddenPreviews(Options::defaultHiddenPreviews()) , m_unredirectFullscreen(Options::defaultUnredirectFullscreen()) , m_glSmoothScale(Options::defaultGlSmoothScale()) - , m_glVSync(Options::defaultGlVSync()) , m_colorCorrected(Options::defaultColorCorrected()) , m_xrenderSmoothScale(Options::defaultXrenderSmoothScale()) , m_maxFpsInterval(Options::defaultMaxFpsInterval()) @@ -679,15 +678,6 @@ void Options::setGlSmoothScale(int glSmoothScale) emit glSmoothScaleChanged(); } -void Options::setGlVSync(bool glVSync) -{ - if (m_glVSync == glVSync) { - return; - } - m_glVSync = glVSync; - emit glVSyncChanged(); -} - void Options::setColorCorrected(bool colorCorrected) { if (m_colorCorrected == colorCorrected) { @@ -968,7 +958,6 @@ void Options::reloadCompositingSettings(bool force) KConfigGroup config(_config, "Compositing"); setGlDirect(prefs.enableDirectRendering()); - setGlVSync(config.readEntry("GLVSync", Options::defaultGlVSync())); setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2)); setGlStrictBindingFollowsDriver(!config.hasKey("GLStrictBinding")); if (!isGlStrictBindingFollowsDriver()) { @@ -977,13 +966,11 @@ void Options::reloadCompositingSettings(bool force) setGlLegacy(config.readEntry("GLLegacy", Options::defaultGlLegacy())); char c = 0; - if (isGlVSync()) { // buffer swap enforcement makes little sense without - const QString s = config.readEntry("GLPreferBufferSwap", QString(Options::defaultGlPreferBufferSwap())); - if (!s.isEmpty()) - c = s.at(0).toAscii(); - if (c != 'a' && c != 'c' && c != 'p' && c != 'e') - c = 0; - } + const QString s = config.readEntry("GLPreferBufferSwap", QString(Options::defaultGlPreferBufferSwap())); + if (!s.isEmpty()) + c = s.at(0).toAscii(); + if (c != 'a' && c != 'c' && c != 'p' && c != 'e') + c = 0; setGlPreferBufferSwap(c); setColorCorrected(config.readEntry("GLColorCorrection", Options::defaultColorCorrected())); diff --git a/options.h b/options.h index e816d4aca1..f61a66f475 100644 --- a/options.h +++ b/options.h @@ -170,7 +170,6 @@ class Options : public QObject, public KDecorationOptions * -1 = auto **/ Q_PROPERTY(int glSmoothScale READ glSmoothScale WRITE setGlSmoothScale NOTIFY glSmoothScaleChanged) - Q_PROPERTY(bool glVSync READ isGlVSync WRITE setGlVSync NOTIFY glVSyncChanged) Q_PROPERTY(bool colorCorrected READ isColorCorrected WRITE setColorCorrected NOTIFY colorCorrectedChanged) Q_PROPERTY(bool xrenderSmoothScale READ isXrenderSmoothScale WRITE setXrenderSmoothScale NOTIFY xrenderSmoothScaleChanged) Q_PROPERTY(uint maxFpsInterval READ maxFpsInterval WRITE setMaxFpsInterval NOTIFY maxFpsIntervalChanged) @@ -517,9 +516,6 @@ public: int glSmoothScale() const { return m_glSmoothScale; } - bool isGlVSync() const { - return m_glVSync; - } bool isColorCorrected() const { return m_colorCorrected; } @@ -608,7 +604,6 @@ public: void setHiddenPreviews(int hiddenPreviews); void setUnredirectFullscreen(bool unredirectFullscreen); void setGlSmoothScale(int glSmoothScale); - void setGlVSync(bool glVSync); void setXrenderSmoothScale(bool xrenderSmoothScale); void setMaxFpsInterval(uint maxFpsInterval); void setRefreshRate(uint refreshRate); @@ -692,9 +687,6 @@ public: static int defaultGlSmoothScale() { return 2; } - static bool defaultGlVSync() { - return true; - } static bool defaultColorCorrected() { return false; } @@ -798,7 +790,6 @@ Q_SIGNALS: void hiddenPreviewsChanged(); void unredirectFullscreenChanged(); void glSmoothScaleChanged(); - void glVSyncChanged(); void colorCorrectedChanged(); void xrenderSmoothScaleChanged(); void maxFpsIntervalChanged(); @@ -848,7 +839,6 @@ private: HiddenPreviews m_hiddenPreviews; bool m_unredirectFullscreen; int m_glSmoothScale; - bool m_glVSync; bool m_colorCorrected; bool m_xrenderSmoothScale; uint m_maxFpsInterval;