Dual GPU setup: nvidia-smi shows gnome-shell and doesn't sleep

I’m not sure about how gnome implements the wayland protocol, but I know I had the same issue under Hyprland, even with hardware.nvidia.powerManagement.finegrained = true, that is, nivida-smi was still showing a running process (Hyprland itself in my case) and thereby preventing the device from fully powering off.

The solution in my case (which will not work for gnome) was to explicitly set WLR_DRM_DEVICES which is a variable used by wlroot’s based compositors containing a list of drm devices to consider on startup. If the nvidia card is in the list, even if it is not the first entry and the thus the one initialized and used to present, it still seems to associate the process with the GPU (probably opens a display context in the kernel or something).

If you don’t set the variable at all wlroots based compositors just assume to consider all available cards, so the solution was set it explicitly and only specify the intel card. Nvidia offload still works and the card will still spin up if asked to do so, but otherwise there are no processes associate with it, and the finegrained pm will automatically put it to sleep when it can.

I’m sure your issue is that Gnome is doing something similar under the hood, but I’m not sure if they provide an interface to override it somehow, like wlroots does.