Dual GPU laptop white black artifacting after closing native games

Good evening!

I recently put Manjaro on a laptop with the following hardware:

  • CPU: AMD Ryzen 7 7840HS
  • iGPU: Radeon 780M
  • dGPU: Nvidia 4060 laptop
  • RAM: 1 x 16 GB DDR5 5600, 1 x 8 GB DDR5 5600
  • Display: 2560 x 1600 at 165 Hz.

I am running the KDE plasma version of Manjaro, with the following software versions as reported by the system settings:

  • KDE plasma 5.27.10
  • KDE frameworks: 5.113.0
  • Qt: 5.15.11
  • Kernel: 6.6.8-2-MANJARO (64-bit)
  • Graphics platform: X11

I am also using the closed source drivers.

When playing games natively in Linux (so not through Proton or the like) and fullscreen, I occasionally get major graphical issues. More often, those issues appear after closing such a game, or when going to the desktop while playing one. The glitching can look as follows:


The black parts change on what is ‘shown’ on screen. Sometimes the screen is also just white, regardless of what it is trying to show. Either my screen gets stuck like this, or it switches rapidly between looking like this and looking like normal, or it looks like this when hovering over certain UI elements (like icons on my desktop), but functions normally otherwise. Screenshots do not pick up on this, and just show whatever ought to be displayed. The cursor always renders above the artifacting. After restarting everything works as expected again.

On my desktop my laptop is using the iGPU. I do not know what is used in-game. I have tried to look around to see if I could find others with similar issues, but I had no luck. I suspect the issue might be that switching GPUs fails, but I do not know how to check for that… If someone could help me diagnose why this happens that would be very much appreciated!

Cheers!

If you have a hybrid system with an iGPU and gGPU, it should use the iGPU by default and only use the dGPU when you call it through prime.

System info:

inxi -Fazy

PRIME check:

glxinfo | grep 'renderer string'
DRI_PRIME=1 glxinfo | grep 'renderer string'

If you want games to use it … you similarly want to use DRI_PRIME=1.
In the case of steam, do not launch steam with prime… you edit the launch options.

DRI_PRIME=1 %command%

The output of the system info is:

System:
  Kernel: 6.6.8-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.6-x86_64
    root=UUID=281292f6-0ef6-4430-8b0d-b8b430980b25 rw quiet splash
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.11 wm: kwin_x11 vt: 2
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 82XU v: LOQ 16APH8
    serial: <superuser required> Chassis: type: 10 v: LOQ 16APH8
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: No DPK serial: <superuser required>
    UEFI: LENOVO v: LYCN40WW date: 11/08/2023
Battery:
  ID-1: BAT1 charge: 81.5 Wh (100.0%) condition: 81.5/80.0 Wh (101.9%)
    volts: 17.5 min: 15.4 model: Sunwoda L22D4PC2 type: Li-poly serial: <filter>
    status: full cycles: 6
CPU:
  Info: model: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics bits: 64 type: MT MCP
    arch: Zen 4 gen: 5 level: v4 note: check built: 2022+ process: TSMC n5 (5nm)
    family: 0x19 (25) model-id: 0x74 (116) stepping: 1 microcode: 0xA704103
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 8 MiB desc: 8x1024 KiB
    L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 2209 high: 4333
    min/max: 400/5293:5137:5608:6080:5449:5764:5924 scaling:
    driver: amd-pstate-epp governor: powersave cores: 1: 2344 2: 2213 3: 400
    4: 3663 5: 2124 6: 1887 7: 1754 8: 1754 9: 2231 10: 4333 11: 3141 12: 400
    13: 2944 14: 3067 15: 2700 16: 400 bogomips: 121411
  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 status: Not affected
  Type: spec_rstack_overflow status: Vulnerable: Safe RET, no microcode
  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: Enhanced / Automatic IBRS, IBPB: conditional,
    STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA AD107M [GeForce RTX 4060 Max-Q / Mobile] vendor: Lenovo
    driver: nvidia v: 545.29.06 alternate: nouveau,nvidia_drm non-free: 545.xx+
    status: current (as of 2023-11) arch: Lovelace code: AD1xx
    process: TSMC n4 (5nm) built: 2022+ pcie: gen: 4 speed: 16 GT/s lanes: 8
    ports: active: none empty: DP-9,HDMI-A-1,eDP-2 bus-ID: 01:00.0
    chip-ID: 10de:28e0 class-ID: 0300
  Device-2: AMD Phoenix1 vendor: Lenovo driver: amdgpu v: kernel arch: RDNA-3
    code: Phoenix process: TSMC n4 (4nm) built: 2023+ pcie: gen: 4 speed: 16 GT/s
    lanes: 16 ports: active: eDP-1 empty: DP-1, DP-2, DP-3, DP-4, DP-5, DP-6,
    DP-7, DP-8 bus-ID: 05:00.0 chip-ID: 1002:15bf class-ID: 0300 temp: 51.0 C
  Device-3: Luxvisions Innotech Integrated Camera driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:2 chip-ID: 30c9:00a7
    class-ID: fe01 serial: <filter>
  Display: x11 server: X.Org v: 21.1.10 compositor: kwin_x11 driver: X:
    loaded: modesetting,nvidia dri: radeonsi gpu: amdgpu display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 2560x1600 s-dpi: 96 s-size: 677x423mm (26.65x16.65")
    s-diag: 798mm (31.43")
  Monitor-1: eDP-1 model: BOE Display 0x0b38 serial: <filter> built: 2022
    res: 2560x1600 hz: 165 dpi: 189 gamma: 1.2 size: 344x215mm (13.54x8.46")
    diag: 406mm (16") ratio: 16:10 modes: max: 2560x1600 min: 640x480
  API: EGL v: 1.5 hw: drv: nvidia drv: amd radeonsi platforms: device: 0
    drv: nvidia device: 1 drv: radeonsi device: 3 drv: swrast surfaceless:
    drv: nvidia x11: drv: radeonsi inactive: gbm,wayland,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon Graphics (gfx1103_r1 LLVM
    16.0.6 DRM 3.54 6.6.8-2-MANJARO) device-ID: 1002:15bf memory: 500 MiB
    unified: no
  API: Vulkan v: 1.3.274 layers: 5 device: 0 type: discrete-gpu name: NVIDIA
    GeForce RTX 4060 Laptop GPU driver: nvidia v: 545.29.06
    device-ID: 10de:28e0 surfaces: xcb,xlib device: 1 type: integrated-gpu
    name: AMD Radeon Graphics (RADV GFX1103_R1) driver: mesa radv
    v: 23.1.9-manjaro1.1 device-ID: 1002:15bf surfaces: xcb,xlib
Audio:
  Device-1: NVIDIA vendor: Lenovo driver: snd_hda_intel v: kernel pcie: gen: 4
    speed: 16 GT/s lanes: 8 bus-ID: 01:00.1 chip-ID: 10de:22be class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor driver: snd_pci_ps
    v: kernel alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x,
    snd_pci_acp6x, snd_acp_pci, snd_rpl_pci_acp6x, snd_sof_amd_renoir,
    snd_sof_amd_rembrandt, snd_sof_amd_vangogh pcie: gen: 4 speed: 16 GT/s
    lanes: 16 bus-ID: 05:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 05:00.6
    chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.6.8-2-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: 2000 bus-ID: 02:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter
    vendor: Lenovo driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
    bus-ID: 03:00.0 chip-ID: 14c3:7961 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
Bluetooth:
  Device-1: Foxconn / Hon Hai MediaTek Bluetooth Adapter driver: btusb v: 0.8
    type: USB rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:3
    chip-ID: 0489:e0cd class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 476.94 GiB used: 118.9 GiB (24.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: KIOXIA model: N/A
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: 0108ANLS temp: 38.9 C
    scheme: GPT
Partition:
  ID-1: / raw-size: 476.64 GiB size: 468.09 GiB (98.21%)
    used: 118.87 GiB (25.4%) fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 32.3 MiB (10.8%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 54.0 C mobo: 40.0 C gpu: amdgpu temp: 52.0 C
  Fan Speeds (rpm): N/A
Info:
  Processes: 353 Uptime: 1h 19m wakeups: 0 Memory: total: 24 GiB note: est.
  available: 22.71 GiB used: 6.83 GiB (30.0%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: pm: pacman pkgs: 1172 libs: 333 tools: pamac pm: flatpak pkgs: 0
  Shell: Zsh v: 5.9 default: Bash v: 5.2.21 running-in: konsole inxi: 3.3.31

The output of respective commands under PRIME check are:

OpenGL renderer string: AMD Radeon Graphics (gfx1103_r1, LLVM 16.0.6, DRM 3.54, 6.6.8-2-MANJARO)
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: nouveau
OpenGL renderer string: AMD Radeon Graphics (gfx1103_r1, LLVM 16.0.6, DRM 3.54, 6.6.8-2-MANJARO)

After looking around for a bit, i found an article from the garuda linux wiki, according to which my GPU supports NVIDIA PRIME Render Offload. Using the prime-run mentioned there with your command gives me the output

OpenGL renderer string: NVIDIA GeForce RTX 4060 Laptop GPU/PCIe/SSE2

However adding prime-run %command% to the launch options instantly makes my games crash, while using DRI_PRIME=1 just makes them use the iGPU… Am I doing something wrong here?

Besides all this, I tested a little more, and found that up until now, all programs I’ve been running have been using the iGPU. So while that is also an issue I’ll have to solve, it is seemingly not the cause of the graphical problems I’ve been having…

Sorry, dont know where I was assuming it was open-open.

Probably just an error of having 3 threads all on prime open :sweat_smile:

Yes, prime-run is correct for your case.

This is unfortunate. And unusual.

Please double check mhwd

mhwd -li -l

The output of mhwd is:

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI
video-hybrid-amd-nvidia-prime            2023.03.23               false            PCI


Warning: No installed USB configs!
> 0000:02:00.0 (0200:10ec:8168) Network controller Realtek Semiconductor Co., Ltd.:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
         network-r8168            2023.09.12                true            PCI


> 0000:01:00.0 (0300:10de:28e0) Display controller nVidia Corporation:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2023.03.23               false            PCI
          video-nvidia            2023.03.23               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI


> 0000:05:00.0 (0300:1002:15bf) Display controller ATI Technologies Inc:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2023.03.23               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI

To me, nothing alarming related to graphics drivers seems to jump out to me.

I also tested some other games with the launch options; the games that I am emulating via Proton do seem to work, but the two native games do not (both use the same game engine, so it might have to do with that).

For the sake of it, I also tried to use the optimus-manager. Besides screwing up my SDDM scaling it seems to resolve the issue I had. If I’m to believe the garuda wiki and other sources I’ve found, this is not necessarily a good option for multiple reasons, but if I don’t manage to fix it otherwise I guess I’ll use it.

Optimus-manager only allows you to force one gpu or the other.
(along with applying some other hacky stuff … like messing with sddm as you saw)
Some BIOS allow such options as well.
But if you need a software solution to accomplish that … use something not as terrible … like envyvontrol

Ah, found the thread for the 2 alternatives (and their desktop widgets)

Thank you for the recommendation! After some more testing, it seems(?) like I do not have the issue when forcing the dGPU to be used at all times, but I do have the graphical issues when using the iGPU. This is behaviour I see both when using optimus-manager and when disabling my iGPU in my bios. envycontrol does not allow me to force the dGPU (since I have got an AMD CPU), so I haven’t been able to check if it’s also the case when using that (though presumably it is).

At least I know the problem is something to do explicitly with the iGPU now.