Bug 493090 - Gamescope using adaptive-sync experiences frequent jumps to monitor's max refresh rate, not present with gamescope's own DRM backend
Summary: Gamescope using adaptive-sync experiences frequent jumps to monitor's max ref...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (other bugs)
Version First Reported In: 6.2.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-13 23:57 UTC by Matthew Schwartz
Modified: 2025-01-06 23:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Schwartz 2024-09-13 23:57:05 UTC
SUMMARY
When using Gamescope's Wayland backend from within a KWin DRM backend session, adaptive sync in gamescope will often jump up to my monitor's maximum refresh rate for a small blip before dropping back down to the game's actual frame rate. VRR recently got a bit of a rework in gamescope as of 3.15.x, and now the difference between gamescope's DRM backend and nested from Kwin has gotten noticeable if I look at my monitor's live OSD.

I showed clips of this behavior difference to a gamescope dev and they said the cause of this was likely happening outside of gamescope itself if gamescope's VRR was working as expected in the DRM backend. I'll link two videos clips of the behavior as I'm seeing it on my monitor with gamescope's DRM backend compared to the nested within the Kwin drm backend along with my monitor's OSD.
---
Gamescope DRM backend command (I use Valve's package that includes gamescope-session in this case): gamescope -e -h 2160 -w 7860 -r 120 --adaptive-sync --mangoapp -- steam -steamdeck -steamos3 -steampal -gamepadui
Video of behavior w/ gamescope DRM backend: https://youtu.be/CwZpcCX-4V0

Nested gamescope from Plasma command: gamescope -h 2160 -w 7860 -f -r 120 --adaptive-sync --mangoapp -- %command%
Video of behavior w/ gamescope nested on Plasma Wayland: https://youtu.be/vxfpLZ2b9lI

STEPS TO REPRODUCE

1. Launch a game with a variation of those launch options to fit your display. Ideally, you want something that will max out the framerate a bit below your display's refresh rate
2. If your monitor has an OSD that allows you to observe the Variable Refresh Rate it is processing, enable it.

OBSERVED RESULT
Gamescope with the KWin DRM Backend has many noticeable jumps up to the display's set refresh rate rather than the game's refresh rate

EXPECTED RESULT
Gamescope with the KWin DRM Backend should have the same VRR behavior as Gamescope's DRM backend

SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux 
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.11.0-rc7-1-cachyos-rc (64-bit)
Graphics Platform: Wayland
Processors: 64 ร— AMD Ryzen Threadripper 7970X 32-Cores
Memory: 62.3 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX
Gamescope version: gamescope version 3.15.9 (gcc 14.2.1)

ADDITIONAL INFORMATION
No frametime variation is present in the MangoHud overlay
Comment 1 joshuargiacone 2024-11-08 18:13:52 UTC
Same issue see: https://github.com/ValveSoftware/gamescope/issues/1617
Comment 2 Zamundaaa 2024-11-08 18:23:58 UTC
Does this also happen if you just start the game without gamescope?
Comment 3 Matthew Schwartz 2024-11-08 18:52:20 UTC
(In reply to Zamundaaa from comment #2)
> Does this also happen if you just start the game without gamescope?
I've been testing with Quake 2 RTX, and in my case it does not occur if you start the game without gamescope. Tested with both "Automatic" and "Always" adaptive sync settings in KDE.
Comment 4 joshuargiacone 2024-11-08 19:36:45 UTC
(In reply to Zamundaaa from comment #2)
> Does this also happen if you just start the game without gamescope?

If you click the github link I posted two videos showcasing one with gamescope and one without, does not happen when gamescope is not used.
Comment 5 Bug Janitor Service 2024-11-23 03:46:38 UTC
๐Ÿ›๐Ÿงน โš ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2024-12-08 03:46:28 UTC
๐Ÿ›๐Ÿงน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.
Comment 7 Zamundaaa 2024-12-16 16:11:43 UTC
(In reply to Matthew Schwartz from comment #3)
> (In reply to Zamundaaa from comment #2)
> > Does this also happen if you just start the game without gamescope?
> I've been testing with Quake 2 RTX, and in my case it does not occur if you
> start the game without gamescope. Tested with both "Automatic" and "Always"
> adaptive sync settings in KDE.
Then it must be a bug in gamescope
Comment 8 Syntist 2025-01-06 18:19:39 UTC
The fix for it to stop using mangoapp, and use mangohud inside gamescope. It works fine that way, when you use mangoapp the vrr doesn't work. 
Tested.
Comment 9 joshuargiacone 2025-01-06 18:42:19 UTC
(In reply to Syntist from comment #8)
> The fix for it to stop using mangoapp, and use mangohud inside gamescope. It
> works fine that way, when you use mangoapp the vrr doesn't work. 
> Tested.

This is just mot true. Look at the github link I posted above I sent videos of it with just gamescope and no mango app https://github.com/ValveSoftware/gamescope/issues/1617
Comment 10 Syntist 2025-01-06 18:55:11 UTC
Did you try yourself, without using mangoapp? cause for me that fixed the issue.
Try to test without mangoapp and with in game fps monitor, or just mangohud
Comment 11 Syntist 2025-01-06 18:56:07 UTC
(In reply to joshuargiacone from comment #9)
> (In reply to Syntist from comment #8)
> > The fix for it to stop using mangoapp, and use mangohud inside gamescope. It
> > works fine that way, when you use mangoapp the vrr doesn't work. 
> > Tested.
> 
> This is just mot true. Look at the github link I posted above I sent videos
> of it with just gamescope and no mango app
> https://github.com/ValveSoftware/gamescope/issues/1617

oh you already tried it, weird for me it works without mangoapp, with mangoapp it doesn't work.
Comment 12 Syntist 2025-01-06 18:56:21 UTC
(In reply to joshuargiacone from comment #9)
> (In reply to Syntist from comment #8)
> > The fix for it to stop using mangoapp, and use mangohud inside gamescope. It
> > works fine that way, when you use mangoapp the vrr doesn't work. 
> > Tested.
> 
> This is just mot true. Look at the github link I posted above I sent videos
> of it with just gamescope and no mango app
> https://github.com/ValveSoftware/gamescope/issues/1617

oh you already tried it, weird for me it works without mangoapp, with mangoapp it doesn't work.
Comment 13 Matthew Schwartz 2025-01-06 23:07:04 UTC
It definitely happens without mangoapp as well, but the bug depends on which game you are playing. Some work fine without mangoapp, others stutter even without it (like Quake 2 RTX). In any case, it also happens on Cosmic desktop with their VRR implementation, so as Xaver said it's not a KDE issue but a Gamescope issue.