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?


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

| improve this answer | |
  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 
    1:DIS: :Off:0000:01:00.0
| improve this answer | |

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 radeon.runpm=0"

cat /sys/kernel/debug/vgaswitcheroo/switch 
0:DIS: :Pwr:0000:01:00.0

Add DRI_PRIME=1 string in files env to work with ATI graphics card in apps.

gedit /etc/bash.bashrc 
gedit /etc/environment 
gedit /etc/profile

At the end it's used with all apps by default.

# glxheads 
glxheads: exercise multiple GLX connections (any key = exit)
  glxheads xdisplayname ...
  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)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.