Bug 482064 - Sluggish Desktop on Plasma 6, swap interval problem
Summary: Sluggish Desktop on Plasma 6, swap interval problem
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.0.0
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
: 478736 482178 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-02-29 17:28 UTC by Zane
Modified: 2024-03-11 13:40 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.1


Attachments
eglinfo run on Plasma 6 (19.84 KB, text/plain)
2024-02-29 17:37 UTC, Zane
Details
eglinfo run on Plasma 5 (20.61 KB, text/plain)
2024-02-29 17:37 UTC, Zane
Details
glxinfo run on Plasma 6 (65.37 KB, text/plain)
2024-02-29 17:37 UTC, Zane
Details
glxinfo run on Plasma 5 (65.37 KB, text/plain)
2024-02-29 17:38 UTC, Zane
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zane 2024-02-29 17:28:40 UTC
SUMMARY

After switching to Plasma 6, the desktop is extremely sluggish. This is not the case on Plasma 5.
Both were running in the Wayland session.

The FPS counter yields that it's only running at 30fps.
"Current FPS: 30 | Maximum FPS 60"

I'm running NixOS with the Apple Silicon patches (https://github.com/tpwrules/nixos-apple-silicon/blob/main/docs/uefi-standalone.md), so I initially thought it might be a mesa issue, but considering everything else works with Plasma 5, I'd be inclined to suspect kwin.

I also tested this with glxgears - also capped at 30. Running "vblank_mode=0 glxgears" causes it to run at full speed, suggesting there's something wrong with the swap interval.

I've switched back to Plasma 5.27.10 for the moment, but I can switch to 6 again to help debug.

STEPS TO REPRODUCE
1. Be running Plasma 5
2. See Plasma 6 release, get excited
3. Switch to Plasma 6
4. Observe Sluggish Desktop

OBSERVED RESULT

Desktop runs at 30fps.

EXPECTED RESULT

Desktop runs at 60fps.

SOFTWARE/OS VERSIONS
Operating System: NixOS 24.05
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.6.0-asahi (64-bit)
Graphics Platform: Wayland
Processors: 4 × Apple Firestorm (M1), 4 × Apple Icestorm (M1)
Memory: 15.3 GiB of RAM
Graphics Processor: Apple M1
Product Name: Apple MacBook Air (M1, 2020)
Comment 1 Zane 2024-02-29 17:37:07 UTC
Created attachment 166206 [details]
eglinfo run on Plasma 6
Comment 2 Zane 2024-02-29 17:37:30 UTC
Created attachment 166207 [details]
eglinfo run on Plasma 5
Comment 3 Zane 2024-02-29 17:37:47 UTC
Created attachment 166208 [details]
glxinfo run on Plasma 6
Comment 4 Zane 2024-02-29 17:38:09 UTC
Created attachment 166209 [details]
glxinfo run on Plasma 5
Comment 5 Zane 2024-03-02 08:29:08 UTC
Just tested the X11 session, this does not happen.
Interestingly, the "Show FPS" effect hovers at around 150-170, despite saying "Maximum 59".

Running glxgears, which should be vsync'd by default:
$ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
17025 frames in 5.0 seconds = 3404.824 FPS
17232 frames in 5.0 seconds = 3446.307 FPS
... and so on.

Seems there's some deep screwery going on here.
Comment 6 Zane 2024-03-02 08:32:28 UTC
Side note, I wonder if this is the same issue as this:
https://gitlab.gnome.org/GNOME/mutter/-/issues/3247#note_1973529
https://gitlab.freedesktop.org/asahi/mesa/-/issues/35

In which, case I'll report it upstream to mesa.
Comment 7 Kamila Frej 2024-03-02 14:45:37 UTC
Hi! I'm having the same issue on a Thinkpad X61s in the Wayland session. GLXGears is reporting 30fps and this seems to correlate with the refresh rate. If I switch refresh rate from 60Hz to 40Hz I get 20fps in GLXGears, likewise with 50Hz -> 25fps.

Running Fedora 40 Beta.

Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.0-0.rc6.49.fc40.x86_64 (64-bit)
Graphics Platform: X11
Processors: 2 × Intel® Core™2 Duo CPU L7500 @ 1.60GHz
Memory: 3.7 GiB of RAM
Graphics Processor: Mesa Intel® 965GM
Manufacturer: LENOVO
Product Name: 7667CB5
System Version: ThinkPad X61s
Comment 8 David Warner 2024-03-03 12:08:38 UTC
I think I'm seeing the same issue on my desktop, but only when I set my display to 24 Hz (the glxgears FPS drops to 12 - for other refresh rates, the FPS matches the refresh rate). I noticed because I use mpv-kscreen-doctor to set the display refresh rate to match the video refresh rate in mpv, which is frequently 24 Hz: https://gitlab.com/smaniottonicola/mpv-kscreen-doctor

Operating System: Fedora Linux 39
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.6-200.fc39.x86_64 (64-bit)
Graphics Platform: Wayland

Processors: 16 × AMD Ryzen 7 7700X 8-Core Processor
Memory: 30.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6800 XT
Manufacturer: ASRock
Product Name: 7667CB5
System Version: B650M PG Riptide
Comment 9 Bug Janitor Service 2024-03-03 18:10:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5344
Comment 10 Sawyer Bergeron 2024-03-03 19:55:13 UTC
*** Bug 478736 has been marked as a duplicate of this bug. ***
Comment 11 Zamundaaa 2024-03-04 12:40:44 UTC
Git commit da80dd4c8473de71e743d016791d5ddb06ff0996 by Xaver Hugl.
Committed on 04/03/2024 at 12:34.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix vblank calculation

Due to some misinterpretation of mode timings, the old method calculated vsync, not vblank,
so the resulting duration was much shorter, which caused frame drops on some systems.

M  +1    -1    src/backends/drm/drm_connector.cpp

https://invent.kde.org/plasma/kwin/-/commit/da80dd4c8473de71e743d016791d5ddb06ff0996
Comment 12 Zamundaaa 2024-03-04 12:49:26 UTC
Git commit be9d2fd7d07b84f0a9be7d950947ea097011356f by Xaver Hugl.
Committed on 04/03/2024 at 12:41.
Pushed by zamundaaa into branch 'Plasma/6.0'.

backends/drm: fix vblank calculation

Due to some misinterpretation of mode timings, the old method calculated vsync, not vblank,
so the resulting duration was much shorter, which caused frame drops on some systems.


(cherry picked from commit da80dd4c8473de71e743d016791d5ddb06ff0996)

M  +1    -1    src/backends/drm/drm_connector.cpp

https://invent.kde.org/plasma/kwin/-/commit/be9d2fd7d07b84f0a9be7d950947ea097011356f
Comment 13 Zamundaaa 2024-03-04 13:08:59 UTC
*** Bug 482178 has been marked as a duplicate of this bug. ***
Comment 14 David Warner 2024-03-06 11:00:38 UTC
Happy to confirm this is fixed for me in 6.0.1 with the above commit.
Comment 15 Nate Graham 2024-03-06 15:22:07 UTC
Great!
Comment 16 Zane 2024-03-11 13:40:10 UTC
6.0.1 finally hit the NixOS repos, can confirm this fixes it for me on the M1 Air.