Debian Hybrid AMD Graphics Samsung Laptop

Debian 9 introduces support for hybrid graphics, where an intel gpu is used for day to day desktop operation, and then more intensive operations like video and 3d are offloaded to the more powerful and battery draining AMD gpu.

This is how I set it up on my Ativ Book 8 Samsung laptop to utilise hybrid graphics. I imagine it will work on any similar system with an Intel/AMD hybrid gpu setup.

Firstly make sure debian has detected both gpus

techbear@techbear-desktop:~$ xrandr --listproviders

This will output something like below. Under some circumstances the last part of each provider line will provide a nice descriptive name like ‘Intel’ etc. Mine didn’t and came out like below.

Providers: number : 2
Provider 0: id: 0x7c cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
Provider 1: id: 0x55 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 1 name:VERDE @ pci:0000:01:00.0

The next thing is to tell Debian which gpu is to be used for more intensive tasks.  From some google research I identified that the VERDE gpu is the AMD gpu so I set it as follows:

xrandr --setprovideroffloadsink "VERDE @ pci:0000:01:00.0" modesetting

Lastly you can check that the system is going to offload intensive tasks to the AMD card by running the following

techbear@techbear-desktop:~$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

Which should output

OpenGL renderer string: Gallium 0.4 on AMD CAPE VERDE (DRM 2.48.0 / 4.9.0-3-amd64, LLVM 3.9.1)