Issues with Nvidia Prime Sync on Wayland

Yep, I’ve since learned that wayland’s model for this (unsurprisingly) is completely different. The protocol simply makes all GPUs available, it’s up to the compositor to decide where it renders what.

This means that GNOME needs to support a “reverse sync”-like feature if that’s what you want. Apparently, to do this properly, for GNOME you can set the primary GPU with a tag from an appropriate udev rule:

TAG+="mutter-device-preferred-primary"

To get non-reverse offload, if you write a rule which matches your iGPU and adds that property GNOME will render using your iGPU. The offload env variables still work as normal according to my experimentation, so the nvidia-offload script will still do its job.

To always render with the nvidia GPU, simply apply that property to the nvidia GPU with your udev rule, I believe something like this should do it:

ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TAG+="mutter-device-preferred-primary"
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TAG+="mutter-device-preferred-primary"

NixOS however seems to start udev too late in the boot process, so I think this won’t actually work - would love to hear if it does work for anyone.

It also does not enable the power saving features of nvidia GPUs, resulting in them never fully going to sleep. See here: Nvidia never suspends - #2 by TLATER

wlroots instead uses an environment variable.

1 Like