Skip to content

u/viboc

In this archive from Jul 2022 to Jun 2023

0
posts
5
comments
0
media
11
score

Top comments

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:

systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
printf "options nvidia NVreg_PreserveVideoMemoryAllocations=1\n" > /etc/modprobe.d/nvidia-preserve-vm-alloc.conf

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.

3 points

PrefersNonDefaultGPU=true

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.

2 points

To configure discrete GPU usage "across the board" like you described, you'd have to:

  1. use desktop entries because that's what graphical desktop environments use: PrefersNonDefaultGPU=true makes an application run on the discrete GPU
  2. have a wrapper script that matches a command to an Exec= line, which is not that simple, especially if try and cover edge cases
  3. 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:

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = blender

[Action]
Description = Updating Blender .desktop entry to prefer discrete Nvidia GPU...
When = PostTransaction
Exec = /usr/bin/sed --in-place -E 's/^(Exec=)/\1prime-run /' /usr/share/applications/blender.desktop
Depends = sed
Depends = nvidia-prime

For the terminal, stick with prime-run $cmd, switcherooctl launch $cmd or similar.

2 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.