6

I had followed the instructions posted by emk2203 (My AMD Radeon graphic card is not working on 16.04) and now I could make the apps use my secondary AMD card and it's work! Look:

Firefox running (http://demo.marpi.pl/exp/mecha/) experiment at 15fps

Now, runnig Firefox by Terminal with DRI_PRIME=1:

DRI_PRIME=1 firefox

The same experiment running at 61fps

Thanks emk2203!

Now I need to know how configure the system to always runs the app with the DRI_PRIME=1 set.

Sorry for bad english. I'm brasilian.

  • 1
    Your question is, I believe, "How do I run FireFox with the DRI_PRIME=1 variable enabled," correct? – gravity Jun 24 '16 at 15:27
  • Unfortunately Not... What I need is always open Firefox or another software with the DRI_PRIME=1 command already set. So I just will need double click its icon in the desktop. – Rodrigo Alexandre Jun 24 '16 at 15:33

3 Answers3

5

Here is a little light reading on environment variables for those sleepless nights, but to cut to the chase, I quote:

"A suitable file for environment variable settings that affect the system as a whole (rather than just a particular user) is /etc/environment.

This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line."

So... Inserting your assignment DRI_PRIME=1 into /etc/environment and then restarting should do what you're asking.

bashBedlam
  • 1,022
  • 3
    Not exactly what OP was asking. It will run everything on AMD GPU. Please add info about this caveat. – int_ua May 03 '20 at 20:09
2

There is now a PrefersNonDefaultGPU .desktop file key. It was merged into the spec on 2020-04-27 and GNOME has just received the first implementation 3 hours ago and you may be able to use it after gnome-shell version 3.37.1.

int_ua
  • 8,574
  • 1
    In practice it doesn't work at all and this topic summarizes why https://github.com/ValveSoftware/steam-for-linux/issues/9940 – Max_Payne Aug 06 '23 at 12:43
1

You can set an environment variable system-wide by setting it in /etc/default/locale. This will set it for all users, so you want to be sure that's what you really want. Keep in mind that local settings (such as in .bashrc) will override the system-wide setting.