Setting up your AMD video card in Ubuntu 20.04

Ubuntu 20.04 just arrived with fractional scaling of the desktop available from the settings. Yes, you have to turn it on first to be able to choose fractional scaling of 125% or 150%, but finally you don’t have to edit gnome settings to do this. Also, this time it might work as intended too…

I have an ASUS Radeon R9 390X STRIX OC 8GB GDDR5 (STRIX-R9390X-DC3OC-8GD5-GAMING) video card which is getting quite old in 2020 but still is quite perfect for my huge gaming backlog. I’ll probably stick with it for a few more years.

I also have a LG 32UK550 4K UHD VA FreeSync HDR LED Monitor and do want to enjoy the extra crisp resolution. Unfortunately my eyes are getting a bit old, so using Windows or Linux in native 4K resolution is out of the question.

The sensible thing to do is to turn desktop scaling to 125% or 150% to stay on the native resolution and still enjoy crisp and appropriately sized text. This works out of the box on Windows 10, but was always problematic on Linux.

I tried a bunch of Ubuntu versions and even other distributions, but when desktop scaling was even available, I always had some flickering text when typing something as if the window manager tried to redraw the windows after each keystroke. This rendered the user experience totally unacceptable, so after weeks of experimenting I had to settle to using the 4K monitor on 1440p resolution. This way there was no flickering, the content was sized okayish, but the image was just not as crisp as on native 4K.

Fast forward about 7 months and Ubuntu 20.04 arrives. After a quick reinstall, I sadly had to conclude that the flickering text problem still persists. Also, the official AMD drivers are not yet available, so I’m stuck with the open source radeon driver shipped with the distro, which tends to freeze my computer when watching youtube videos. Another thing is that using the monitor in 1440p seems to be a bit more blurry than with Ubuntu 18.04 with the amdgpu-pro drivers.

Don’t worry, we are coming to a happy ending soon 🙂

So, after some digging I found the solution to make everything work. At the moment 125% desktop scaling seems to work perfectly without flickering and youtube didn’t froze my computer either.

Step one: Use the official amdgpu driver from a third-party PPA repository

I found out in this article that you can use the official drivers by adding a PPA with the following commands:

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update && sudo apt -y upgrade

If you ever need to get rid of it, use these commands:

sudo apt install ppa-purge
sudo ppa-purge ppa:oibaf/graphics-drivers

Go ahead, reboot your computer. Issue the following command to see if the driver is active:

lshw -c video

Look for the keyword “driver=”. If you see “amdgpu” there, your are ready, no need to continue with this article. However if you see “radeon” there, you are still on the open source driver and need to take a few more steps.

Step two: Blacklist the radeon module

To tell the truth, I’m not sure if this step is really necessary, so if you succeed with only step one and three, please tell me in a comment, so I can update the article.

If you run the following command…

lspci -k | grep -EA3 'VGA|3D|Display'

… you’ll see that you have two kernel modules available: radeon and amdgpu.

To disable radeon, you have to edit /etc/modprobe.d/blacklist.conf:

sudo mcedit /etc/default/grub

…and add the following line at the end:

 blacklist radeon

Now update grup by issuing the following command:

sudo update-initramfs -u

Be aware that if you reboot now, you might end up in a very low desktop resolution.

Step three: modeset magic

We have to add a few parameters to Grub to make the amdgpu driver work. The commands are straight from my previous article.

Edit the /etc/default/grub file:

sudo mcedit /etc/default/grub

Add these lines:

GRUB_GFXMODE=1920x1080x32
GRUB_CMDLINE_LINUX_DEFAULT="radeon.si_support=0 radeon.cik_support=0 amdgpu.si_support=1 amdgpu.cik_support=1 amdgpu.dc=1 amdgpu.dpm=1 amdgpu.modeset=1"

Run these commands to modify grub and reboot:

sudo update-grub2 && sudo update-initramfs -u -k all<br>
sudo reboot


Update:

Unfortunately desktop scaling support still seems to be incomplete. I ran into the following problems and none of the solutions that Google spat out worked:

  • Gimp doesn’t scale, so the interface is tiny with microscopic icons. Images being edited in 100% zoom are shown without desktop scaling, so no serious editing can be done as the exported image is larger.
  • Spotify doesn’t scale, so the interface is tiny. It works but is really hard to see in native 4K resolution.
  • The mouse cursor from the loging screen gets stuck and is visible as a second, smaller mouse cursor on the desktop.
  • Performance gets a huge hit, the system just doesn’t seem to be snappy at all.

I tried using the system as it is for a few days, but had to go back to 1440p resolution to have a stable and usable system. The image is not as sharp, but at least everything works as it should.

All in all, I should have bought a monitor with native 1440p resolution, but back then I had no idea about the possible problems I ran into. No matter, this is quite usable now and maybe Ubuntu 20.10 will finally provide full desktop scaling support.

8 thoughts on “Setting up your AMD video card in Ubuntu 20.04

  1. Thanks for this, I’m hoping this’ll resolve my issues with fractional scaling. Shame, as this is the only issue I really have with Ubuntu, and it’s now my full time desktop.

    FYI, you can fix Spotify by executing spotify –force-device-scale-factor=2.2 (you can change the scale factor to whatever suits you, I run at 4k and 150% fractional scaling). You need to do this everytime you launch Spotify, I haven’t worked out how to make it remember this (probably easy for someone more into Linux than me).

    1. I decided to stick to 1440p resolution as the second stuck cursor really bothers me. I’ll just wait until the next release and try again.

      Good luck with fractional scaling 🙂

  2. This did the job at fixing resolution. The update section says performance takes a huge hit. I’m experiencing that in the form of simple games working at 1/3 speed. Is there no workaround, or am I describing a different problem entirely?

    1. I’m not sure about your performance loss, but to tell the truth I stopped experimenting with desktop scaling as 1440p currently is satisfactory for me. When a version of Ubuntu or Linux Mint emerges that has better support, I will try again.

      Still, you can make a simple measurement: Note how much fps you get with desktop scaling enabled and disabled and draw your conclusions from that if desktop scaling is to blame. Don’t forget to tell me the results too, as I’m curious 🙂

      1. If desktop scaling is called fractional scaling in settings, changing it had no effect. I’ve seen suggestions on Reddit of changing amdgpu.dc to 0 as well as certain other modeset functions that have been referred to above. Might this resolve what I am encountering?

        1. Having amdgpu.dc=0 instead of =1 has not resolved this slowness. Trying the amd website driver install instructions returns
          Errors were encountered while processing:
          amdgpu-dkms
          amdgpu
          E: Sub-process /usr/bin/dpkg returned an error code (1)
          Which may be telling me where I need to troubleshoot. I then need to work on how to do that and will update on this and other public forums if I can make it work / someone tells me something that makes it work.

Leave a Reply

Your email address will not be published. Required fields are marked *