Switch between Nvidia and intel GPU automatically on-deman per app

Hi, i'm on a fresh gnome manjaro on my lenovo legion Y540,i have 2 gpu Nvidia and intel.
TU106M [GeForce RTX 2060 Mobile]
UHD Graphics 630 (Mobile)

Driver: video-hybrid-intel-nvidia-440XX-prime

Currently i use a command to say to my system to use Nvidia GPU on specific app like my games:
__nv_prime_render_offload=1 __glx_vendor_library_name=nvidia "app"

That work, i like this possibility to heard my nvidia card only when i need it.

So i read couple of topics and the only solution i found it's to install

As far that i understand it's a manual switch to use the card we want to enable ?

My wish is to use my nvidia card automatically per app needed without clic on a switch or whatever.

And more particularly on youtube video i have couple of freeze with my intel card i don't know how to use my nvidia without launch my firefox with my previous command.

Or there is a way to tell to the system to tell to my app that read the video to use my previous command ?

Hi,
You make use of
prime-run application
Example:
prime-run glxgears
prime-run firefox
and so on. Those specific applications you want to start with the use of the dGPU, you can append the prime-run to their desktop file. Copy them in ~/.local/share/applications/ and edit it to the Exec= line.

When using optimus-manager then whatever GPU you set as default, that will be used. Don't know what happens if you set the dGPU as default and with the programs that are launched trough prime-run command ... should work when on Hybrid.

I don't think there is such thing in linux.

Hybrid GPUs were created for Windows and as such work automatically only on Windows, so no, there is no such thing on Linux.

You can only save the command to the app launcher so you wouldn't have to use it manually. However, such command won't work in Intel mode. I haven't tested it in Nvidia mode but it should work. So for practical purposes, for Steam, I created vanilla, hybrid and nouveau launcher.
I'm aware that this is not ideal, but it's best we can do. There are only few apps that benefit from discrete GPU anyway, so it's not like you would have to create alternate launchers for every app.

If you decide to stay on hybrid mode permanently, you can overwrite the launch commands so it would be as close to automatic dGPU usage as possible.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by