AMDGPU - how to switch between graphic cards

How do I switch between these 2 cards?

hwinfo --gfx
17: PCI 100.0: 0380 Display controller                          
  [Created at pci.386]
  Unique ID: VCu0.xOaEH+tOOxB
  Parent ID: mnDB.pKxIWxtK6N4
  SysFS ID: /devices/pci0000:00/0000:00:01.1/0000:01:00.0
  SysFS BusID: 0000:01:00.0
  Hardware Class: graphics card
  Model: "ATI Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X]"
  Vendor: pci 0x1002 "ATI Technologies Inc"
  Device: pci 0x67ef "Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X]"
  SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
  SubDevice: pci 0x1eae 
  Revision: 0xe5
  Driver: "amdgpu"
  Driver Modules: "amdgpu"
  Memory Range: 0xe0000000-0xefffffff (ro,non-prefetchable)
  Memory Range: 0xf0000000-0xf01fffff (ro,non-prefetchable)
  I/O Ports: 0xf000-0xffff (rw)
  Memory Range: 0xfea00000-0xfea3ffff (rw,non-prefetchable)
  Memory Range: 0xfea40000-0xfea5ffff (ro,non-prefetchable,disabled)
  IRQ: 66 (149 events)
  Module Alias: "pci:v00001002d000067EFsv00001043sd00001EAEbc03sc80i00"
  Driver Info #0:
    Driver Status: amdgpu is active
    Driver Activation Cmd: "modprobe amdgpu"
  Config Status: cfg=no, avail=yes, need=no, active=unknown
  Attached to: #29 (PCI bridge)

30: PCI 500.0: 0300 VGA compatible controller (VGA)
  [Created at pci.386]
  Unique ID: Ddhb.VYM+XMk86m9
  Parent ID: JZZT.A_VqgZKlSp2
  SysFS ID: /devices/pci0000:00/0000:00:08.1/0000:05:00.0
  SysFS BusID: 0000:05:00.0
  Hardware Class: graphics card
  Model: "ATI Picasso"
  Vendor: pci 0x1002 "ATI Technologies Inc"
  Device: pci 0x15d8 "Picasso"
  SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
  SubDevice: pci 0x1eae 
  Revision: 0xc2
  Driver: "amdgpu"
  Driver Modules: "amdgpu"
  Memory Range: 0xc0000000-0xcfffffff (ro,non-prefetchable)
  Memory Range: 0xd0000000-0xd01fffff (ro,non-prefetchable)
  I/O Ports: 0xb000-0xbfff (rw)
  Memory Range: 0xfe500000-0xfe57ffff (rw,non-prefetchable)
  IRQ: 24 (no events)
  Module Alias: "pci:v00001002d000015D8sv00001043sd00001EAEbc03sc00i00"
  Driver Info #0:
    Driver Status: amdgpu is active
    Driver Activation Cmd: "modprobe amdgpu"
  Config Status: cfg=no, avail=yes, need=no, active=unknown
  Attached to: #22 (PCI bridge)

Primary display adapter: #30

@rilicek I use switcherooctl here on MicroOS Aeon (Dual AMD) and Tumbleweed (Dual Nvidia)

inxi -Gxz

Graphics:
  Device-1: AMD Wani [Radeon R5/R6/R7 Graphics] vendor: Hewlett-Packard
    driver: amdgpu v: kernel arch: GCN-3 bus-ID: 00:01.0
  Device-2: AMD Topaz XT [Radeon R7 M260/M265 / M340/M360 M440/M445 530/535
    620/625 Mobile] vendor: Hewlett-Packard driver: amdgpu v: kernel
    arch: GCN-3 bus-ID: 04:00.0 temp: 28.0 C
  Device-3: Chicony HP Wide Vision HD driver: uvcvideo type: USB
    bus-ID: 1-1.3:3
  Display: wayland server: X.org v: 1.21.1.9 with: Xwayland v: 23.2.2
    compositor: gnome-shell v: 45.2 driver: X: loaded: modesetting dri: radeonsi
    gpu: amdgpu resolution: 1366x768~60Hz
  API: OpenGL v: 4.6 vendor: amd mesa v: 23.2.1 glx-v: 1.4
    direct-render: yes renderer: AMD Radeon R5 Graphics (carrizo LLVM 17.0.5
    DRM 3.54 6.6.6-1-default)
  API: Vulkan v: 1.3.268 drivers: radv surfaces: xcb,xlib,wayland devices: 2
  API: EGL Message: EGL data requires eglinfo. Check --recommends.

switcherooctl list

Device: 0
  Name:        Advanced Micro Devices, Inc. [AMD®/ATI] Wani [Radeon R5/R6/R7 Graphics]
  Default:     yes
  Environment: DRI_PRIME=pci-0000_00_01_0

Device: 1
  Name:        Advanced Micro Devices, Inc. [AMD®/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445 / 530/535 / 620/625 Mobile]
  Default:     no
  Environment: DRI_PRIME=pci-0000_04_00_0

swicherooctl glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon R7 M340 (iceland, LLVM 17.0.5, DRM 3.54, 6.6.6-1-default)

glxinfo | grep "OpenGL renderer"

OpenGL renderer string: AMD Radeon R5 Graphics (carrizo, LLVM 17.0.5, DRM 3.54, 6.6.6-1-default)

returns no value :frowning:

# switcherooctl list
# 
# switcherooctl glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon Vega 8 Graphics (raven, LLVM 17.0.5, DRM 3.54, 6.6.6-1-default)
# glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon Vega 8 Graphics (raven, LLVM 17.0.5, DRM 3.54, 6.6.6-1-default)
# xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x54; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 4; outputs: 2; associated providers: 1; name: AMD Radeon Vega 8 Graphics @ pci:0000:05:00.0
    output eDP
    output HDMI-A-0
Provider 1: id: 0x82; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 5; outputs: 0; associated providers: 1; name: AMD Radeon RX 560 Series @ pci:0000:01:00.0

@rilicek then try DRI_PRIME, DRI_PRIME=1 glxinfo | grep “OpenGL renderer”` Did you start the switchrooctl service?

To OP - post

inxi -aCGz

ILL OP uses desktop.

I had to start the service:

systemctl start switcheroo-control.service

How to change the default graphic card?

 switcherooctl list
Device: 0
  Name:        Advanced Micro Devices, Inc. [AMD®/ATI] Picasso/Raven 2 [Radeon Vega Series / Radeon Vega Mobile Series]
  Default:     yes
  Environment: DRI_PRIME=pci-0000_05_00_0

Device: 1
  Name:        Advanced Micro Devices, Inc. [AMD®/ATI] Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X]
  Default:     no
  Environment: DRI_PRIME=pci-0000_01_00_0
# inxi -aCGz
CPU:
  Info: model: AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx socket: FP5
    bits: 64 type: MT MCP arch: Zen/Zen+ note: check gen: 1 level: v3
    note: check built: 2019 process: GF 12nm family: 0x17 (23)
    model-id: 0x18 (24) stepping: 1 microcode: 0x8108102
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 384 KiB desc: d-4x32 KiB; i-4x64 KiB L2: 2 MiB desc: 4x512 KiB L3: 4 MiB
    desc: 1x4 MiB
  Speed (MHz): avg: 1400 min/max: 1400/2100 boost: enabled
    base/boost: 2100/3700 scaling: driver: acpi-cpufreq governor: ondemand
    volts: 1.2 V ext-clock: 100 MHz cores: 1: 1400 2: 1400 3: 1400 4: 1400
    5: 1400 6: 1400 7: 1400 8: 1400 bogomips: 33548
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT vulnerable
  Type: spec_rstack_overflow mitigation: Safe RET
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    disabled, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Baffin [Radeon RX 460/560D / Pro
    450/455/460/555/555X/560/560X] vendor: ASUSTeK driver: amdgpu v: kernel
    arch: GCN-4 code: Arctic Islands process: GF 14nm built: 2016-20 pcie:
    gen: 1 speed: 2.5 GT/s lanes: 8 link-max: gen: 3 speed: 8 GT/s
    bus-ID: 01:00.0 chip-ID: 1002:67ef class-ID: 0380 temp: 38.0 C
  Device-2: AMD Picasso/Raven 2 [Radeon Vega Series / Radeon Mobile Series]
    vendor: ASUSTeK driver: amdgpu v: kernel arch: GCN-5 code: Vega
    process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16
    ports: active: eDP-1 empty: HDMI-A-1 bus-ID: 05:00.0 chip-ID: 1002:15d8
    class-ID: 0300 temp: 36.0 C
  Device-3: IMC Networks USB2.0 HD UVC WebCam driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:2 chip-ID: 13d3:56a2
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.9 with: Xwayland v: 23.2.2
    compositor: kwin_x11 driver: X: loaded: amdgpu
    unloaded: fbdev,modesetting,vesa dri: radeonsi gpu: amdgpu display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 mapped: eDP model: AU Optronics 0x429d built: 2018
    res: 1920x1080 hz: 60 dpi: 128 gamma: 1.2 size: 382x215mm (15.04x8.46")
    diag: 438mm (17.3") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  API: EGL v: 1.5 hw: drv: amd radeonsi platforms: device: 0 drv: radeonsi
    device: 1 drv: radeonsi device: 2 drv: swrast surfaceless: drv: radeonsi
    x11: drv: radeonsi inactive: gbm,wayland
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 23.2.1 glx-v: 1.4
    direct-render: yes renderer: AMD Radeon Vega 8 Graphics (raven LLVM 17.0.5
    DRM 3.54 6.6.6-1-default) device-ID: 1002:15d8 memory: 250 MiB unified: no
  API: Vulkan v: 1.3.268 layers: 1 device: 0 type: integrated-gpu name: AMD
    Radeon Vega 8 Graphics (RADV RAVEN) driver: mesa radv v: 23.2.1
    device-ID: 1002:15d8 surfaces: xcb,xlib device: 1 type: discrete-gpu
    name: AMD Radeon RX 560 Series (RADV POLARIS11) driver: mesa radv
    v: 23.2.1 device-ID: 1002:67ef surfaces: xcb,xlib

@rilicek Use switcherooctl to launch your application, or if on GNOME DE, right-click the application icon and select launch with discrete graphics.

Unless you have a BIOS option to switch GPU’s?

Some applications like LibreOffice should automatically use the secondary device as a compute node, or some terminal applications like Alacritty, I use nvtop to observe (both with Nvidia and AMD gpu’s)

1 Like

I haven’t Nvidia. I’ve AMD RX560X
I haven’t option to switch GPU in BIOS.
Is there a similar application to nvtop for AMD?

@rilicek nvtop works with AMD… then you can only use for offload.

It succeeded.
Is it possible to set RX560 permanently?

/Unigine_Heaven-4.0> alias dgpu="export DRI_PRIME=pci-0000_01_00_0 &&"
/Unigine_Heaven-4.0> dgpu ./heaven
Loading "/home/marek/.Heaven/heaven_4.0.cfg"...
Loading "libGPUMonitor_x64.so"...
Loading "libGL.so.1"...
Loading "libopenal.so.1"...
Set 1920x1080 fullscreen video mode
Set 1.00 gamma value
Unigine engine http://unigine.com/
Binary: Linux 64bit GCC 4.4.5 Release Feb 13 2013 r11284
Features: OpenGL OpenAL XPad360 Joystick Flash Editor
App path: /Unigine_Heaven-4.0/bin/
Data path: /Unigine_Heaven-4.0/data/
Save path: /.Heaven/

---- System ----
System: Linux 6.6.6-1-default x86_64
CPU: AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx   2095MHz MMX+ SSE SSE2 SSE3 SSSE3 SSE41 SSE42 SSE4A AVX HTT x8
GPU: Unknown GPU x1
System memory: 7622 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8

---- MathLib ----
Set SSE2 simd processor

---- Sound ----
Renderer: OpenAL Soft
OpenAL vendor:   OpenAL Community
OpenAL renderer: OpenAL Soft
OpenAL version:  1.1 ALSOFT 1.22.2
Found AL_EXT_LINEAR_DISTANCE
Found AL_EXT_OFFSET
Found ALC_EXT_EFX
Found EFX Filter
Found EFX Reverb
Found EAX Reverb
Found QUAD16 format
Found 51CHN16 format
Found 61CHN16 format
Found 71CHN16 format
Maximum sources:         256
Maximum effect slots:    16
Maximum auxiliary sends: 2

---- Render ----
GLRender::GLRender(): Unknown ATI GPU
OpenGL vendor:   AMD
OpenGL renderer: AMD Radeon RX 560 Series (polaris11, LLVM 17.0.5, DRM 3.54, 6.6.6-1-default)
OpenGL version:  4.6 (Core Profile) Mesa 23.2.1
OpenGL flags:    Core Profile
Found required GL_ARB_map_buffer_range
Found required GL_ARB_vertex_array_object
Found required GL_ARB_draw_instanced
Found required GL_ARB_draw_elements_base_vertex
Found required GL_ARB_transform_feedback
Found required GL_ARB_half_float_vertex
Found required GL_ARB_half_float_pixel
Found required GL_ARB_framebuffer_object
Found required GL_ARB_texture_multisample
Found required GL_ARB_uniform_buffer_object
Found required GL_ARB_geometry_shader4
Found optional GL_ARB_blend_func_extended
Found optional GL_ARB_tessellation_shader
Found optional GL_ARB_shader_bit_encoding
Found optional GL_ARB_sample_shading
Found optional GL_ARB_compute_shader
Found optional GL_ARB_gpu_shader5
Found optional GL_EXT_texture_compression_s3tc
Found optional GL_ARB_texture_compression_rgtc
Shading language:        4.60
Maximum texture size:    16384
Maximum texture units:   192
Maximum texture renders: 8

---- Physics ----
Physics: Multi-threaded

---- PathFind ----
PathFind: Multi-threaded

GPUMonitorPlugin::init(): can't initialize GPUMonitor
EnginePlugins::init(): can't initialize "GPUMonitor" plugin
---- Interpreter ----
Version: 2.52

@rilicek only by that method. You can however copy or create a desktop file in ~/.local/share/applications and adjust the Exec= part to run any application (or script to launch the application)…

Ok. Thank you :slight_smile: