Bug 448866 - [NVIDIA] Graphical glitches and unresponsive after waking from sleep
Summary: [NVIDIA] Graphical glitches and unresponsive after waking from sleep
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.23.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Edmundson
URL:
Keywords: wayland
: 473819 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-01-21 04:42 UTC by Matty R
Modified: 2024-03-30 14:56 UTC (History)
18 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
plasma wayland after sleep (3.36 MB, video/mp4)
2022-01-21 04:45 UTC, Matty R
Details
nvidia glitch after waking from sleep 28 APR 2023 (2.59 MB, video/mp4)
2023-04-28 09:25 UTC, Matty R
Details
Journalctl log when the screen energy saver activates (19.06 KB, text/plain)
2023-11-27 17:32 UTC, Dennis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matty R 2022-01-21 04:42:44 UTC
SUMMARY
After waking from sleep, Plasmashell is unusable with graphical glitches. It does appear to respond to keypresses, but I can't see what's going on.

STEPS TO REPRODUCE
1. Log in to a Wayland session
2. Set machine to sleep after some idle time
3. Wake machine from sleep and login

OBSERVED RESULT
**See attachment**
Sometimes after waking from sleep, the lock screen is not visible - however it also appears to respond to key presses allowing you to login.

EXPECTED RESULT
Log in and session is resumed as per X11.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.1-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2


ADDITIONAL INFORMATION
Comment 1 Matty R 2022-01-21 04:45:36 UTC
Created attachment 145691 [details]
plasma wayland after sleep
Comment 2 Nate Graham 2022-01-23 19:03:40 UTC
Moving to KWin as this can't be a Plasma problem. It could be an NVIDIA GU driver problem though.

Are you able to test with the Plasma 5.24 beta? A lot of graphical fixes made it into that release.
Comment 3 Vlad Zahorodnii 2022-01-25 09:53:55 UTC
Looks like a regression after the nvidia qtwayland patch.
Comment 4 Nate Graham 2023-04-27 21:48:07 UTC
Which one? Is it a KWin issue or a Qt issue or an NVIDIA issue? But I don't see how it can be a Plasma issue; moving to KWin.
Comment 5 Nate Graham 2023-04-27 21:48:45 UTC
But more importantly: Matty, are you still able to reproduce this issue with Plasma 5.27, the latest NVIDIA drivers, and Qt 5.15.9?
Comment 6 Matty R 2023-04-28 09:22:57 UTC
(In reply to Nate Graham from comment #5)
> But more importantly: Matty, are you still able to reproduce this issue with
> Plasma 5.27, the latest NVIDIA drivers, and Qt 5.15.9?

This is indeed still occurring.

Nvidia version: 530.41.03

Operating System: Arch Linux 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Kernel Version: 6.2.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
Comment 7 Matty R 2023-04-28 09:25:22 UTC
Created attachment 158510 [details]
nvidia glitch after waking from sleep 28 APR 2023
Comment 8 Nate Graham 2023-04-28 17:58:36 UTC
Ouch. Thanks for confirming.
Comment 9 Nate Graham 2023-08-28 21:10:00 UTC
*** Bug 473819 has been marked as a duplicate of this bug. ***
Comment 10 Dennis 2023-08-29 05:48:30 UTC
I have also experienced this issue described my duplicate bug 473819, which was from a fresh install this weekend (27/8). The difference to me is that I doesn't put my computer to sleep, only the monitors when inactive for too long.
Comment 11 Dennis 2023-08-31 08:48:52 UTC
(In reply to Nate Graham from comment #8)
> Ouch. Thanks for confirming.

This ticket was opened in January 2022 and I stumbled on the same/similar problem with a fresh Fedora 38 KDE install a week ago. Is this prioritized at all? It's there any workarounds for this problem that means not having to disable that the monitors go to sleep after user inactivity?
Comment 12 Vishal Subramanyam 2023-09-15 16:46:14 UTC
I'm facing the same issue on the following system:
Operating System: Kubuntu 23.04
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.8
Kernel Version: 6.2.0-32-generic (64-bit)
Graphics Platform: Wayland
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 15.4 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2
Comment 13 Finn 2023-10-14 14:17:04 UTC
Hi I experienced the same Bug but was able to resolve it with the help of "https://forum.endeavouros.com/t/graphic-bugs-after-sleep-kde-wayland-nvidia/46703/2" 

The solution is to preserve video memory after suspend. Detailed instructions for arch based systems can be found here: "https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks" under point 10. 

Another temporary fix is to run "plasmashell --replace" in krunner 

An observation that I made is, that this bug only occurs when I'm logged in and the PC is suspended. When no user is logged in, I had no issues. 

Hope this helps to narrow down the issue.
Comment 14 Dennis 2023-10-15 06:33:30 UTC
(In reply to Finn from comment #13)
> Hi I experienced the same Bug but was able to resolve it with the help of
> "https://forum.endeavouros.com/t/graphic-bugs-after-sleep-kde-wayland-nvidia/
> 46703/2" 
> 
> The solution is to preserve video memory after suspend. Detailed
> instructions for arch based systems can be found here:
> "https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks" under point 10. 
> 
> Another temporary fix is to run "plasmashell --replace" in krunner 
> 
> An observation that I made is, that this bug only occurs when I'm logged in
> and the PC is suspended. When no user is logged in, I had no issues. 
> 
> Hope this helps to narrow down the issue.

When using the term suspend, that means when the computer is put to sleep? I'm wondering if this could help the issue for me, for when the *monitors* wake up. I never put my computer to sleep
Comment 15 Dennis 2023-10-15 09:44:57 UTC
My current solution is from the login screen via SDDM select X11 instead of Wayland. NVIDIA drivers doesn't seem to like Wayland.
Comment 16 fanzhuyifan 2023-11-25 23:27:28 UTC
Does anyone still experience this issue after configuring nvidia to preserve video memory after suspend? (https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks) I also had similar problems, which disappeared after enabling this.

If not, should this be closed as RESOLVED-DOWNSTREAM (since we are expecting distributions to have the correct configurations)?
Comment 17 Dick Tracey 2023-11-27 01:02:46 UTC
(In reply to fanzhuyifan from comment #16)
> Does anyone still experience this issue after configuring nvidia to preserve
> video memory after suspend?
> (https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks) I also had similar
> problems, which disappeared after enabling this.
> 
> If not, should this be closed as RESOLVED-DOWNSTREAM (since we are expecting
> distributions to have the correct configurations)?

Why does this mean there is no issue with kwin? And why do you call an experimental workaround "the correct configuration"?
Comment 18 fanzhuyifan 2023-11-27 01:55:47 UTC
(In reply to Dick Tracey from comment #17)
> (In reply to fanzhuyifan from comment #16)
> > Does anyone still experience this issue after configuring nvidia to preserve
> > video memory after suspend?
> > (https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks) I also had similar
> > problems, which disappeared after enabling this.
> > 
> > If not, should this be closed as RESOLVED-DOWNSTREAM (since we are expecting
> > distributions to have the correct configurations)?
> 
> Why does this mean there is no issue with kwin?

I am not saying that there is no issue with kwin. I honestly don't know. 
That's why I am asking a question -- if this doesn't happen when nvidia
is configured to preserve video memory after suspend, what would be the correct way to proceed?
Does this means that distributions should always enable this option?
Or should kwin handle this somehow? If so, how should kwin handle this?

I don't know what the answer is. Someone more knowledgeable about these matters should comment.

> And why do you call an experimental workaround "the correct configuration"?

True, this feature is documented as experimental in the official nvidia documentation[1].
But it seems to be the only way provided by nvidia to save and restore all video memory allocations.

Again, I am happy to hear your constructive feedback on this.

[1] http://download.nvidia.com/XFree86/Linux-x86_64/545.29.06/README/powermanagement.html
Comment 19 Dennis 2023-11-27 11:08:46 UTC
The bug is not solved by enabling the nvidia suspend thing. I experience this problem when the monitors turn off by the energy saving setting while the computer is still on, not by suspending the entire computer.
Comment 20 fanzhuyifan 2023-11-27 17:10:47 UTC
(In reply to Dennis from comment #19)
> The bug is not solved by enabling the nvidia suspend thing. I experience
> this problem when the monitors turn off by the energy saving setting while
> the computer is still on, not by suspending the entire computer.

Humm do you also see this if you set the "when locked, turn off screen" to 10 sec and then lock your computer and wait 10 seconds for the screen to turn off? I wanted to double check because by default, the energy saving setting also puts the computer to sleep after 15 min of inactivity, which may be triggering in your case. 

It would also be great if you could provide the output of `journalctl -b` when you see this again.

Thanks!
Comment 21 Dennis 2023-11-27 17:30:57 UTC
(In reply to fanzhuyifan from comment #20)
> (In reply to Dennis from comment #19)
> > The bug is not solved by enabling the nvidia suspend thing. I experience
> > this problem when the monitors turn off by the energy saving setting while
> > the computer is still on, not by suspending the entire computer.
> 
> Humm do you also see this if you set the "when locked, turn off screen" to
> 10 sec and then lock your computer and wait 10 seconds for the screen to
> turn off? I wanted to double check because by default, the energy saving
> setting also puts the computer to sleep after 15 min of inactivity, which
> may be triggering in your case. 
> 
> It would also be great if you could provide the output of `journalctl -b`
> when you see this again.
> 
> Thanks!

Yes. 

My test case: logging to KDE with Wayland, go to System Settings > Power Management > Energy Saving and set "Screen Energy Saving" to "1 min". I wait for the screens to turn off into stand-by. Then after a few seconds I move the mouse again to wake them up. This is when the entire desktop is black, windows are glitchy, taskbar is semi-broken.
Comment 22 Dennis 2023-11-27 17:32:12 UTC
Created attachment 163546 [details]
Journalctl log when the screen energy saver activates
Comment 23 petrk 2023-12-09 16:13:13 UTC
Would plasmashell becoming unresponsive after resume from S3 sleep on X11 be related?
I did have such issue and was wondering what the problem is. Then I checked Arch Wiki.

From https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
Quote: "Note: Contrary to NVIDIA's instructions, it is currently not necessary to enable nvidia-resume.service (and it is in fact probably not a good idea to enable it), because the /usr/lib/systemd/system-sleep/nvidia script does the same thing as the service (but slightly earlier), and it is enabled by default (systemd calls it after waking up from a suspend). Only enable nvidia-suspend.service and/or nvidia-hibernate.service, unless you are using GDM with Wayland which requires nvidia-resume.service too."

So I have disabled nvidia-resume.service and havent had to do "plasmashell --replace" ever since.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.112.0
Qt Version: 5.15.11
Kernel Version: 6.6.4-273-tkg-bore (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 62.2 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 82B1
System Version: Lenovo Legion 5 15ARH05H
RTX 2060 Mobile (0x1f15)
Comment 24 fanzhuyifan 2023-12-09 16:46:32 UTC
(In reply to petrk from comment #23)
> Would plasmashell becoming unresponsive after resume from S3 sleep on X11 be
> related?
> I did have such issue and was wondering what the problem is. Then I checked
> Arch Wiki.

There is also a separate bug report about X11: https://bugs.kde.org/show_bug.cgi?id=475605
Comment 25 petrk 2023-12-09 19:38:33 UTC
Nevermind, it just took longer sleep to trigger. Ignore my previous comment.
Comment 26 Cherkah 2024-03-30 14:56:38 UTC
even after update my system to plasma 6.0.3 the issue si still there

Operating System: EndeavourOS 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.2-zen2-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 15.4 Gio of RAM
Graphics Processor: NVIDIA GeForce GTX 1650/PCIe/SSE2