Switch between Intel/AMD GPU on 18.04

I just installed Oibaf's graphics driver, on my laptop, and also Lutris (with Wine and all that) beacuse I want to play games like Diablo 3.

Everything worked fine, I also installed vulkan, and Wine + Gallium Nine The output of lshw -c video is :

  *-display                 
   description: VGA compatible controller
   product: HD Graphics 5500
   vendor: Intel Corporation
   physical id: 2
   bus info: pci@0000:00:02.0
   version: 09
   width: 64 bits
   clock: 33MHz
   capabilities: msi pm vga_controller bus_master cap_list rom
   configuration: driver=i915 latency=0
   resources: irq:45 memory:d3000000-d3ffffff memory:c0000000-cfffffff ioport:7000(size=64) memory:c0000-dffff
 *-display
   description: Display controller
   product: Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430]
   vendor: Advanced Micro Devices, Inc. [AMD/ATI]
   physical id: 0
   bus info: pci@0000:0d:00.0
   version: 83
   width: 64 bits
   clock: 33MHz
   capabilities: pm pciexpress msi bus_master cap_list rom
   configuration: driver=radeon latency=0
   resources: irq:46 memory:b0000000-bfffffff memory:d5000000-d503ffff ioport:4000(size=256) memory:d5040000-d505ffff

My video card is AMD R5 M430, and the laptop is HP 250 G5

Also here is the output of lspci -k | grep -EA3 'VGA|Display|3D'

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
        Subsystem: Hewlett-Packard Company HD Graphics 5500
        Kernel driver in use: i915
        Kernel modules: i915
--
0d:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / R7 M520] (rev 83)
        Subsystem: Hewlett-Packard Company Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / R7 M520]
        Kernel driver in use: radeon
        Kernel modules: radeon, amdgpu

I have been plowing the internet for days over this issue. Had similar setup and problems. I chanced upon here about using DRI_PRIME=1 before any commands to use your dedicated GPU. So I tried

export $DRI_PRIME=1

and this worked. So I added a line it in /etc/environment, DRI_PRIME=1 , rebooted and now System Details shows my AMD card as default.

Caveat: I think this disables the Integrated Graphics and changes your system to just make use your dedicated GPU only


You can find many answers to your question here in Ask Ubuntu:

  • June 2018 - Intel/AMD Hybrid graphics Ubuntu 18.04
  • August 2018 - Switch between Intel/AMD GPU on 18.04
  • June 2016 - AMD-INTEL hybrid graphics on Ubuntu 16.04

You should review all of these links.

Additionally you will find many helpful links from other sources:

  • Ubuntu Community AMDGPU-Driver
  • Ubuntu Wiki Hybrid Graphics This introduces you to switcheroo which may be the most common method of switching graphics
  • Arch Linux PRIME documentation

All the links are too long to summarize in this answer.


Rather than using lspci -nn | grep VGA which will only show your Intel GPU and not your AMD GPU you should try an expanded search using something like this:

$ lspci -k | grep -EA3 'VGA|Display|3D'
00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06)
    DeviceName:  Onboard IGD
    Subsystem: Dell Skylake Integrated Graphics
    Kernel driver in use: i915
--
01:00.0 3D controller: NVIDIA Corporation GM204M [GeForce GTX 970M] (rev a1)
    Subsystem: Dell GM204M [GeForce GTX 970M]
    Kernel driver in use: nvidia
    Kernel modules: nvidiafb, nouveau, nvidia_384_drm, nvidia_384