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.
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.
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
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.