Closed DarkWav closed 4 years ago
The reason for removing useWaitSync=false
and enabling useHorribleHack
(which makes it select "horrible hack" when using the Automatic mechanism) is described in #36.
You got it wrong. The wait sync mechanism was never used with recent NVIDIA drivers. It apparently led to half-vsync problems before (#39) (however this may have changed since I noticed there was an accidental double-wait that I later removed and fixed #57 so I am not sure anymore) because NVIDIA changed the driver's behavior when they added __GL_MaxFramesAllowed
. After this change I thought using the sync waiting codepath was unnecessary since swapping buffers would be enough to make the driver wait.
However this in turn somehow worsened #36 later, which seems to be a mysterious bug since I still haven't reproduced it...
Using either "Hope for the best", "glFinish" or "horrible hack" disables useWaitSync
.
Is it possible for you to send the output of qdbus org.kde.KWin /KWin supportInformation
(run that command on a terminal)...
...and screenshots of the NVIDIA control panel? Specifically, the following sections:
Also, can you actually instead test using the SGI video sync mechanism (which enables useWaitSync
which was actually disabled before)? I am curious it if actually may fix things somehow.
Thanks for commenting. Output of qdbus org.kde.KWin /KWin supportInformation (With commit 88e8073cba24b972b6cf60ad20bc7f1c9693ac78 reverted)
==========================
Version
KWin version: 5.18.2 Qt Version: 5.14.1 Qt compile version: 5.14.1 XCB compile version: 1.13.1
Operation Mode: X11 only
Build Options
KWIN_BUILD_DECORATIONS: yes KWIN_BUILD_TABBOX: yes KWIN_BUILD_ACTIVITIES: yes HAVE_DRM: yes HAVE_GBM: yes HAVE_EGL_STREAMS: yes HAVE_X11_XCB: yes HAVE_EPOXY_GLX: yes HAVE_WAYLAND_EGL: yes
X11
Vendor: The X.Org Foundation Vendor Release: 12007000 Protocol Version/Revision: 11/0 SHAPE: yes; Version: 0x11 RANDR: yes; Version: 0x14 DAMAGE: yes; Version: 0x11 Composite: yes; Version: 0x4 RENDER: yes; Version: 0xb XFIXES: yes; Version: 0x50 SYNC: yes; Version: 0x31 GLX: yes; Version: 0x0
Decoration
Plugin: org.kde.breeze Theme: Plugin recommends border size: None Blur: 0 onAllDesktopsAvailable: true alphaChannelSupported: true closeOnDoubleClickOnMenu: false decorationButtonsLeft: 0, 2 decorationButtonsRight: 6, 3, 4, 5 borderSize: 3 gridUnit: 12 font: Noto Sans,10,-1,5,50,0,0,0,0,0,Regular smallSpacing: 3 largeSpacing: 12
Platform
Name: KWin::X11StandalonePlatform
Options
focusPolicy: 0 nextFocusPrefersMouse: false clickRaise: true autoRaise: false autoRaiseInterval: 0 delayFocusInterval: 0 shadeHover: false shadeHoverInterval: 250 separateScreenFocus: false placement: 4 focusPolicyIsReasonable: true borderSnapZone: 10 windowSnapZone: 10 centerSnapZone: 0 snapOnlyWhenOverlapping: false rollOverDesktops: true focusStealingPreventionLevel: 1 operationTitlebarDblClick: 5000 operationMaxButtonLeftClick: 5000 operationMaxButtonMiddleClick: 5015 operationMaxButtonRightClick: 5014 commandActiveTitlebar1: 0 commandActiveTitlebar2: 28 commandActiveTitlebar3: 2 commandInactiveTitlebar1: 4 commandInactiveTitlebar2: 28 commandInactiveTitlebar3: 2 commandWindow1: 7 commandWindow2: 8 commandWindow3: 8 commandWindowWheel: 28 commandAll1: 10 commandAll2: 3 commandAll3: 14 keyCmdAllModKey: 16777251 showGeometryTip: false condensedTitle: false electricBorderMaximize: true electricBorderTiling: true electricBorderCornerRatio: 0.25 borderlessMaximizedWindows: false killPingTimeout: 5000 hideUtilityWindowsForInactive: true compositingMode: 1 useCompositing: true hiddenPreviews: 1 unredirectFullscreen: false glSmoothScale: 2 xrenderSmoothScale: false maxFpsInterval: 16666666 refreshRate: 200 vBlankTime: 6000000 glStrictBinding: false glStrictBindingFollowsDriver: true glCoreProfile: true glPreferBufferSwap: 99 glPlatformInterface: 1 windowsBlockCompositing: true
Screen Edges
desktopSwitching: false desktopSwitchingMovingClients: false cursorPushBackDistance: 1x1 timeThreshold: 150 reActivateThreshold: 350 actionTopLeft: 0 actionTop: 0 actionTopRight: 0 actionRight: 0 actionBottomRight: 0 actionBottom: 0 actionBottomLeft: 0 actionLeft: 0
Screens
Multi-Head: no Active screen follows mouse: no Number of Screens: 1
Screen 0:
Name: DP-4 Geometry: 0,0,2560x1440 Scale: 1 Refresh Rate: 165
Compositing
Compositing is active Compositing Type: OpenGL OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce RTX 2070 SUPER/PCIe/SSE2 OpenGL version string: 3.1.0 NVIDIA 440.59 OpenGL platform interface: GLX OpenGL shading language version string: 1.40 NVIDIA via Cg compiler Driver: NVIDIA Driver version: 440.59 GPU class: Unknown OpenGL version: 3.1 GLSL version: 1.40 X server version: 1.20.7 Linux kernel version: 5.5.6 Direct rendering: Requires strict binding: no GLSL shaders: yes Texture NPOT support: yes Virtual Machine: no OpenGL 2 Shaders are used Painting blocks for vertical retrace: yes
Loaded Effects:
zoom thumbnailaside kwin4_effect_windowaperture kwin4_effect_translucency kwin4_effect_squash kwin4_effect_sessionquit kwin4_effect_scale kwin4_effect_morphingpopups kwin4_effect_maximize kwin4_effect_logout kwin4_effect_login kwin4_effect_frozenapp kwin4_effect_fadingpopups kwin4_effect_dimscreen kwin4_effect_dialogparent slidingpopups slideback slide screenshot flipswitch diminactive desktopgrid cube colorpicker resize presentwindows highlightwindow blur contrast startupfeedback screenedge kscreen
Currently Active Effects:
diminactive blur contrast
Effect Settings:
zoom: zoomFactor: 1.2 mousePointer: 0 mouseTracking: 0 enableFocusTracking: false followFocus: true focusDelay: 350 moveFactor: 20 targetZoom: 1
thumbnailaside: maxWidth: 200 spacing: 10 opacity: 0.5 screen: -1
kwin4_effect_windowaperture: isActiveFullScreenEffect: false
kwin4_effect_translucency: isActiveFullScreenEffect: false
kwin4_effect_squash: isActiveFullScreenEffect: false
kwin4_effect_sessionquit: isActiveFullScreenEffect: false
kwin4_effect_scale: isActiveFullScreenEffect: false
kwin4_effect_morphingpopups: isActiveFullScreenEffect: false
kwin4_effect_maximize: isActiveFullScreenEffect: false
kwin4_effect_logout: isActiveFullScreenEffect: false
kwin4_effect_login: isActiveFullScreenEffect: false
kwin4_effect_frozenapp: isActiveFullScreenEffect: false
kwin4_effect_fadingpopups: isActiveFullScreenEffect: false
kwin4_effect_dimscreen: isActiveFullScreenEffect: false
kwin4_effect_dialogparent: isActiveFullScreenEffect: false
slidingpopups: slideInDuration: 150 slideOutDuration: 250
slideback:
slide: duration: 500 horizontalGap: 45 verticalGap: 20 slideDocks: false slideBackground: true
screenshot:
flipswitch: tabBox: false tabBoxAlternative: false duration: 200 angle: 30 xPosition: 0.33000001311302185 yPosition: 1 windowTitle: true
diminactive: dimStrength: 25 dimPanels: false dimDesktop: false dimKeepAbove: false dimByGroup: true dimFullScreen: true
desktopgrid: zoomDuration: 300 border: 10 desktopNameAlignment: 0 layoutMode: 0 customLayoutRows: 2 usePresentWindows: true
cube: cubeOpacity: 0.800000011920929 opacityDesktopOnly: false displayDesktopName: true reflection: true rotationDuration: 500 backgroundColor: #000000 capColor: #31363b paintCaps: true closeOnMouseRelease: false zPosition: 100 useForTabBox: false invertKeys: false invertMouse: false capDeformationFactor: 0 useZOrdering: false texturedCaps: true
colorpicker:
resize: textureScale: true outline: false
presentwindows: layoutMode: 0 showCaptions: true showIcons: true doNotCloseWindows: false ignoreMinimized: false accuracy: 20 fillGaps: true fadeDuration: 150 showPanel: false leftButtonWindow: 1 rightButtonWindow: 2 middleButtonWindow: 0 leftButtonDesktop: 2 middleButtonDesktop: 0 rightButtonDesktop: 0
highlightwindow:
blur:
contrast:
startupfeedback: type: 1
screenedge:
kscreen:
Output of qdbus org.kde.KWin /KWin supportInformation (Without commit 88e8073cba24b972b6cf60ad20bc7f1c9693ac78 reverted, stuttering happens here, also Vsync mechanism changed to None and just hope for the best)
==========================
Version
KWin version: 5.18.2 Qt Version: 5.14.1 Qt compile version: 5.14.1 XCB compile version: 1.13.1
Operation Mode: X11 only
Build Options
KWIN_BUILD_DECORATIONS: yes KWIN_BUILD_TABBOX: yes KWIN_BUILD_ACTIVITIES: yes HAVE_DRM: yes HAVE_GBM: yes HAVE_EGL_STREAMS: yes HAVE_X11_XCB: yes HAVE_EPOXY_GLX: yes HAVE_WAYLAND_EGL: yes
X11
Vendor: The X.Org Foundation Vendor Release: 12007000 Protocol Version/Revision: 11/0 SHAPE: yes; Version: 0x11 RANDR: yes; Version: 0x14 DAMAGE: yes; Version: 0x11 Composite: yes; Version: 0x4 RENDER: yes; Version: 0xb XFIXES: yes; Version: 0x50 SYNC: yes; Version: 0x31 GLX: yes; Version: 0x0
Decoration
Plugin: org.kde.breeze Theme: Plugin recommends border size: None Blur: 0 onAllDesktopsAvailable: true alphaChannelSupported: true closeOnDoubleClickOnMenu: false decorationButtonsLeft: 0, 2 decorationButtonsRight: 6, 3, 4, 5 borderSize: 3 gridUnit: 12 font: Noto Sans,10,-1,5,50,0,0,0,0,0,Regular smallSpacing: 3 largeSpacing: 12
Platform
Name: KWin::X11StandalonePlatform
Options
focusPolicy: 0 nextFocusPrefersMouse: false clickRaise: true autoRaise: false autoRaiseInterval: 0 delayFocusInterval: 0 shadeHover: false shadeHoverInterval: 250 separateScreenFocus: false placement: 4 focusPolicyIsReasonable: true borderSnapZone: 10 windowSnapZone: 10 centerSnapZone: 0 snapOnlyWhenOverlapping: false rollOverDesktops: true focusStealingPreventionLevel: 1 operationTitlebarDblClick: 5000 operationMaxButtonLeftClick: 5000 operationMaxButtonMiddleClick: 5015 operationMaxButtonRightClick: 5014 commandActiveTitlebar1: 0 commandActiveTitlebar2: 28 commandActiveTitlebar3: 2 commandInactiveTitlebar1: 4 commandInactiveTitlebar2: 28 commandInactiveTitlebar3: 2 commandWindow1: 7 commandWindow2: 8 commandWindow3: 8 commandWindowWheel: 28 commandAll1: 10 commandAll2: 3 commandAll3: 14 keyCmdAllModKey: 16777251 showGeometryTip: false condensedTitle: false electricBorderMaximize: true electricBorderTiling: true electricBorderCornerRatio: 0.25 borderlessMaximizedWindows: false killPingTimeout: 5000 hideUtilityWindowsForInactive: true compositingMode: 1 useCompositing: true hiddenPreviews: 1 unredirectFullscreen: false glSmoothScale: 2 xrenderSmoothScale: false maxFpsInterval: 16666666 refreshRate: 200 vBlankTime: 6000000 glStrictBinding: false glStrictBindingFollowsDriver: true glCoreProfile: true glPreferBufferSwap: 99 glPlatformInterface: 1 windowsBlockCompositing: true
Screen Edges
desktopSwitching: false desktopSwitchingMovingClients: false cursorPushBackDistance: 1x1 timeThreshold: 150 reActivateThreshold: 350 actionTopLeft: 0 actionTop: 0 actionTopRight: 0 actionRight: 0 actionBottomRight: 0 actionBottom: 0 actionBottomLeft: 0 actionLeft: 0
Screens
Multi-Head: no Active screen follows mouse: no Number of Screens: 1
Screen 0:
Name: DP-4 Geometry: 0,0,2560x1440 Scale: 1 Refresh Rate: 165
Compositing
Compositing is active Compositing Type: OpenGL OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce RTX 2070 SUPER/PCIe/SSE2 OpenGL version string: 3.1.0 NVIDIA 440.59 OpenGL platform interface: GLX OpenGL shading language version string: 1.40 NVIDIA via Cg compiler Driver: NVIDIA Driver version: 440.59 GPU class: Unknown OpenGL version: 3.1 GLSL version: 1.40 X server version: 1.20.7 Linux kernel version: 5.5.6 Direct rendering: Requires strict binding: no GLSL shaders: yes Texture NPOT support: yes Virtual Machine: no OpenGL 2 Shaders are used Painting blocks for vertical retrace: yes
Loaded Effects:
zoom thumbnailaside kwin4_effect_windowaperture kwin4_effect_translucency kwin4_effect_squash kwin4_effect_sessionquit kwin4_effect_scale kwin4_effect_morphingpopups kwin4_effect_maximize kwin4_effect_logout kwin4_effect_login kwin4_effect_frozenapp kwin4_effect_fadingpopups kwin4_effect_dimscreen kwin4_effect_dialogparent slidingpopups slideback slide screenshot flipswitch diminactive desktopgrid cube colorpicker resize presentwindows highlightwindow blur contrast startupfeedback screenedge kscreen
Currently Active Effects:
diminactive blur contrast
Effect Settings:
zoom: zoomFactor: 1.2 mousePointer: 0 mouseTracking: 0 enableFocusTracking: false followFocus: true focusDelay: 350 moveFactor: 20 targetZoom: 1
thumbnailaside: maxWidth: 200 spacing: 10 opacity: 0.5 screen: -1
kwin4_effect_windowaperture: isActiveFullScreenEffect: false
kwin4_effect_translucency: isActiveFullScreenEffect: false
kwin4_effect_squash: isActiveFullScreenEffect: false
kwin4_effect_sessionquit: isActiveFullScreenEffect: false
kwin4_effect_scale: isActiveFullScreenEffect: false
kwin4_effect_morphingpopups: isActiveFullScreenEffect: false
kwin4_effect_maximize: isActiveFullScreenEffect: false
kwin4_effect_logout: isActiveFullScreenEffect: false
kwin4_effect_login: isActiveFullScreenEffect: false
kwin4_effect_frozenapp: isActiveFullScreenEffect: false
kwin4_effect_fadingpopups: isActiveFullScreenEffect: false
kwin4_effect_dimscreen: isActiveFullScreenEffect: false
kwin4_effect_dialogparent: isActiveFullScreenEffect: false
slidingpopups: slideInDuration: 150 slideOutDuration: 250
slideback:
slide: duration: 500 horizontalGap: 45 verticalGap: 20 slideDocks: false slideBackground: true
screenshot:
flipswitch: tabBox: false tabBoxAlternative: false duration: 200 angle: 30 xPosition: 0.33000001311302185 yPosition: 1 windowTitle: true
diminactive: dimStrength: 25 dimPanels: false dimDesktop: false dimKeepAbove: false dimByGroup: true dimFullScreen: true
desktopgrid: zoomDuration: 300 border: 10 desktopNameAlignment: 0 layoutMode: 0 customLayoutRows: 2 usePresentWindows: true
cube: cubeOpacity: 0.800000011920929 opacityDesktopOnly: false displayDesktopName: true reflection: true rotationDuration: 500 backgroundColor: #000000 capColor: #31363b paintCaps: true closeOnMouseRelease: false zPosition: 100 useForTabBox: false invertKeys: false invertMouse: false capDeformationFactor: 0 useZOrdering: false texturedCaps: true
colorpicker:
resize: textureScale: true outline: false
presentwindows: layoutMode: 0 showCaptions: true showIcons: true doNotCloseWindows: false ignoreMinimized: false accuracy: 20 fillGaps: true fadeDuration: 150 showPanel: false leftButtonWindow: 1 rightButtonWindow: 2 middleButtonWindow: 0 leftButtonDesktop: 2 middleButtonDesktop: 0 rightButtonDesktop: 0
highlightwindow:
blur:
contrast:
startupfeedback: type: 1
screenedge:
kscreen:
Screenshots of NVIDIA panel entries:
While setting the vsync mechanism to "do nothing and hope for the best" should theoretically give pre-5.18.2 behavoir, it apparently does not, and has a lot worse performace then 5.18.1 with the vsync mechanism to "do nothing and hope for the best"
Thanks for your efforts, I appreciate it!
I belive I figured out what's the problem. Basically, when the nvidia driver is newer than 435, useHorribleHack is automatically enabled. However, when setting the vsync mechanism to "Hope for the Best" the useHorribleHack variable does not get set to false again, effectively enabling hopeBest and useHorribleHack simultaneously, which doesn't make a lot of sense and causes terrible stuttering on some systems. I created a pull request to fix the issue: https://github.com/tildearrow/kwin-lowlatency/pull/64 When applying the pull request I suggested kwin-lowlatency seems to be butter smooth again for me if i set the vsync mechanism to "Hope for the Best"
It's not random stuttering. What happens is that you currently get half vsync. At 60Hz, kwin runs at 30FPS (which of course looks like extreme stutter). At 120Hz, I get 60FPS, and at 144Hz I get 72FPS.
So yep, it's a simple mistake in the switch statement. This is probably a more appropriate patch since the hack should be disabled in all cases except for the one that specifically enables it:
diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp
index d661a4d79..0c3ae17f0 100644
--- a/plugins/platforms/x11/standalone/glxbackend.cpp
+++ b/plugins/platforms/x11/standalone/glxbackend.cpp
@@ -244,14 +244,17 @@ void GlxBackend::init()
case 1:
useWaitSync=false;
hopeBest=true;
+ useHorribleHack=false;
break;
case 2:
useWaitSync=true;
hopeBest=false;
+ useHorribleHack=false;
break;
case 3:
useWaitSync=false;
hopeBest=false;
+ useHorribleHack=false;
break;
case 4:
useWaitSync=true;
Although it seems commit 88e8073cba24b972b6cf60ad20bc7f1c9693ac78 that switched the default on nvidia should also be reverted since the bug report seems kinda iffy now.
Reverted the horrible hack commit and merged your pull request. Thank you for the report.
I just need to figure out what causes #42 and #36 now...
Thanks :)!
So, Recently I upgraded to kwin-lowlatency 5.18.2. After the upgrade I noticed serious stuttering. Fair enough, read the update logs and found out I had to manually set the vsync mechanism to "hope for the best". However, even after doing that KWin still stuttered a lot more than 5.18.1 My guess is that removing the useWaitSync=false; for nvidia 435+ is a little.. well... problematic. My guess would be that WaitSync Slows down the compositing, any ideas? Or could you add an option to disable WaitSync maunally from the settings?