Graphical Artifacts while gaming

Hi everyone, I want to preface that I’m a complete noob at manjaro and linux as a whole so I hope I haven’t missed anything obvious. The problem I face is that after a game is open for 5-10 minutes, I start getting black lines randomly displaying all over my screen, not just in the game window (The only game I’m able to test right now is Left 4 Dead 2 playing in borderless windowed mode, but it happens in all window modes).
Here’s the inxi report:

System:
  Kernel: 5.15.21-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
    root=UUID=c29cafc2-5b13-475f-a8c6-7b4f3a4ae4ff rw quiet apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: KDE Plasma 5.23.5 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: HP product: HP Laptop 15-bw0xx v: Type1ProductConfigId
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: HP model: 8332 v: 28.35 serial: <superuser required> UEFI: Insyde
    v: F.52 date: 12/03/2019
Battery:
  ID-1: BAT1 charge: 37.2 Wh (100.0%) condition: 37.2/41.4 Wh (89.7%)
    volts: 16.9 min: 14.8 model: Hewlett-Packard PABAS0241231 type: Li-ion
    serial: <filter> status: Full
Memory:
  RAM: total: 3.78 GiB used: 2.99 GiB (79.0%)
  RAM Report:
    permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD A10-9620P RADEON R5 10 COMPUTE CORES 4C+6G bits: 64
    type: MT MCP arch: Excavator family: 0x15 (21) model-id: 0x65 (101)
    stepping: 1 microcode: 0x600611A
  Topology: cpus: 1x cores: 4 smt: enabled cache: L1: 320 KiB
    desc: d-4x32 KiB; i-2x96 KiB L2: 2 MiB desc: 2x1024 KiB
  Speed (MHz): avg: 2612 high: 2914 min/max: 1300/2500 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2914 2: 2889
    3: 2400 4: 2245 bogomips: 19968
  Flags: 3dnowprefetch abm acc_power aes aperfmperf apic arat avic avx avx2
    bmi1 bmi2 bpext clflush cmov cmp_legacy constant_tsc cpb cpuid cr8_legacy
    cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid fma fma4
    fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibs lahf_lm lbrv lm lwp mca
    mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nodeid_msr
    nonstop_tsc nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter
    pclmulqdq pdpe1gb perfctr_core perfctr_nb pfthreshold pge pni popcnt pse
    pse36 ptsc rdtscp rep_good sep skinit smep ssbd sse sse2 sse4_1 sse4_2
    sse4a ssse3 svm svm_lock syscall tbm tce topoext tsc tsc_scale vgif
    vmcb_clean vme vmmcall wdt xop xsave xsaveopt
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl and seccomp
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP:
    disabled, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Wani [Radeon R5/R6/R7 Graphics] vendor: Hewlett-Packard
    driver: amdgpu v: kernel bus-ID: 00:01.0 chip-ID: 1002:9874 class-ID: 0300
  Device-2: Cheng Uei Precision Industry (Foxlink) HP TrueVision HD Camera
    type: USB driver: uvcvideo bus-ID: 2-1:2 chip-ID: 05c8:03ac class-ID: 0e02
    serial: <filter>
  Display: x11 server: X.org 1.21.1.3 compositor: kwin_x11 driver:
    loaded: amdgpu,ati unloaded: modesetting alternate: fbdev,vesa
    resolution: <missing: xdpyinfo>
  Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:
  Device-1: AMD Kabini HDMI/DP Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel bus-ID: 00:01.1 chip-ID: 1002:9840
    class-ID: 0403
  Device-2: AMD Family 15h Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel bus-ID: 00:09.2 chip-ID: 1022:157a
    class-ID: 0403
  Sound Server-1: ALSA v: k5.15.21-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.20 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.45 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel port: 3000 bus-ID: 01:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp1s0 state: up speed: 100 Mbps duplex: full mac: <filter>
  IP v4: <filter> type: noprefixroute scope: global broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: link
  Device-2: Realtek RTL8723DE 802.11b/g/n PCIe Adapter
    vendor: Hewlett-Packard driver: rtw_8723de v: N/A modules: rtw88_8723de
    port: 2000 bus-ID: 02:00.0 chip-ID: 10ec:d723 class-ID: 0280
  IF: wlp2s0 state: down mac: <filter>
  WAN IP: <filter>
Bluetooth:
  Device-1: Realtek Realtek Bluetooth 4.2 Adapter type: USB driver: btusb
    v: 0.8 bus-ID: 1-1.4:3 chip-ID: 0bda:b009 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 931.51 GiB used: 36.83 GiB (4.0%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Toshiba model: MQ01ABD100
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    type: HDD rpm: 5400 serial: <filter> rev: 4C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 465.19 GiB size: 456.82 GiB (98.20%)
    used: 36.75 GiB (8.0%) fs: ext4 dev: /dev/sda6 maj-min: 8:6 label: N/A
    uuid: c29cafc2-5b13-475f-a8c6-7b4f3a4ae4ff
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%)
    used: 81.2 MiB (84.5%) fs: vfat dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 54D4-7EA7
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 2 GiB used: 795.9 MiB (38.9%) priority: -2
    file: /swapfile
Unmounted:
  ID-1: /dev/sda1 maj-min: 8:1 size: 499 MiB fs: ntfs label: Recovery
    uuid: 90D8D26ED8D25258
  ID-2: /dev/sda3 maj-min: 8:3 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-3: /dev/sda4 maj-min: 8:4 size: 465.19 GiB fs: ntfs label: N/A
    uuid: ACB2E39EB2E36AF2
  ID-4: /dev/sda5 maj-min: 8:5 size: 546 MiB fs: ntfs label: N/A
    uuid: D86E1A6A6E1A4224
USB:
  Hub-1: 1-0:1 info: Full speed or root hub ports: 2 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 1-1:2 info: Advanced Micro Devices Root Hub ports: 4 rev: 2.0
    speed: 480 Mb/s power: 100mA chip-ID: 0438:7900 class-ID: 0900
  Device-1: 1-1.4:3 info: Realtek Realtek Bluetooth 4.2 Adapter
    type: Bluetooth driver: btusb interfaces: 2 rev: 1.1 speed: 12 Mb/s
    power: 500mA chip-ID: 0bda:b009 class-ID: e001 serial: <filter>
  Hub-3: 2-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 2-1:2
    info: Cheng Uei Precision Industry (Foxlink) HP TrueVision HD Camera
    type: Video driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s
    power: 500mA chip-ID: 05c8:03ac class-ID: 0e02 serial: <filter>
  Device-2: 2-3:3 info: Dell QuietKey Keyboard type: Keyboard
    driver: hid-generic,usbhid interfaces: 1 rev: 1.1 speed: 1.5 Mb/s
    power: 100mA chip-ID: 413c:2106 class-ID: 0301
  Device-3: 2-4:4 info: Areson Corp 2.4G Wireless Receiver
    type: Mouse,Keyboard driver: hid-generic,usbhid interfaces: 2 rev: 1.1
    speed: 12 Mb/s power: 98mA chip-ID: 25a7:fa0b class-ID: 0301
  Hub-4: 3-0:1 info: Super-speed hub ports: 4 rev: 3.0 speed: 5 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: 59.8 C mobo: 20.0 C gpu: amdgpu temp: 59.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 229 Uptime: 3h 5m wakeups: 1 Init: systemd v: 250 tool: systemctl
  Compilers: gcc: 11.1.0 clang: 13.0.1 Packages: 1267 pacman: 1249 lib: 352
  flatpak: 4 snap: 14 Shell: Zsh v: 5.8 default: Bash v: 5.1.16
  running-in: konsole inxi: 3.3.12

I haven’t messed with anything with regards to drivers, they’re stock with what manjaro installed for me.

That sounds like artifacts from hardware failure (I hope it’s not). Try monitoring your CPU and GPU temperature and power while stressing them (playing games or encoding videos). The simple way to do that is to run watch -d -n1 sensors in the terminal.

Hello @Mute and welcome :wink:

On my research I have found this:
Flickering black lines in X after updating today / Kernel & Hardware / Arch Linux Forums
and this here:
[SOLVED]Flickering screen (black horizontal lines) RX 470 amdgpu / Newbie Corner / Arch Linux Forums

I would say it is newly introduced power management issue. As a workaround you can disable it, but that would result in a higher power consumption.

The second link explains how it could be solved, but I am not 100% sure that it is related to your hardware.

However… first try to disable the dynamic power management:

  1. Open the grub config file:
sudo nano /etc/default/grub
  1. Edit the file and add there:
GRUB_CMDLINE_LINUX_DEFAULT="<existing parameters> amdgpu.dpm=0"

Save: CTRL+S

Close: CTRL+X

  1. Update GRUB:
sudo update-grub
  1. Reboot and see if it is gone:
reboot

I tried running the game on my windows OS I have dual booted and I don’t get the artifacts so it (might) thankfully mean it’s not a hardware issue. I grabbed a copy of the sensor output during the glitces in-case:

k10temp-pci-0003 
Adapter: PCI adapter 
temp1: +68.8°C (high = +70.0°C) (crit = +100.0°C, hyst = +99.0°C)

BAT1-acpi-0 
Adapter: ACPI interface 
ino: 16.91 V 
curri: 0.00 A

amdgpu-pci-0008 
Adapter: PCI adapter 
vddgfx: 1.02 V 
vddnb: 1.06 V 
edge: +68.0°C

fam15h_power-pci-00c4 
Adapter: PCI adapter 
power1: 125. 12 mw (avg = 124.79 mW, interval = 0.01 s) (crit = 15.00 W) 

acpitz-acpi-0 
Adapter: ACPI interface 
temp1: +68.0°C (crit = +226.8°C) 
temp2: +20.0°C

Thanks for the clear and easy instructions, after performing your instructions I managed to play the game with no artifacts in one half hour test session, but I ran into a different problem.

If I open Firefox and load any YouTube video, it would not load, then if I closed Firefox and re-opened it, the whole system would lock up. I noticed that a Firefox process would not end when I closed the browser so I assume the process got locked up.

I used troubleshooting mode in Firefox and noticed it no longer happened so it might be some of the about:config changes I gathered from here with regards to hardware acceleration as my CPU usage gets really high when watching videos. I’ll keep tinkering with stuff and hopefully if everything becomes stable I can mark this solved.

You can always reset Firefox to default from the Help menu, and then reconfigure it manually in its Settings. You’ll also need to reinstall extension and reconfigure them, but at least you start on a refreshed profile with no issue.

That 68 out of 70 degree is pretty high, but it’s ok, I guess. So like what megavolt said, it might just be a power management and or mesa fault. But be sure to check that temperature again with DPM disabled.

Anyway, if you want to venture more, try setting up your monitor frequency to 60 Hz or below if you can and enable vsync globally (also during playing games), as this archlinux wiki said it’s related to amdgpu DPM issue (look at the Screen artifacts and frequency problem section). You can also follow a workaround mentioned on that page.

I guess I forgot to mention that this is a laptop (quite an old one) so I think those temps are ok.

As an update after disabling power management, gaming is fine but other applications which use hardware acceleration proceed to hang my machine. I’ve tried 3 applications, Firefox as previously mentioned, Discord and Parsec. All 3 immediately hang upon displaying video output.

While they all have means to disable hardware acceleration, it does result in an inferior performance (1080p 60fps videos constantly drop frames, Parsec has worse input latency, etc.). Is there any way to rectify this? If it helps, this laptop has an APU, so it’s not got a dedicated graphics card.

Have you tried this with DPM enabled? Also did you check the link to archlinux wiki I mentioned and try the workaround they’ve suggested?

If you have, and if it’s it still doesn’t work, you might want to try to add acpi_osi='Windows 2009' in grub, with and without DPM (just to be safe! do it temporally by accessing grub when booting your laptop. read manjaro or archlinux wiki if you don’t know how to do that). It might not be related to your problem, but it’s for fooling your laptop to make it think that it’s running on Windows 7.

I don’t have the same laptop as yours, so I can’t test it myself. If fooling your laptop also doesn’t work, then you might want to wait until the next mesa and kernel update (or use kernel 5.16 instead, or 5.17 when it released).

So I re-enabled DPM and did the udev rule in that link, it fixed the hardware acceleration crash but brought back the artifacts in game, effectively back to square one.

I’m not 100% sure if I did it right, but what I did was:

sudo nano /etc/udev/rules.d/30-amdgpu-pm.rules

Then I copy pasted this into it:

KERNEL=="card0", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="high"

Saved and rebooted.

About to try with DPM off again to see if anything changes.

Wait, can you try this cat /sys/class/drm/card0/device/pp_dpm_mclk and post the output here before you disable DPM. If you disable DPM, then you need to delete that rules, as it might conflicts to each other (but you’re free to try both of them, tho)

Tried again with DPM off, and it hung on hardware acceleration again, so I can only assume the udev sadly didn’t change anything. Turned it back on, and here’s the output for that command:

cat /sys/class/drm/card0/device/pp_dpm_mclk                                                    ✔ 
0: 667Mhz *
1: 933Mhz 

It should’ve sit at 933Mhz. Can you try this: sudo echo "1" > /sys/class/drm/card0/device/pp_dpm_mclk and run cat /sys/class/drm/card0/device/pp_dpm_mclk again. You can change the echo number to “0” or “2” to test where the high performance is set. It will revert the change to default value if you reboot, in case you want it to.

Sorry I’m new at this, it doesn’t seem to be allowing me to edit that file:

sudo echo "1" > /sys/class/drm/card0/device/pp_dpm_mclk
zsh: permission denied: /sys/class/drm/card0/device/pp_dpm_mclk

Oh, that means you need to switch to root account completely using su. But I don’t recommend that. Well, i guess disabling DPM is your only option for now. Lets hope someone else know another workaround. Good luck. :slight_smile:

Ah that’s unfortunate, I do appreciate you trying to help me out though.

As an aside, if no solution does get found, is there a way to toggle DPM on the fly without requiring a reboot? It’d be a little inconvenient but I wouldn’t be opposed to manually turning it off/on when needed if it’s possible to.

I can think of two way to do that. First, if you still have the udev rules that doesn’t work before, you can try trigger it with sudo udevadm trigger and hope it will run as expected. You may have to trigger it every times you reboot your laptop.

And the other way is using this: GitHub - marazmista/radeon-profile: Application to read current clocks of ATi Radeon cards (xf86-video-ati, xf86-video-amdgpu)
Radeon-profile pakages are in AUR (or you can build them from that git source), but I warn you, they’re not supported and not recommended to use within Manjaro system, as they might break the whole thing.

I tried sudo udevadm trigger but it didn’t seem to toggle dynamic power management, I guess the grub method is the only way that works?

I also previously tried the that package, but after it took a while to build, it ended up not detecting anything from my system, all windows were blank.

One thing that puzzles me is why disabling dynamic power management would end up bricking hardware acceleration. If that could somehow be resolved then I can live without DPM.

A side thought, and I doubt it would, but would a different video driver affect anything? I’m currently using video-linux, the other options are video-modesetting and video-vesa.

One last try, boot with amdgpu.runpm=0 instead of amdgpu.dpm=0.

Well, this is just my uneducated guess, disabling DPM means turning off a module (or something) to control you GPU clocks/power. Thus your GPU stuck at the bottom speed and your games runs slower. The absence of that module also affect application behavior that expect it to exist, thus makes them crash or slow. Again, this is just my uneducated guess. :smile:

Edit:

You’re free to try. The video-modesetting is for intel gpu, i guess. And video-vesa is for prehistorical vesa card, 99% that thing wont work.

Unfortunately, amdgpu.runpm=0 had no effect.

I don’t know if it will help in any way, but I ran the command cat /sys/class/drm/card0/device/pp_dpm_sclk to try to gather any more info that I could find, and got this output:

0: 300Mhz *
1: 480Mhz 
2: 533Mhz 
3: 576Mhz 
4: 626Mhz 
5: 685Mhz 
6: 720Mhz 
7: 757Mhz 

After running it in watch for a while I noticed it would periodically jump to the 7th level for a few seconds before falling back down to the 0th regardless of activity type. The other levels don’t seem to ever be selected, neither idle, light activity or heavy activity. Again I don’t know if this info is useful in anyway but I’m trying to provide whatever I can since there doesn’t seem to be many options left.

If runpm doesn’t work then I have no idea left how to fix it. You can try AMD proprietary driver (amdgpu-pro), they are in AUR (again, not supported by manjaro). Or you can stay with DPM disabled and wait for the next mesa update. Or, drastically, you can try another well-funded distro such as Ubuntu (now I really going to get banned for promoting other distro in here. :laughing:).

Maybe that’s the bug. You might want to report that to mesa or kernel team, or anyone responsible with amdgpu driver. That might helps or at least push them to make a patch for the next mesa update.