Bug 489050 - KWin performance drops while Adaptive Sync is set to "Always"
Summary: KWin performance drops while Adaptive Sync is set to "Always"
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: performance (show other bugs)
Version: 6.1.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-23 14:11 UTC by Davut
Modified: 2024-07-22 20:02 UTC (History)
3 users (show)

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


Attachments
Video demonstrating the performance drop (1.10 MB, video/webm)
2024-06-23 14:11 UTC, Davut
Details
X server info from KDE panel (66.75 KB, text/plain)
2024-06-24 21:51 UTC, Leonardo
Details
Wayland info (27.24 KB, text/plain)
2024-06-24 21:52 UTC, Leonardo
Details
OpenGL info (145.21 KB, text/plain)
2024-06-24 21:52 UTC, Leonardo
Details
Window manager info (6.62 KB, text/plain)
2024-06-24 21:52 UTC, Leonardo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Davut 2024-06-23 14:11:13 UTC
Created attachment 170865 [details]
Video demonstrating the performance drop

SUMMARY
A while ago, i submitted this issue about panels stuttering on wayland while adaptive sync is "automatic": https://bugs.kde.org/show_bug.cgi?id=487480. 

Now the issue is mostly fixed. But i get big performance drops in KWin while the adaptive sync is auto after the issue is fixed. Performance drops doesnt occur when adaptive sync is disabled completely. Performance drops happens when running an external app that uses some part of gpu, like electron apps and games. 

I attached a video demonstrating how a discord start up effects the performance of KWin while using adaptive sync in automatic mode. I realized this issue as soon as 6.1 released since i am used to use kwin on 144fps and it drops down to about 60 or less. 


STEPS TO REPRODUCE
1. Set adaptive sync to "automatic"
2. Start another program that uses gpu, like a game or an hardware accelerated app
3. Observe the KWin performance

OBSERVED RESULT
Fps drops down to about 60 or less

EXPECTED RESULT
Fps should stay same at 140 or at least +120. From my previous experiences it was always over 130.

SOFTWARE/OS VERSIONS
Linux: 6.9.6-arch1-1
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Comment 1 Leonardo 2024-06-24 21:51:28 UTC
Created attachment 170929 [details]
X server info from KDE panel
Comment 2 Leonardo 2024-06-24 21:51:53 UTC
Hi! 

I can somehow confirm something similar on my system:

Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.9.5-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 31.2 GiB of RAM
Graphics Processor: AMD Radeon RX 6750 XT
Mesa: 24.1.2

Usually happens when i start a game via Steam but not always. 

I've noticed that if i touch the left border of the monitor, enabling the desktop switch, click again on desktop and then launch a game (ex. Doom (2016)), my performance goes from steady 144 fps to barely 30 fps. 

Same thing with the benchmark GravityMark, goes from 100 fps to 15-16 fps.

If i reboot the system, the problem is fixed.

If you need more information, just ask, i'll gladly provide :)
Comment 3 Leonardo 2024-06-24 21:52:18 UTC
Created attachment 170930 [details]
Wayland info
Comment 4 Leonardo 2024-06-24 21:52:33 UTC
Created attachment 170931 [details]
OpenGL info
Comment 5 Leonardo 2024-06-24 21:52:57 UTC
Created attachment 170932 [details]
Window manager info
Comment 6 Zamundaaa 2024-07-22 20:02:16 UTC
(In reply to Leonardo from comment #2)
> If you need more information, just ask, i'll gladly provide :)
I can reproduce that issue with Doom 2016, it'll go down in refresh rate to 60Hz, but it also goes back up again after 10-20s on my PC. Please make a separate bug report about that, it'll be unrelated to this one.

(In reply to Davut from comment #0)
> I attached a video demonstrating how a discord start up effects the
> performance of KWin while using adaptive sync in automatic mode. I realized
> this issue as soon as 6.1 released since i am used to use kwin on 144fps and
> it drops down to about 60 or less. 
This is expected; with adaptive sync set to always, KWin drops the refresh rate of the screen down to the focused window if that window is doing at least 30fps itself.
With Electron apps like Discord specifically, they do not handle adaptive sync correctly, which is why they'll be rendering only at 60Hz. It'll be fixed eventually in Chromium / Electron.