Bug 476342

Summary: After disabling laptop screen while external screen is connected, re-enabling laptop screen causes a visual freeze until switching to another VT and back
Product: [Plasma] kwin Reporter: Nate Graham <nate>
Component: multi-screenAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: xaver.hugl
Priority: NOR Keywords: multiscreen, qt6, wayland
Version: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=476341
https://bugs.kde.org/show_bug.cgi?id=476340
https://bugs.kde.org/show_bug.cgi?id=476412
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nate Graham 2023-10-30 21:13:31 UTC
Plasma 6 Wayland, today's git master. GPU hardware is an Intel 10th gen iGPU; drivers are from Mesa 23.1.9.


STEPS TO REPRODUCE
1. Have a laptop (it has a 4k screen normally run at 200% scale)
2. Plug in an external HDMI screen, either directly, or via a DisplayPort dongle (doesn't seem to make a difference)
3. Use the KScreen applet to invoke "Switch to External Screen" mode. The laptop screen correctly turns off.
4. Use the KScreen applet to invoke "Extend to left" or "Extend to right" modes, or use the KScreen KCM to manually mark the laptop screen as "Enabled"


OBSERVED RESULT
The laptop screen does not turn on and the external screen visually freezes. It's not *functionally* frozen; I can still interact with screen content, but the screen does not visually update. If I switch to a different VT and then back, the external screen becomes unfrozen and the laptop screen has visibly turned on. However the laptop screen remains visually frozen. In addition, random keyboard key events appear to get eaten. I have found no pattern to this. Rebooting brings everything back to normal.


EXPECTED RESULT
The laptop screen turns on, neither screen becomes visually frozen, no key events get eaten.
Comment 1 Nate Graham 2023-10-30 21:19:48 UTC
And now after going through the steps again, but NOT after rebooting, the issue isn't happening anymore.

I hate screens. Well, graphics drivers.
Comment 2 Nate Graham 2023-10-30 21:26:50 UTC
Rebooted and tried again. Now the issue is reproducing again for me as originally described.
Comment 3 Nate Graham 2023-10-30 21:37:17 UTC
Forget about the key events being eaten issue for now; that seems to be a Firefox thing that just coincidentally started happening at the same time as this issue.
Comment 4 Bug Janitor Service 2023-11-07 09:07:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4605
Comment 5 Zamundaaa 2023-11-09 11:42:59 UTC
Git commit c1312a555169c801b2c116a7b333443730092e07 by Xaver Hugl.
Committed on 09/11/2023 at 12:35.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix pageflip events getting lost when outputs get turned off

When a display gets turned off while a pageflip event was still pending, the pending
state gets changed immediately, without waiting for the pageflip event to arrive first.
When this happens, activePending() returns false, and so the pageflip event gets discarded.
This commit changes the logic to only check for activePending() when the pageflip is for a
modeset, avoiding that issue.
Related: bug 476340, bug 476341, bug 437520, bug 475146

M  +10   -2    src/backends/drm/drm_commit.cpp
M  +2    -0    src/backends/drm/drm_commit.h
M  +5    -2    src/backends/drm/drm_pipeline.cpp
M  +2    -1    src/backends/drm/drm_pipeline.h

https://invent.kde.org/plasma/kwin/-/commit/c1312a555169c801b2c116a7b333443730092e07