The amdgpu driver on linux

I use a Radeon 7950 (Tahiti/Southern Islands) GPU on linux to run a 4k LG 32UD59 32” monitor. The old radeon driver doesn’t work so well; the colors are reddish, and the picture is not sharp.

TL;DR The amdgpu driver is great with colors and supports displayport and HDMI. But it does cause a lot of problems with hibernate, and crashes firefox when hardware acceleration is enabled. I have listed my hacks for this problem.

So I made forced my kernel to run the amdgpu driver by setting

blacklist radeon

in modprobe.conf. Then, you include the following kernel options

 radeon.si_support=0 amdgpu.si_support=1 

Which tells the kernel to enable the amdgpu driver for southern islands cards.

The new driver is not bad, but somehow, it really needed the amdgpu-pro driver from AMDs website to get a sharp image. On my debian stable installation, the amdgpu-pro driver installation script has to be tweaked to disable checks for ubuntu, and once you do that, it installs without any errors. The pro driver is a proprietary driver that works on top of the open source amdgpu driver. I have two main problems with it:

  1. Hibernate
  2. Firefox crashes

Hibernate fails every once in a while on the new driver, since it complains about a lack of swap space to write the hibernate file in. This is because the amdgpu driver appears to be allocating a bunch of unnecessary space for some strange reason. So I have to get the systemd-hibernate.service unit to restart. This is a pain in and of itself, since the systemd-hibernate.service is of type oneshot and hence cannot be restarted easily. Hence, I used this fail-notify@.service from the systemd github page:

/etc/systemd/system/fail-notify@.service

[Unit]
Description=Restart a failed service, implements Restart on-failure for simple/oneshot
# Enable by specifying OnFailure=fail-notify@%n.service AND #RestartSec=xxx

[Service]
Type=oneshot
ExecStartPre=/bin/sh -c 'systemctl set-environment SEC="`systemctl cat %i|grep -Po \\"^#RestartSec=\\K(\\d)*(?=s?$$)\\"`"'
   ExecStart=/bin/sleep ${SEC}
   ExecStart=-/bin/systemctl restart %i

Then in /etc/systemd/system/systemd-hibernate.service I had

[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target
OnFailure=fail-notify@%n
#RestartSec=30

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-sleep hibernate

On firefox, I simply disabled mutliprocess tabs by going to about:config and then toggling the

browser.tabs.remote.autostart = false

It seems much more stable after this. Perhaps it is the hardware acceleration that is failing as well, since I do get gpu crashes induced by firefox pages in the systemd journal. There is another option to remove hardware acceleration in firefox, but I enjoy my 4k videos, and although I am not sure, I feel like they might be gpu accelerated.

Note that some people have noted stability improvements by removing 2d acceleration by using an Xorg setting

Section "Device"
    Device "amdgpu"
    Option "AccelMethod" "none"
EndSection

but this seems to defeat the purpose of a graphics card.