Bug 486137

Summary: System stuttering when GPU nearing 100%
Product: [Plasma] kwin Reporter: Zastrix Arundell <zastrixarundell>
Component: performanceAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, xaver.hugl
Priority: NOR    
Version First Reported In: 6.0.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Frametime when playing elden ring and maxing out the GPU

Description Zastrix Arundell 2024-04-25 23:46:48 UTC
Created attachment 168910 [details]
Frametime when playing elden ring and maxing out the GPU

SUMMARY
When the system is nearing 100% GPU usage, the system starts to stutter and skips frames. This is similar behavior to KDE5 where you would enable prefer lower latency (skip frames). One KDE5 you would be able to select prefer smoother frames and it would not stutter as much. 

The issue is happening with AMD hardware and KDE6. Switching to GNOME fixes the issue, so it's not a driver/wayland issue.

STEPS TO REPRODUCE
1. Run game
2. Force it to have 100% GPU usage
3. Frametimes are massive in jumps

OBSERVED RESULT
Stuttery gameplay

EXPECTED RESULT
Smooth gameplay

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Kinoite uBlue main
(available in About System)
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
The issue is similar to this: https://bugs.kde.org/show_bug.cgi?id=482677, but enabling software mouse didn't do anything, so I've felt I should create a new issue.
Comment 1 Zamundaaa 2024-04-26 18:18:03 UTC
Does this happen only in windowed mode, or in fullscreen too? I tried Red Dead Redemption 2 and Cyberpunk 2077, and while I can make KWin drop tons of frames with RDR2 in windowed mode, that's because compositing takes longer than the frame time with 100% GPU utilization, and no desktop environment can work around that... and in full screen, there are no dropped frames (on KWin's side).

Also, can you reproduce this in other games? In the two I tested, even while KWin's dropping frames left and right, that only had a very very minor effect on the game's frame graph.
Comment 2 Zastrix Arundell 2024-04-26 20:25:32 UTC
The only games where I reproduced it (which I have and are heavy) is Elden Ring and Witcher 3 non-raytracing. Again, this is a regression in kwin because on KDE5 while I did have this issue originally, I set the compositor to prefer animations and it fixed the issue; the frame were stable when the FPS dropped. On KDE6 there is no such option and I have the original issue. 

Gnome doesn't have it but I don't like using Gnome.
Comment 3 Zastrix Arundell 2024-04-28 11:06:43 UTC
Also while I did not mention it in the previous comment, having the app in fullscreen or not doesn't affect the FPS stuttering. Also this might be an issue for RDNA3 cards... maybe? The GPU clock did seem fine when I test it out, around 3GHz, it might go down to 2.7GHz but it's in that ballpark.
Comment 4 Bug Janitor Service 2024-05-13 03:45:19 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Zastrix Arundell 2024-05-13 08:17:30 UTC
It does seem to be better in the recent version, there aren't much stutters in the graph now BUT I can see that the <50 FPS situations feel way worse than they should. On GNOME something with ~40FPS feels 40FPS, there's no micro-stuttering in between frames. On KDE I can 100% feel the stuttering. (also dragging windows stuttering, this is on a 7900XTX).
Comment 6 Zastrix Arundell 2024-05-14 11:03:16 UTC
I've set my monitor to run @ 60Hz and wither 3 to run on RT Ultra settings, the game is above 60FPS ~(64-68) but it's stuttering even though it's always higher than refresh rate of my monitor.
Comment 7 Zastrix Arundell 2024-05-14 21:45:30 UTC
This is also happening in the Elder Scrolls Online when FPS is uncapped, so it's not a ray-tracing issue.
Comment 8 Zastrix Arundell 2024-06-21 09:59:58 UTC
Generally since 6.0.4 I didn't have this issue that much. Gnome handles lower frame rates a bit better now but that's something you need VRR for either way in the context of gaming. I'd guess the issue can be closed now.
Comment 9 Zamundaaa 2024-06-21 16:21:20 UTC
Yeah with 6.0.4(.1) you're much more likely to hit direct scanout because there was a bug in it before. It almost certainly was that... if the issue comes back though, just reopen this.