From a54ca5a1c1692fa36ec1fe5c515481b3391729b6 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 19 Jun 2019 13:30:15 -0500 Subject: [PATCH] pull in 5.16 branch fix --- ...11-Disable-VSync-for-QtQuick-Windows.patch | 81 +++++++++++++++++++ kwin.spec | 6 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 0001-platforms-X11-Disable-VSync-for-QtQuick-Windows.patch diff --git a/0001-platforms-X11-Disable-VSync-for-QtQuick-Windows.patch b/0001-platforms-X11-Disable-VSync-for-QtQuick-Windows.patch new file mode 100644 index 0000000..ca5ac87 --- /dev/null +++ b/0001-platforms-X11-Disable-VSync-for-QtQuick-Windows.patch @@ -0,0 +1,81 @@ +From 0124b1ef191fcafe0d0f89287be66b36833586e6 Mon Sep 17 00:00:00 2001 +From: Erik Kurzinger +Date: Wed, 19 Jun 2019 07:56:42 -0700 +Subject: [PATCH] [platforms/X11] Disable VSync for QtQuick Windows + +Summary: +QtQuick windows created by KWin currently use the default swap interval +of 1, meaning buffer swaps will block until vblank. However, this +results in a problematic interaction on hybrid graphics systems running +the proprietary NVIDIA driver. VSync on such setups relies on a system +called "PRIME synchronization", where the xf86-video-modesetting driver +controlling the display will signal the NVIDIA driver when vblank has +occurred. The issue is that it will only do so if there has been damage +to the screen. + +So, when KWin creates a QtQuick window, compositing will stop waiting on +the window to render, therefore no damage to the screen will occur. But +this means that no vblank notifications will be delivered to the NVIDIA +driver, so the glXSwapBuffers call by the QtQuick window will block +perpetually. The end result is a freeze of the desktop. + +To get around this, we can simply disable vsync for QtQuick windows by +setting the swap interval for the default QSurfaceFormat to 0. Since +they are redirected, this shouldn't cause any tearing. + +BUG: 406180 +FIXED-IN: 5.16.2 + +Test Plan: +Using the proprietary NVIDIA driver on a hybrid graphics system, with +PRIME synchronization enabled (see +https://devtalk.nvidia.com/default/topic/957814/linux/prime-and-prime-synchronization/), +perform any action causing a QtQuick window to be created by KWin, for +example, triggering the application switcher dialogue with alt + tab. + +Ensure the desktop does not temporarily freeze. + +Note, this required a Qt build that includes commit +https://code.qt.io/cgit/qt/qtbase.git/commit/?id=0c1831178540462da31fd7a4b6d2e446bc84498b +resolving a bug that prevented the changing the swap interval. + +Reviewers: #kwin, davidedmundson, zzag + +Reviewed By: #kwin, davidedmundson, zzag + +Subscribers: zzag, romangg, alexeymin, kwin + +Tags: #kwin + +Differential Revision: https://phabricator.kde.org/D21808 +--- + main_x11.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/main_x11.cpp b/main_x11.cpp +index c83b8240b..1219337b6 100644 +--- a/main_x11.cpp ++++ b/main_x11.cpp +@@ -43,6 +43,7 @@ along with this program. If not, see . + #include + #include + #include ++#include + #include + #include + +@@ -417,6 +418,11 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) + KWin::Application::createAboutData(); + KQuickAddons::QtQuickSettings::init(); + ++ // disables vsync for any QtQuick windows we create (BUG 406180) ++ QSurfaceFormat format = QSurfaceFormat::defaultFormat(); ++ format.setSwapInterval(0); ++ QSurfaceFormat::setDefaultFormat(format); ++ + QCommandLineOption replaceOption(QStringLiteral("replace"), i18n("Replace already-running ICCCM2.0-compliant window manager")); + + QCommandLineParser parser; +-- +2.21.0 + diff --git a/kwin.spec b/kwin.spec index fe7ccb4..54bba6f 100644 --- a/kwin.spec +++ b/kwin.spec @@ -10,7 +10,7 @@ Name: kwin Version: 5.16.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: KDE Window manager # all sources are effectively GPLv2+, except for: @@ -31,6 +31,7 @@ URL: https://userbase.kde.org/KWin Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}.tar.xz ## upstream patches +Patch1: 0001-platforms-X11-Disable-VSync-for-QtQuick-Windows.patch # Base BuildRequires: extra-cmake-modules @@ -295,6 +296,9 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||: %changelog +* Wed Jun 19 2019 Rex Dieter - 5.16.1-2 +- pull in 5.16 branch fix + * Tue Jun 18 2019 Rex Dieter - 5.16.1-1 - 5.16.1