diff --git a/kcmkwin/kwincompositing/compositing.ui b/kcmkwin/kwincompositing/compositing.ui index 58eee8199b..398043fa00 100644 --- a/kcmkwin/kwincompositing/compositing.ui +++ b/kcmkwin/kwincompositing/compositing.ui @@ -227,11 +227,6 @@ Alternatively, you might want to use the XRender backend instead. - - - Never - - Automatic diff --git a/kcmkwin/kwincompositing/kwincompositing_setting.kcfg b/kcmkwin/kwincompositing/kwincompositing_setting.kcfg index 2cbe193077..7278d09b7a 100644 --- a/kcmkwin/kwincompositing/kwincompositing_setting.kcfg +++ b/kcmkwin/kwincompositing/kwincompositing_setting.kcfg @@ -45,7 +45,6 @@ AutoSwapStrategy - diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 032b7a8ec4..2dec410b9e 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -130,15 +130,15 @@ void KWinCompositingKCM::init() // tearing prevention connect(m_form.kcfg_glPreferBufferSwap, currentIndexChangedSignal, this, [this](int index) { - if (index == 2) { + if (index == 1) { // only when cheap - tearing m_form.tearingWarning->setText(i18n("\"Only when cheap\" only prevents tearing for full screen changes like a video.")); m_form.tearingWarning->animatedShow(); - } else if (index == 3) { + } else if (index == 2) { // full screen repaints m_form.tearingWarning->setText(i18n("\"Full screen repaints\" can cause performance problems.")); m_form.tearingWarning->animatedShow(); - } else if (index == 4) { + } else if (index == 3) { // re-use screen content m_form.tearingWarning->setText(i18n("\"Re-use screen content\" causes severe performance problems on MESA drivers.")); m_form.tearingWarning->animatedShow(); diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index 89428f2ab8..c05511e4c8 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -6,6 +6,8 @@ install(PROGRAMS kwin-5.18-move-animspeed.py DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(PROGRAMS kwin-5.21-desktop-grid-click-behavior.py DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) +install(PROGRAMS kwin-5.21-no-swap-encourage.py + DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(FILES kwinrules.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) diff --git a/kconf_update/kwin-5.21-no-swap-encourage.py b/kconf_update/kwin-5.21-no-swap-encourage.py new file mode 100644 index 0000000000..c40eed8e84 --- /dev/null +++ b/kconf_update/kwin-5.21-no-swap-encourage.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import fileinput + +for line in fileinput.input(): + if not line.startswith("GLPreferBufferSwap="): + continue + value = line[len("GLPreferBufferSwap="):].strip() + if value != "n": + continue + print("# DELETE GLPreferBufferSwap") # will use the default swap strategy diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index 8a396986ab..17c613086f 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -43,3 +43,9 @@ Id=desktop-grid-click-behavior File=kwinrc Group=Effect-DesktopGrid Script=kwin-5.21-desktop-grid-click-behavior.py,python3 + +# Remove GLPreferBufferSwap if it has a value of "n" +Id=no-swap-encourage +File=kwinrc +Group=Compositing +File=kwin-5.21-no-swap-encourage.py,python3 diff --git a/options.cpp b/options.cpp index 31465c59a5..52030f1422 100644 --- a/options.cpp +++ b/options.cpp @@ -896,7 +896,7 @@ void Options::reloadCompositingSettings(bool force) if (!s.isEmpty()) c = s.at(0).toLatin1(); if (c != 'a' && c != 'c' && c != 'p' && c != 'e') - c = 0; + c = Options::defaultGlPreferBufferSwap(); setGlPreferBufferSwap(c); m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false); diff --git a/options.h b/options.h index 13c4da7ec1..e692a676e6 100644 --- a/options.h +++ b/options.h @@ -590,7 +590,7 @@ public: return m_glPlatformInterface; } - enum GlSwapStrategy { NoSwapEncourage = 0, CopyFrontBuffer = 'c', PaintFullScreen = 'p', ExtendDamage = 'e', AutoSwapStrategy = 'a' }; + enum GlSwapStrategy { CopyFrontBuffer = 'c', PaintFullScreen = 'p', ExtendDamage = 'e', AutoSwapStrategy = 'a' }; Q_ENUM(GlSwapStrategy) GlSwapStrategy glPreferBufferSwap() const { return m_glPreferBufferSwap; diff --git a/plugins/platforms/x11/common/eglonxbackend.cpp b/plugins/platforms/x11/common/eglonxbackend.cpp index 14fd7ab230..eb675e83d4 100644 --- a/plugins/platforms/x11/common/eglonxbackend.cpp +++ b/plugins/platforms/x11/common/eglonxbackend.cpp @@ -102,20 +102,15 @@ void EglOnXBackend::init() if (surfaceHasSubPost) { qCDebug(KWIN_CORE) << "EGL implementation and surface support eglPostSubBufferNV, let's use it"; - if (options->glPreferBufferSwap() != Options::NoSwapEncourage) { - // check if swap interval 1 is supported - EGLint val; - eglGetConfigAttrib(eglDisplay(), config(), EGL_MAX_SWAP_INTERVAL, &val); - if (val >= 1) { - if (eglSwapInterval(eglDisplay(), 1)) { - qCDebug(KWIN_CORE) << "Enabled v-sync"; - } - } else { - qCWarning(KWIN_CORE) << "Cannot enable v-sync as max. swap interval is" << val; + // check if swap interval 1 is supported + EGLint val; + eglGetConfigAttrib(eglDisplay(), config(), EGL_MAX_SWAP_INTERVAL, &val); + if (val >= 1) { + if (eglSwapInterval(eglDisplay(), 1)) { + qCDebug(KWIN_CORE) << "Enabled v-sync"; } } else { - // disable v-sync - eglSwapInterval(eglDisplay(), 0); + qCWarning(KWIN_CORE) << "Cannot enable v-sync as max. swap interval is" << val; } } else { /* In the GLX backend, we fall back to using glCopyPixels if we have no extension providing support for partial screen updates. diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp index 85a0c0a9e8..dee35bfdb4 100644 --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -224,17 +224,12 @@ void GlxBackend::init() m_haveINTELSwapEvent = false; } - const bool wantSync = options->glPreferBufferSwap() != Options::NoSwapEncourage; - if (wantSync && glXIsDirect(display(), ctx)) { - if (haveSwapInterval) { // glXSwapInterval is preferred being more reliable - setSwapInterval(1); - } else { - qCWarning(KWIN_X11STANDALONE) << "glSwapInterval is unsupported"; - } + if (haveSwapInterval) { + setSwapInterval(1); } else { - // disable v-sync (if possible) - setSwapInterval(0); + qCWarning(KWIN_X11STANDALONE) << "glSwapInterval is unsupported"; } + if (glPlatform->isVirtualBox()) { // VirtualBox does not support glxQueryDrawable // this should actually be in kwinglutils_funcs, but QueryDrawable seems not to be provided by an extension