Bug 513040 - black screen in kwin wayland after disconnecting usb-c monitor
Summary: black screen in kwin wayland after disconnecting usb-c monitor
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.5.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks: 506893
  Show dependency tree / graph
 
Reported: 2025-12-07 09:19 UTC by Nojus Gudinavičius
Modified: 2026-03-20 20:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.6.0
Sentry Crash Report:


Attachments
journalctl log (9.78 KB, text/plain)
2025-12-07 09:19 UTC, Nojus Gudinavičius
Details
drm debug log (476.01 KB, application/gzip)
2026-01-23 22:41 UTC, Nojus Gudinavičius
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nojus Gudinavičius 2025-12-07 09:19:55 UTC
Created attachment 187408 [details]
journalctl log

SUMMARY
My main setup contains of a laptop running KDE wayland, connected to a monitor via USB-C. The laptop display is configured to be off then the external monitor is connected. _Sometimes_ after I a) open the laptop lid b) disconnect the external monitor the laptop display never comes back and remains black. I can "fix" this by  ssh'ing and running `kwin --replace` from other device, but this kills the session and brightness keys no longer work for laptop screen. Rebooting obviously fixes this.

STEPS TO REPRODUCE
1. Have a running KDE wayland session with laptop (screen of) and external monitor via USB-C
2. Disconnect the external monitor and hope it reproduces

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 42
KDE Plasma Version: 6.5.3
KDE Frameworks Version: 6.20.0
Qt Version: 6.9.3
Kernel Version: 6.17.8-200.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
Memory: 32 GiB of RAM (31.1 GiB usable)
Graphics Processor: Intel® Iris® Xe Graphics

ADDITIONAL INFORMATION
attaching a journalctl log of the event. The relevant lines are probably
Dec 07 10:49:19 fw kwin_wayland[1600]: kwin_wayland_drm: Atomic modeset test failed! Invalid argument
Dec 07 10:49:19 fw kwin_wayland[1600]: kwin_wayland_drm: Setting dpms mode failed!
Comment 1 TraceyC 2026-01-21 22:02:52 UTC
These logs seem relevant

Dec 07 10:49:19 fw kwin_wayland[1600]: kwin_wayland_drm: Atomic modeset test failed! Invalid argument
Dec 07 10:49:19 fw kwin_wayland[1600]: kwin_wayland_drm: Setting dpms mode failed!

Can I ask you to follow the instructions here to get us some detailed logs? This will help us investigate what's causing the failed modesets.

https://invent.kde.org/plasma/kwin/-/wikis/Debugging/Debugging-DRM-issues

Thanks!
Comment 2 Nojus Gudinavičius 2026-01-23 22:41:34 UTC
Created attachment 188834 [details]
drm debug log

managed to reproduce again, attaching the drm debug log (gzipped because it exceeds the file size limit)
Comment 3 TraceyC 2026-01-28 17:52:30 UTC
Thanks!
Comment 4 Zamundaaa 2026-02-12 16:01:20 UTC
Alright, so I looked at this, and it's caused by KWin doing nonsense with DPMS. A consistent way to trigger it is this:
- connect the external screen
- turn off the internal screen
- disconnect the external screen again
- wait until the internal screen turns off (setting the timeout to 30s helps)
- connect the external screen
- disconnect the external screen

When this happens, the internal screen is still dpms off, and because of how dpms is handled in Plasma 6.5, it fails to turn it on again.
I can't think of a way to fix that which can be backported to 6.5, but thankfully I already rewrote dpms handling for Plasma 6.6, and it fixes this.
Comment 5 Nojus Gudinavičius 2026-03-20 20:13:56 UTC
I can confirm updating to Plasma 6.6 solved this issue. Thanks!