Bug 485730

Summary: Severe stuttering with Plasma 6.0.4
Product: [Plasma] kwin Reporter: tux <tux>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: contact, d.ronay, julien.dlq, leguen.yannick, luisrvervaet, stefanfunk1998, wannabetheguy, watisthispoo
Priority: NOR    
Version: 6.0.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description tux 2024-04-18 12:29:59 UTC
After updating from Plasma 6.0.3 to 6.0.4 games are now unplayable due to severe stuttering. The issue persists even after disabling VRR completely through my monitor's OSD. It only happens on Plasma wayland. Plasma X11 (and Gnome wayland) have no stuttering. Downgrading to 6.0.3 fixes the issue.

GPU/driver: AMD RX 6650 XT RDNA2 desktop / amdgpu.

Possibly related:
https://bugs.kde.org/show_bug.cgi?id=485639
https://bugs.kde.org/show_bug.cgi?id=477016#c5
Comment 1 Nick 2024-04-19 16:02:28 UTC
I am experiencing this as well.

kwin 6.0.4:
On a Wayland session, games running in fullscreen severely stutter and may eventually lock up the machine. (Can't even switch TTY.)
Monitor OSD shows the refresh rate switching between 72Hz and 144Hz if Adaptive sync is set to Automatic or Always.
Turning off Adaptive sync doesn't help. Windowed mode has no stutter.

kwin 6.0.3.1 (downgraded):
No stutter with fullscreen in games, as expected.

GPU: RX 6700 XT
Mesa: 24.0.5
kwin: 6.0.4
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
QT Version: 6.7.0
Kernel Version: 6.8.7
Comment 2 nttkde 2024-04-19 17:59:06 UTC
Today after updating to 6.0.4 fullscreen games (both vulkan and opengl) stutter badly, and I see also frequent random glitches where the whole or parts of the image flashes into a glitchy version. Hard to explain but like random reduced-colors noise, or some parts maybe bit like "oil surface colors". FPS counter in-game claims normal FPS but it's clearly not. Recording the game with OBS seems to make the glitches more frequent (maybe performance related?).
The games are fine in windowed mode.
X11 seems to work fine.

A weird thing was, that when I tried to record the game with OBS Studio (Snap package, PipeWire fullscreen capture), once for some reason OBS stopped responding when I tried to close it, and alt-tabbing to the game it was suddenly running fine. Then I killed OBS and the game started stuttering again. Wasn't able to reproduce it again, and I'm not sure if it was related or just coincidence.


Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 5.15.0-102-generic (64-bit)
Graphics Platform: Wayland
Graphics Processor: AMD Radeon RX Vega 56 (amdgpu)
My monitor does not support adaptive sync/VRR.
Comment 3 tux 2024-04-19 18:10:34 UTC
Reverting this commit and rebuilding kwin fixes the stuttering for me, both with VRR disabled or enabled:
https://invent.kde.org/plasma/kwin/-/commit/19ffe2ac411b866cd646942d4e3cfb41d8ca89a1

I tried reverting that commit because someone else found that it worked for them too:
https://bugs.kde.org/show_bug.cgi?id=485639#c3
Comment 4 Bug Janitor Service 2024-04-19 21:18:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5626
Comment 5 tux 2024-04-19 21:40:26 UTC
(In reply to Bug Janitor Service from comment #4)
> A possibly relevant merge request was started @
> https://invent.kde.org/plasma/kwin/-/merge_requests/5626

Just tested it and I can confirm that only applying the following commit to 6.0.4 also fixes the stuttering (both with VRR enabled/disabled):
https://invent.kde.org/plasma/kwin/-/commit/fba948b39f6e3b2e70caa1880903f8fb17faf6d9
Comment 6 Larvey 2024-04-20 04:19:35 UTC
Unsure if its related or not, but I'm experience complete system freezes when watching videos in fullscreen with KWin 6.0.4

Downgrading to KWin 6.0.3 seems to solve the problem.
I can't even get logs, its just a complete freeze, journalctl's log just abruptly ends, and I get nothing.
On newest mesa version with an AMD XFX 7900 GRE.

Will downgrade to 6.0.3 for now.
Comment 7 stefanfunk1998 2024-04-21 11:10:14 UTC
im having similar problems since 2 days ago on arch linux

at first i thought it was an issue with the new dota update, that led to system freezes (https://github.com/ValveSoftware/Dota-2/issues/2689), then when i got the freeze yesterday, while dota (or steam for that matter), wasnt running, and i got a freeze while just watching a movie on VLC (so both instances of fullscreen apps)

i also had some on and off issues on dota about the framerate jumping around somewhere between 60 and 144 fps (144 being my screen hertz and also my fps limit on dota)

everytime i freeze happened, i just used the reset button on my pc, apparently that will cause the freeze to not be logged in journald

i will try downgrading kwin as well now
Comment 8 Rauros 2024-04-21 11:17:58 UTC
Somebody else also reported a hang in fullscreen video. And there was no log in journal as well.
https://www.reddit.com/r/openSUSE/comments/1c8k2nf/system_hangs/
Comment 9 Zamundaaa 2024-04-21 14:55:24 UTC
Git commit fba948b39f6e3b2e70caa1880903f8fb17faf6d9 by Xaver Hugl.
Committed on 19/04/2024 at 21:06.
Pushed by zamundaaa into branch 'master'.

scene/workspacescene: don't check direct scanout candidates for a pixmap

We don't need a pixmap for direct scanout, and the drm backend destroys the pixmap
when direct scanout is successful... so this check created a loop of direct scanout
working and not working, and worse, the client reallocating its buffers each time.
Related: bug 485639, bug 485712, bug 477016

M  +1    -11   src/scene/workspacescene.cpp

https://invent.kde.org/plasma/kwin/-/commit/fba948b39f6e3b2e70caa1880903f8fb17faf6d9
Comment 10 Zamundaaa 2024-04-21 15:12:10 UTC
Git commit fbd780186c76764617dba0365b9ca3de7cfe2f86 by Xaver Hugl.
Committed on 21/04/2024 at 14:55.
Pushed by zamundaaa into branch 'Plasma/6.0'.

scene/workspacescene: don't check direct scanout candidates for a pixmap

We don't need a pixmap for direct scanout, and the drm backend destroys the pixmap
when direct scanout is successful... so this check created a loop of direct scanout
working and not working, and worse, the client reallocating its buffers each time.
Related: bug 485639, bug 485712, bug 477016


(cherry picked from commit fba948b39f6e3b2e70caa1880903f8fb17faf6d9)

M  +1    -11   src/scene/workspacescene.cpp

https://invent.kde.org/plasma/kwin/-/commit/fbd780186c76764617dba0365b9ca3de7cfe2f86
Comment 11 Zamundaaa 2024-04-21 23:25:24 UTC
*** Bug 485917 has been marked as a duplicate of this bug. ***
Comment 12 stefanfunk1998 2024-04-22 09:48:59 UTC
it looks like arch linux has rebuilt 6.0.4, just adding the commit in this thread as a patch: https://gitlab.archlinux.org/archlinux/packaging/packages/kwin/-/commit/7ee442803be3a0a3f405e03a714a024a8460005f

i've been using this new build 6.0.4-2 for today, playing games and having videos fullscreen, and havent encountered any crashes yet