Taming the NVIDIA Wayland beast for Plasma 6?

With the recent release of Plasma 6 I, like many others here, have decided to give the Plasma Wayland session another try on my NVIDIA GPU laptop (straight NVIDIA, no Optimus!!). I have run into a lot of problems on Wayland, like the Plasma Shell randomly crashing to a black screen, tons of artifacts causing my displays to be unreadable sometimes when waking from suspend, or the Plasma Panel becoming unresponsive when waking from suspend, which is usually followed by a Plasma Shell crash.

I have nvidia-drm.modeset=1 as a parameter on the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub. That got the Plasma Wayland session to actually log in to something usable, instead of a blank screen. However, I found that I needed to do a lot more than that to fix the wake from suspend problems and improve overall performance in Wayland.

I had to create an /etc/modprobe.d/nvidia.conf file and add:

options nvidia NVreg_UsePageAttributeTable=1
options nvidia NVreg_RegistryDwords=“OverrideMaxPerf=0x1”
options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp

I also had to use NVIDIA’s suspend/resume/hibernate system by running:

sudo systemctl enable nvidia-{suspend,resume,hibernate}

I didn’t know about any of this (besides nvidia-drm.modeset=1) until today. I found this information by chance on one of my many, many Google searches to improve NVIDIA performance on Wayland. Are there any other things that I may be missing that will help me get better Wayland performance in Plasma 6 on an NVIDIA GPU?

Here are the sources I used to get to the point I’m at so far:

https://download.nvidia.com/XFree86/Linux-x86_64/545.29.06/README/powermanagement.html

https://www.reddit.com/r/Fedora/comments/pf897e/solution_nvidia_and_suspendhibernate_not_working/

4 Likes

Thanks for sharing this. I will have to give several of these steps a try to see if it improves things for me.

1 Like

Working here on an RTX3070 in a Legion 5.
Added to /etc/kernel/cmdline

nvidia-drm.modeset=1

Then reinstall-kernels

And:

nVidia resume from suspend

micro /etc/modprobe.d/nvidia-power-management.conf

Then add the following line

options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp

And enable nVidia suspend service (missed this bit out!!).
From https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks

And that is it.

3 Likes

This is what I did, except I named my file /etc/modprobe.d/nvidia.conf instead of /etc/modprobe.d/nvidia-power-management.conf, and I added two additional options.

2 Likes

Thank you for sharing this, Wayland is giving me a headache

Thanks, was trying to do just this, ill give it a test and hopefully it works…
EDIT: It did! Now to figure out issues with discord
EDIT 2: Electron apps are being a pain, But these launch options fixed discord and you can use some of them to fix other electron applications

--ignore-gpu-blocklist 
--disable-features=UseOzonePlatform 
--enable-features=VaapiVideoDecoder,WebRTCPipeWireCapturer 
--use-gl=desktop 
--enable-gpu-rasterization 
--enable-zero-copy
1 Like

Oh, you feel the same way I do about them! :laughing::laughing:

I couldn’t resist.

Electron apps sure seems a bit difficult, tried to set ELECTRON_OZONE_PLATFORM_HINT=auto in ~/.config/environment.d/envvars.conf (https://github.com/electron/electron/blob/main/docs/api/environment-variables.md#electron_ozone_platform_hint-linux) but still seems a bit glitchy.
Anyone had any success in getting Electron apps to function without glitches?

Also had issues with Chromeium / Chrome based browsers such as Brave Browser but as suggested here https://ubuntuhandbook.org/index.php/2022/09/enable-wayland-firefox-chrome/ I used chrome://flags/ and set Preferred Ozone platform and now it seems much better :slight_smile:

If anyone has any experience with the new “nvidia-open” stack, how does that fare compared to proprietary? I want to switch over to it, but I also just want things to work, lol.

I also had to add: nvidia-drm.fbdev=1 as discussed here, for it to actually work fully for me.