Bug 459286 - [Regression, Bisected] Screen garbles/freezes when changing resolution/refresh rate respectively.
Summary: [Regression, Bisected] Screen garbles/freezes when changing resolution/refres...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.25.90
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-17 15:02 UTC by Andrej Halveland
Modified: 2022-09-17 16:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
dmesg output with drm debugging (995.68 KB, text/x-log)
2022-09-17 15:06 UTC, Andrej Halveland
Details
output of journalctl --boot 0 | grep kwin_wayland_drm (12.70 KB, text/x-log)
2022-09-17 15:09 UTC, Andrej Halveland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrej Halveland 2022-09-17 15:02:41 UTC
Updating to Plasma 5.25.90 I noticed that whenever my screen refresh rate changes (e.g. disconnecting/connecting the charger by a script) the screen completely freezes (and if let sitting for a few minutes, then it also starts to garble) and requires a reboot afterwards. Changing the screen resolution garbles/corrupts the screen but returning to the previous resolution gets the screen un-garbled.


STEPS TO REPRODUCE
1.  Be on latest beta KWin release (5.25.90)
2.  Change screen refresh-rate/resolution

OBSERVED RESULT
Screen freezes after changing refresh rate, requiring a reboot.
Screen garbles/corrupts after changing resolution, reverting the change "fixes" it.

EXPECTED RESULT
Screen shouldn't freeze and/or garble.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.25.90
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Kernel Version: 5.19.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: AMD Ryzen 9 4900HS 8-Core Processor
Memory:  16GB of RAM
Graphics Processor: Integrated: Vega 8     Dedicated: NVIDIA GeForce RTX 2060 Max-Q
Manufacturer: ASUS (Zephyrus G15 GA502IV)

ADDITIONAL INFORMATION
Downgrading to KWin 5.25.5 fixes the issue, therefore I started to bisect and I came to commit 4be81e01761dffff4f541c3b34bbf02f28d635fd to be causing the issue.
Comment 1 Andrej Halveland 2022-09-17 15:06:50 UTC
Created attachment 152158 [details]
dmesg output with drm debugging
Comment 2 Andrej Halveland 2022-09-17 15:09:24 UTC
Created attachment 152159 [details]
output of journalctl --boot 0 | grep kwin_wayland_drm
Comment 3 Zamundaaa 2022-09-17 15:31:35 UTC
Relevant lines are:
>[  491.838731] amdgpu 0000:05:00.0: [drm:drm_atomic_check_only] checking 00000000bd3a0560
>[  491.838737] amdgpu 0000:05:00.0: [drm:drm_atomic_helper_check_modeset] [CRTC:67:crtc-0] mode changed
>[  491.838742] amdgpu 0000:05:00.0: [drm:drm_atomic_helper_check_modeset] [CRTC:67:crtc-0] needs all connectors, enable: y, active: y
>[  491.838745] amdgpu 0000:05:00.0: [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:67:crtc-0] to 00000000bd3a0560
>[...]
>[  491.839469] [drm:dm_update_crtc_state [amdgpu]] Mode change not required for front porch change, setting mode_changed to 0
>[...]
>[  491.839946] amdgpu 0000:05:00.0: [drm:drm_atomic_nonblocking_commit] committing 00000000bd3a0560 nonblocking

amdgpu thinks it doesn't need a modeset to do the commit, and so KWin doesn't do one. Presumably it would actually need a modeset to make your display work properly. We could add a workaround in KWin (always do a modeset if it *might* be needed) but this is a really severe bug and needs to be fixed in amdgpu, so I'd rather not do that. You can put KWIN_DRM_NO_AMS=1 into /etc/environment as a temporary workaround though, with that KWin will always do a full modeset.

Please report it at https://gitlab.freedesktop.org/drm/amd/-/issues and link the issue here; I'll add more information there as needed.
Comment 4 Andrej Halveland 2022-09-17 16:36:44 UTC
Here's the report: https://gitlab.freedesktop.org/drm/amd/-/issues/2162