Discrete graphics always DynOff
On my Ubuntu 18.04, I solved it this way. There is no need to edit /etc/default/grub
file.
-
Check that the integrated GPU is used by default by running
glxheads
$ glxheads ... GL_VERSION: 3.0 Mesa 18.0.5 GL_VENDOR: Intel Open Source Technology Center GL_RENDERER: Mesa DRI Intel(R) Sandybridge Mobile
-
Check that the discrete GPU is visible but
DynOff
$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch 0:DIS: :DynOff:0000:01:00.0 1:IGD:+:Pwr:0000:00:02.0
-
Enable the discrete GPU for the
glxheads
and run it again. You can see that the renderer has changed.$ DRI_PRIME=1 glxheads GL_VERSION: 3.0 Mesa 18.0.5 GL_VENDOR: X.Org GL_RENDERER: AMD TURKS (DRM 2.50.0 / 4.15.0-32-generic, LLVM 6.0.0)
-
Additionally, while running
DRI_PRIME=1 glxheads
, in the different window check that now the discrete GPU isDynPwr
instead ofDynOff
$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch 0:DIS: :DynPwr:0000:01:00.0 1:IGD:+:Pwr:0000:00:02.0
So you need to run each application with
DRI_PRIME=1
in order to use discrete GPU. Also, you can set this environmental variable permanently https://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables
-
Set kernel parameter:
sudo nano /etc/default/grub
-
Find
GRUB_CMDLINE_LINUX_DEFAULT
, appendradeon.runpm=0
like thisGRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.runpm=0"
-
Update config
sudo update-grub
-
To
/etc/rc.local
addecho OFF > /sys/kernel/debug/vgaswitcheroo/switch
-
Restart machine
sudo shutdown -r now
-
PROFIT!
sudo cat /sys/kernel/debug/vgaswitcheroo/switch 0:IGD:+:Pwr:0000:00:02.0 1:DIS: :Off:0000:01:00.0
My set to ATI discrete hybrid works.
# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]
gedit /etc/default/grub
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.runpm=0"
GRUB_CMDLINE_LINUX_DEFAULT="radeon.runpm=0"
GRUB_CMDLINE_LINUX=""
cat /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :Pwr:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0
Add DRI_PRIME=1
string in files env to work with ATI graphics card in apps.
gedit /etc/bash.bashrc
DRI_PRIME=1
gedit /etc/environment
DRI_PRIME=1
gedit /etc/profile
DRI_PRIME=1
At the end it's used with all apps by default.
# glxheads
glxheads: exercise multiple GLX connections (any key = exit)
Usage:
glxheads xdisplayname ...
Example:
glxheads :0 mars:0 venus:1
Name: :0.0
Display: 0x55a68ea5b670
Window: 0x4200002
Context: 0x55a68ea6cd80
GL_VERSION: 3.0 Mesa 17.2.2
GL_VENDOR: X.Org
GL_RENDERER: AMD TURKS (DRM 2.50.0 / 4.13.0-25-generic, LLVM 5.0.0)