If you look at /usr/lib/udev/rules.d/61-gdm.rules you'll find a comment that says
# Check if suspend/resume services necessary for working wayland support is available
and a set of requirements which disable Wayland if not satisfied.
Long story short, you need to enable suspend and resume support for Nvidia and the NVreg_PreserveVideoMemoryAllocations attribute. As root, you can just run the following:
That's what I had to do anyway with my Nvidia GPU, your situation might be different. If this doesn't work, check Tips and tricks and Troubleshooting on the ArchWiki, I'm sure you'll find a solution.
I didn't explain correctly. PrefersNonDefaultGPU= is a key that goes in the desktop entry of an application. It is part of the freedesktop.org specification and all distributions and desktop environments make efforts to support it. As an example, open /usr/share/applications/steam.desktop, you'll see that on line 37 it says PrefersNonDefaultGPU=true. This means that if the desktop environment supports it, and KDE Plasma does (99% sure, I don't use it), Steam should run on the NonDefault GPU, which is normally the discrete GPU, when launched from your docks, icons, launchers, etc.
As for why some Steam subprocesses use the discrete GPU on their own, I don't know. It's possible they have some built-in capability to detect and optimally select the more powerful GPU.
If you run /usr/bin/foo you bypass path lookup and /usr/bin/foo is executed. If you run foo, path lookup is performed and if ~/.prime-run/foo is found first, it will be executed instead of /usr/bin/foo.
To configure discrete GPU usage "across the board" like you described, you'd have to:
use desktop entries because that's what graphical desktop environments use: PrefersNonDefaultGPU=true makes an application run on the discrete GPU
have a wrapper script that matches a command to an Exec= line, which is not that simple, especially if try and cover edge cases
make every command you write in your terminal pass through the wrapper script with the matching logic
I can help you with 1 and 2, but I've no idea how you'd do 3. Personally, I don't think it's worth the effort.
If all you want is a convenient way to run applications on the discrete GPU, then all you have to do is make sure your desktop environment respects PrefersNonDefaultGPU=true. Gnome Shell does so when you install and enable the service from package switcheroo-control, I am sure KDE Plasma has something similar.
Steam desktop entries have PrefersNonDefaultGPU=true by default and so does Blender and other graphically intensive applications. If Steam is running on the discrete GPU so do all games you launch from it because subprocesses inherit the environment of the Steam process.
If for some reason you can't get KDE Plasma to respect PrefersNonDefaultGPU=true, you could, like others suggested, make a pacman hook for select applications to have them go through prime-run. I used to do this myself, it'd look something like this:
If you look at
/usr/lib/udev/rules.d/61-gdm.rulesyou'll find a comment that saysand a set of requirements which disable Wayland if not satisfied.
Long story short, you need to enable suspend and resume support for Nvidia and the
NVreg_PreserveVideoMemoryAllocationsattribute. As root, you can just run the following:That's what I had to do anyway with my Nvidia GPU, your situation might be different. If this doesn't work, check Tips and tricks and Troubleshooting on the ArchWiki, I'm sure you'll find a solution.
I didn't explain correctly.
PrefersNonDefaultGPU=is a key that goes in the desktop entry of an application. It is part of the freedesktop.org specification and all distributions and desktop environments make efforts to support it. As an example, open/usr/share/applications/steam.desktop, you'll see that on line 37 it saysPrefersNonDefaultGPU=true. This means that if the desktop environment supports it, and KDE Plasma does (99% sure, I don't use it), Steam should run on the NonDefault GPU, which is normally the discrete GPU, when launched from your docks, icons, launchers, etc.As for why some Steam subprocesses use the discrete GPU on their own, I don't know. It's possible they have some built-in capability to detect and optimally select the more powerful GPU.
If you run
/usr/bin/fooyou bypass path lookup and/usr/bin/foois executed. If you runfoo, path lookup is performed and if~/.prime-run/foois found first, it will be executed instead of/usr/bin/foo.To configure discrete GPU usage "across the board" like you described, you'd have to:
PrefersNonDefaultGPU=truemakes an application run on the discrete GPUExec=line, which is not that simple, especially if try and cover edge casesI can help you with 1 and 2, but I've no idea how you'd do 3. Personally, I don't think it's worth the effort.
If all you want is a convenient way to run applications on the discrete GPU, then all you have to do is make sure your desktop environment respects
PrefersNonDefaultGPU=true. Gnome Shell does so when you install and enable the service from packageswitcheroo-control, I am sure KDE Plasma has something similar.Steam desktop entries have
PrefersNonDefaultGPU=trueby default and so does Blender and other graphically intensive applications. If Steam is running on the discrete GPU so do all games you launch from it because subprocesses inherit the environment of the Steam process.If for some reason you can't get KDE Plasma to respect
PrefersNonDefaultGPU=true, you could, like others suggested, make a pacman hook for select applications to have them go throughprime-run. I used to do this myself, it'd look something like this:For the terminal, stick with
prime-run $cmd,switcherooctl launch $cmdor similar.Try adding
x-gvfs-hideto the options.End of this list.
Back to top