6

I'm using the default open source driver and when I run

  # cat /sys/kernel/debug/vgaswitcheroo/switch

I always have my discrete AMD adapter as DynOff. I tried

  echo ON > /sys/kernel/debug/vgaswitcheroo/switch

But nothing happens. What should I do?

Rmano
  • 31,627
  • 16
  • 118
  • 187
Ticiano Arraes
  • 71
  • 1
  • 1
  • 3
  • Maybe this answer of mine: http://askubuntu.com/a/469439/16395 can help. Or maybe not. – Rmano Jul 14 '15 at 19:57
  • 1
    Well, that works. So I will need to put DRI_PRIME=1 when I want to load an app using the discrete graphics right? thank you very much – Ticiano Arraes Jul 16 '15 at 16:50
  • possible duplicate of [Very Low Temperature Reading for graphics driver using lm-sensors](http://askubuntu.com/questions/469359/very-low-temperature-reading-for-graphics-driver-using-lm-sensors) – Rmano Jul 16 '15 at 21:24

3 Answers3

7

On my Ubuntu 18.04, I solved it this way. There is no need to edit /etc/default/grub file.

  1. 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
    
  2. 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     
    
  3. 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)
    
  4. Additionally, while running DRI_PRIME=1 glxheads, in the different window check that now the discrete GPU is DynPwr instead of DynOff

    $ sudo cat /sys/kernel/debug/vgaswitcheroo/switch                         
      0:DIS: :DynPwr:0000:01:00.0                                             
      1:IGD:+:Pwr:0000:00:02.0
    
  5. 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

abu_bua
  • 10,473
  • 10
  • 45
  • 62
Scarabyte
  • 191
  • 1
  • 3
2
  1. Set kernel parameter:

    sudo nano /etc/default/grub
    
  2. Find GRUB_CMDLINE_LINUX_DEFAULT, append radeon.runpm=0 like this

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.runpm=0"
    
  3. Update config

    sudo update-grub
    
  4. To /etc/rc.local add

    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    
  5. Restart machine

    sudo shutdown -r now
    
  6. PROFIT!

    sudo cat /sys/kernel/debug/vgaswitcheroo/switch 
    
    0:IGD:+:Pwr:0000:00:02.0
    
    1:DIS: :Off:0000:01:00.0
    
waltinator
  • 35,099
  • 19
  • 57
  • 93
shcherbak
  • 336
  • 2
  • 11
1

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)
karel
  • 110,292
  • 102
  • 269
  • 299
user782499
  • 11
  • 1