[Help] Prevent dGPU Usage for Specific Apps on Fedora 43

There are a couple apps I use that by default activate the dGPU (RX 7700s) and I do not want them to do so as it drastically reduces my battery life (15hrs → 6hrs). These are:

  • Discord
  • Godot Editor

I have tried using the DRI_PRIME environment variable to control which gpu they use, but alas it does not work for this. Does anyone know how I could force apps to not use the dGPU?

This is a use case where I would like to have a BIOS “disable dGPU” option or similar, as for this workflow I don’t want any apps using the dGPU. Even better yet, if I can default to entirely disabling the dGPU when I’m on battery automatically (if nothing’s using it already).

These are the env. variables I was testing. With DRI_PRIME I tried 0, 1, 2, and 3.

DRI_PRIME=2! DXVK_FILTER_DEVICE_NAME=“AMD Radeon 780M Graphics (RADV PHOENIX)”

1 Like

How are you confirming its in use? I wanted to test as well.

In steam, you can edit the desop entry w/:

X-KDE-RunOnDiscreteGpu=false

Testing w/Vesktop - this seemed to work for it as well (discord clone)

But I would like to verify matching my testing to yours.

I use cat /sys/class/drm/card1/device/power_stateto see if the dGPU has been powered on. I wish for it to stay in d3Cold rather than D0 (on)

Why are you using “2!” when your dGPU is clearly card1 by your statement here:

Besides, 2 would mean you have at least 3 gpu on your system as the first one is 0. Do you also use an external gpu? As far as I can tell, you should be using “DRI_PRIME=1” for the dGPU, but in your case you don’t want to use it so the setting is pointless as your iGPU should already be PRIME.

All that said, Discord will wake up the dGPU for a couple seconds when it polls them all on startup and shutdown, all electron apps seem to do this. But once it is running, it will stay asleep for me so this is not really a problem at all. If this is not the case for you and DRI_PRIME is not working, I would suspect something else is holding it awake. You could also try disabling hardware acceleration in Discord at Settings→Advanced→Hardware accel.

I tested many integers to make sure I captured the correct one, 2 is just what was most recent in my history. I wasn’t confident that env. variable was using the same indexing as vulkaninfo, especially given it’s treatment of 0’s. It would seem you’re right about that activate and then deactivate behavior though! I waited longer than I have been before and sure enough it re-entered D3Cold. That’s good enough for me regarding discord, thanks! Now I just gotta sort out Godot, which I’m less concerned about than discord.

It seems that its intended for Godot to select the dGPU

Looking below, it started out selecting the 780m and then, forced itself to use the 7700s once I opened a project.

I did the following:

$ DRI_PRIME=0 ./Godot_v4.5.1-stable_linux.x86_64 
Godot Engine v4.5.1.stable.official.f62fdbde1 - https://godotengine.org
Invalid value (0) for DRI_PRIME. Should be > 0
OpenGL API 4.6 (Core Profile) Mesa 25.2.7 - Compatibility - Using Device: AMD - AMD Radeon 780M Graphics (radeonsi, phoenix, LLVM 21.1.5, DRM 3.64, 6.17.9-300.fc43.x86_64)

Editing project: /home/rknipp/new-game-project
Godot Engine v4.5.1.stable.official.f62fdbde1 - https://godotengine.org

$ Vulkan 1.4.318 - Forward+ - Using Device #1: AMD - AMD Radeon RX 7700S (RADV NAVI33)

I tried w/ DRI_PRIME=0 as well with the RPM (Fedora) - it worked, until you enter a project - then you get the same Vulkan message above.

It seems you can force the app to use the iGPU, but when the engine starts, it will default to the dGPU - this seems more like a limitation/RFE request for godot based on what I can find.

Ok, I figured it out!!!

Start godot with the following:

godot --gpu-index 0

This forced the Forward+ renderer to use the iGPU:

Output from nvtop

    PID   USER DEV     TYPE  GPU        GPU MEM    CPU  HOST MEM Command                                                                                                                                                                                                                   
                                                                                                                                                                                                         
1876900 rknipp   0 Both G+C   0%    280MiB  14%     3%    986MiB /usr/bin/godot --gpu-index 0 --path /home/rknipp/new-game-project --editor
1876900 rknipp   1  Graphic N/A       0MiB   0%     0%    986MiB /usr/bin/godot --gpu-index 0 --path /home/rknipp/new-game-project --editor

Note that the GPU usage is on device 0, and in the editor, moving the screen/doing tasks, etc does things against the iGPU not the dGPU.

Yup, you’ve exactly described what was happening! I tried that command earlier, but this time I waited longer as I just learned to do, and it seems you’re right on this as well!

I can now use discord and godot without keeping my dGPU online! Thanks for the help guys, this is quite exciting :smiley:

3 Likes

DRI_PRIME is just changing the priority order of your GPUs. So, setting “0” would not change anything at all. And I think it may only work for vulcan? Not sure about that. But despite what you set that value to, the app can always choose the one it wants to use on its own.

1 Like