Bug 475190 - Toggling Fullscreen on Plasma Wayland Session crashes i915 DRM
Summary: Toggling Fullscreen on Plasma Wayland Session crashes i915 DRM
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (other bugs)
Version First Reported In: 5.27.8
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2023-10-03 19:00 UTC by soomakan
Modified: 2023-10-04 14:45 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description soomakan 2023-10-03 19:00:06 UTC
SUMMARY
When toggling a window to fullscreen in Plasma Wayland Session, there is a chance that the screen freezes, glitches or starts flickering. Nothing crashes and the system will still respond to input, but thanks to the screen glitches, the system is unusable. The screen, in rare occasions, returns to normal after a few seconds, but recovery is exceptional and inconsistent.

STEPS TO REPRODUCE
1. Start Firefox in plasma wayland session. (Or/and your favorite application. Firefox makes it most consistent for me, but other applications also do the trick.)
2. Toggle Fullscreen. For Firefox, press F11. In general, press Alt+F3 > M > F
4. The screen glitches, freezes dark or flickers. 

(Not totally consistent and seems to occur with different likelihood with different windows. Trying a few more times with different windows usually does the trick. I have succeeded with dolphin, konsole, emacsclient too, but less consistently. In an imprecise manner, it seems that the more complicated windows trigger the issue more easily.)

OBSERVED RESULT
The window becomes fullscreen. Then the screen glitches, freezes or starts to flicker. 
The following error is produced upon glitching in the kernel log.
 i915 0000:00:02.0: [drm] *ERROR* Timed out waiting PSR idle state
On the first time this glitch happens, it also produces the following error:
 i915 0000:00:02.0: [drm] *ERROR* CPU pipe A FIFO underrun: port,transcoder,
Nothing crashes and no further errors are produced

The screen may or may not recover from the glitch after toggling off fullscreen, closing the window or waiting a few seconds.

The system remains responsive to inputs. Switching to another TTY does NOT resolve the issue, but one may then Ctrl-Alt-Del to perform a normal reboot.

EXPECTED RESULT
The window becomes fullscreen.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux (Kernel: linux 6.5.5.arch1-1)
(available in About System)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Weston and Plasma X11 session unaffected, which is why I reported the issue here.

Hardware: Thinkpad X1 Carbon Gen11 (intel i7-1370P with integrated graphics)
Screen resolution: 1920x1200
Mesa version: mesa 23.2.1

The aforementioned error in the kernel log is occasionally accompanied by the following error:
 i915 0000:00:02.0: [drm] *ERROR* CPU pipe A FIFO underrun: port,transcoder,
 i915 0000:00:02.0: [drm] *ERROR* Timeout waiting for DDI BUF A to get active
 i915 0000:00:02.0: [drm] *ERROR* Potential atomic update failure on pipe A
Comment 1 Zamundaaa 2023-10-04 11:21:08 UTC
This is a kernel bug, please report it to https://gitlab.freedesktop.org/drm/intel/-/issues
Comment 2 soomakan 2023-10-04 14:45:01 UTC
(In reply to Zamundaaa from comment #1)
> This is a kernel bug, please report it to
> https://gitlab.freedesktop.org/drm/intel/-/issues

Thank you for replying. After some more experiments, I am convinced that the issue is triggered by the on-toggling of VRR (Adaptive Sync). It has been reproduced with another compositor and is likely indeed a kernel problem as you said. I will forward the issue to the relevant places later on.

P.S.
Kscreen's default behavior is to enable VRR only for fullscreen windows, which is why toggling fullscreen triggered the problem. Compositors that support a similar VRR policy can be used to reproduce this issue.

Consequently, setting Display > Adaptive Sync to either Never or Always resolves the issue (evtl. after a reboot, for changing the setting to Always may trigger the issue. One use keyboard interaction (Alt-K) to make persistent the new configuration.)