AMD's GPU linux drivers overview

in #amd7 years ago

The goal of this submission is to offer an overview of the driver options available for AMD GPU owners and how to install and use them, this will cover GPUs from Southern Islands to the RX Vega.

First, it should be noted that these drivers are actually split in two categories: Kernel drivers and Userspace drivers.

Userspace drivers can be updated normally like any other program in your distro's repositories ,or any other means you use to install and update your applications, like compiling, whereas the Kernel drivers come with your kernel and it can be harder to update depending on your distro, as cyclical release distros tend to be behind regarding the Kernel version they use.

So what should you be using? it depends on your hardware.

Kernel Drivers/Modules

RADEON has been around for a good while and its support starts with pre-GCN era cards starting with the R100 up until GCN 1.2 cards. AMDGPU on the other hand supports cards from GCN 1.0 onwards, and is the only kernel driver available for RX cards. However it should be noted that support for GCN 1.0 and 1.1 is still considered experimental so a few extra steps are necessary to use it instead of RADEON.

R100 to GCN 1.2 cards are supported by RADEON, and GCN 1.0 to RX are supported by AMDGPU. As such RX owners do not have to worry about choosing a Kernel driver, but GCN 1.0, 1.1 and 1.2 owners should check benchmarks to help them know which is better for them; for most cards the performance in games for RADEON and AMDGPU is about equal, with some newer games seeing a boost with AMDGPU, however, it can be seen that the R9 270x and and R7 370 has considerably worse performance on AMDGPU than on RADEON on the kernel 4.13, whereas the R9 290 has pretty big performance gains from the switch to AMDGPU.

There are also other factors to consider when deciding which one to choose, if your card offers similar performance in both, you might be interested in using AMDGPU as Vulkan drivers only work with it and not with RADEON. The other factor is HDMI audio which was not supported by AMDGPU until the kernel 4.13, that means if your distro is a couple of versions behind you will not be able to output audio through HDMI unless you are using the RADEON drivers.

I want to use AMDGPU over RADEON!

If you are on GCN 1.2 or later AMDGPU will be loaded by default. If you are on GCN 1.0 or 1.1 your kernel has to be compiled with support for them, to check if it was you can use the following command on your terminal:
zgrep AMDGPU /proc/config.gz

If the following two lines are present:
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y

then that means your kernel was compiled with support for them. SI means Southern Islands and CIK means Sea Islands, they are GCN 1.0 and 1.1 respectively, and the y at the end means yes(so if it ends with an n, it means your kernel does not support it).

Unfortunately this is not all you need, if you are on a kernel older than 4.13 you need to blacklist radeon so it does not get loaded when you boot, to do this you need to create a .conf file on /etc/modprobe.d/, as it is not on your user's folder you will need sudo to be able to do any changes to it. You can use the following command to do it:
sudo nano /etc/modprobe.d/radeon.conf

(radeon.conf is just an example, you can use any name you want, nano can also be changed for another command to edit text files, like vim, gedit or kate) Then you write the following in the file:
blacklist radeon

Save and exit, if you decided to use nano, you save by using the combination of Ctrl+O, confirm the name with the return key, and then Ctrl+X to exit nano.

Now you need to edit /etc/mkinitcpio.conf (again, you need to use sudo) and go to the MODULES="" line, and add amdgpu to it, if radeon is already in there, then add amdgpu to the left of it, if you are feeling unsure, here are some examples:

MODULES="amdgpu"
MODULES="amdgpu radeon"
MODULES="othermodule amdgpu radeon othermodule2"

these three are all valid examples, but remember the only thing you will do is add AMDGPU inside the quotations marks, then save and close, and finally run this command to apply the changes:

  • sudo mkinitcpio -p linux
    And now you should be running AMDGPU in your pre 4.13 linux kernel.

If you are using 4.13 you do not need to blacklist the radeon module, instead, you need to change your kernel parameters. If you do not know how to do this, I recommend you use a graphical tool, like grub-customizer, if you are on an ubuntu based system you can use the following commands to get it installed from a ppa:

  • sudo add-apt-repository ppa:danielrichter2007/grub-customizer
  • sudo apt-get update
  • sudo apt-get install grub-customizer

If you are using an arch based system, you can use aur.
after installing grub-customizer, launch it with grub-customizer in your terminal

Grub Customizer.png

You click on General Settings and edit the Kernel parameters field, adding to the end of it the following:

  • radeon.si_support=0 radeon.cik_support=0 AMDGPU.si_support=1 AMDGPU.cik_support=1

Upon reboot AMDGPU should be automatically used.

Userspace Drivers

There are basically two usecases here: a workstation with need for productivity application or a normal user (who may or may not use his computer to play games). If you are the former you will need AMDGPU-PRO, which works with AMDGPU.

If you want your computer for general usage: browsing, watching movies, playing games, etc. Then you should use MESA drivers, which work with both RADEON and AMDGPU kernel drivers.

MESA should provide a better out of the box user experience, and it should ship by default with most distros, leaving AMDGPU-PRO as an optional step for users. AMDGPU-PRO generally requires users to use an older than current kernel version, and provides considerably worse OpenGL performance (very important for games). AMDGPU-PRO has a more mature Vulkan driver than MESA, and even though AMD plans on open sourcing the Vulkan driver and hopefully get it in MESA there is no ETA for this.

MESA is an open source driver for both AMD and Intel. When talking about GCN 1.0 and onwards, the actual driver is called RadeonSI. AMDGPU-PRO, on the other hand, is closed source.

If you are using Ubuntu or another cyclical release distro it is likely you are using an old version of mesa, the current stable version of mesa is 17.2, and it is recommended you update to it as there has been a lot of performance tweaking between it and 17.1. If you are using an arch based distro it is likely you already have mesa 17.2.x installed, as it tends to get updates a few days after they are released, to check what version you have, run the following command in the terminal:
glxgears -info
it will open a window with spinning gears and print some information in the console, your current version will be in the GL_VERSION line
glxgears.png

If you are on an ubuntu based system I recommend you use this repository

  • sudo add-apt-repository ppa:paulo-miguel-dias/pkppa
  • sudo apt update
  • sudo apt upgrade
    should be everything you need to get it up and running.

Pitfalls

Currently, there is no display code upstream, which is needed by RX Vega, in practice this means that until the display code gets into the kernel (which will not happen until at least linux 4.15 is released) you will not have video output unless you use a custom kernel, which is available here along with instructions on how to install it, it is aimed at ubuntu users, but should work with derivatives. Even though this Kernel(at the time of writing) is 4.12, it does support HDMI audio. If you are on an arch based system you can use aur to compile and install it.

Squeezing some more performance out of MESA

If you chose to use MESA and also play games, there are some enviroment variables you can set to improve game performance, I recommend using GALLIUM_HUD to test the changes you make and ensure it actually runs better. First I will list what they do and then explain how to use them.

  • mesa_glthread=true this threads some calls, providing a performance boost in some games. There is already some games that automatically run with that option without user input, but there are more that could benefit and have not been added to the whitelist just yet.
  • R600_DEBUG=sisched this enables the SI scheduler which might provide better performance in some games, you need LLVM 3.8 or later to use this(otherwise it will do nothing), information provided by glxgears -info
  • RADEONsi_commutative_blend_add=true
  • RADEONsi_assume_no_z_fights=true both of these options are explained here. Basically they allow for slightly better performance. These options are not on by default because in some cases they might lead to incorrect results, however, they should work just fine for most games. To be able to use these last two options you will need to be using mesa 17.3(the current development, and as such, unstable version)

To use these options you just need to add them before your game's launching command, in the terminal, and assuming you want to use the first two:

  • mesa_glthread=true R600_DEBUG=sisched game-executable-command

If you want to use these with a Steam game, you need to go to your library, right click on the game you are interested on, select properties and click SET LAUNCH OPTIONS... and add what you want followed with a %command% at the end.

steam.png

Performance Testing

To help know when to actually use some of the variables you need to actually know if they are improving your framerate, and not every game has a benchmark mode. For those wanting to have all the information they can get, they can use GALLIUM_HUD.

To know all the available options run the following in the terminal:
GALLIUM_HUD="help" and it will show you all your available options. Personally, I used the following:
GALLIUM_HUD="fps,cpu+cpu0+cpu1+cpu2+cpu3:100,GPU-load,requested-VRAM"
just like with the previous variables, it has to be put before your game's command, and it can be used wherever you want, Steam included, so you have an alternative to Steam's built-in FPS counter. In practice my settings looks like this:
Captura de pantalla de 2017-07-12 22-35-12.png

OpenCL

If you want to do something with computing I recommend you use AMDGPU-PRO. MESA also has OpenCL support, but unlike AMDGPU-PRO it doesn't support OpenCL 1.2. Your options are, if you have a supported system, to install AMDGPU-PRO. If you don't want to give up on MESA's OpenGL performance but would also like to have better OpenCL support, you can try installing just the AMDGPU-PRO's OpenCL driver along with MESA.

If you are on ubuntu or an ubuntu based system, you need to go to AMD's website and download the AMD APP SDK 3.0, install it and then install the following packages:

  • sudo apt install opencl-headers mesa-opencl-icd

If you are on an arch based system, you just need to install this package from the aur.

Sort:  

Congratulations @onmars! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You made your First Vote
You made your First Comment
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 62630.85
ETH 2463.74
USDT 1.00
SBD 2.61