Sometimes after waking up from sleep, laptop's KWin/X11 session may randomly break when switching apps via Alt+Tab.
The whole screen turns into randomly splattered triangles with rescaled and mispositioned content of windows parts.
The glitch can be "fixed" by switching to another TTY and back, for example pressing Ctrl+Alt+F2, Ctrl+Alt+F1. The fix is temporary, and it would glitch out again soon. Permanent fix is to reboot and don't go into sleep mode.
STEPS TO REPRODUCE
1. Boot up Plasma/X11, put system to sleep, and wake it up.
2. Switch apps via Alt+Tab (not consistent, likely won't work on a first try)
Shuttered screed full of triangle artifacts.
uhm… not this, I can tell 'ya that much.
Operating System: Arch Linux
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
I recorded the glitch on a phone's camera:
This is still highly relevant.
Moving to tabbox component, because it seems to be the one which triggers the bug. Flickering always starts on Alt+Tab with my Big Icons switcher.
Created attachment 150508 [details]
I've collected journalctl around the time issue occurs. At 12:14:02 I've pressed Alt+TAB, at 12:14:05 Ctrl+Alt+F2, at 12:14:06 Ctrl+Alt+F1. KWin was started with command:
QT_LOGGING_RULES="kwin_*.debug=true" kwin_x11 --replace &
Operating System: Manjaro Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5
Kernel Version: 5.10.126-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i5-8300H CPU @ 2.30GHz
Memory: 15.5 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1650/PCIe/SSE2
Part 3: https://www.youtube.com/watch?v=Xa5Dw2xzE04
Same bug, another video, just in case.
(In reply to ratijas from comment #4)
> Part 3: https://www.youtube.com/watch?v=Xa5Dw2xzE04
> Same bug, another video, just in case.
I was dealing with the same annoying issue and this seemed to fix it: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend . Not only that, it fixed other instabilities I was experiencing as well, like the X11 server completely crashing in rare cases, when the sound volume popup was shown.
The driver discards the contents of the VRAM when suspending by default and tries to recostruct the previous state on wake up somehow(?). This fix instructs the driver to save the original contents and restore them on wake up.
Here's a one liner fix:
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp" | sudo tee /etc/modprobe.d/nvidia-vram-fix.conf
While this fixes the issue, I'm still not entirely sure, if this is 100% Nvidia's fault, as Gnome can handle the driver's default behavior.