AMDGPU

From Gentoo Wiki
Jump to: navigation, search
Resources

AMDGPU is the next generation family of open source graphics drivers for newer AMD/ATI Radeon graphics cards based on the Southern Islands, Sea Islands, Volcanic Islands, and Arctic Islands chipsets.

If the card in question does not appear in the Feature support section below, it is not supported by AMDGPU. In that case check the radeon article, which contains instructions for older open-source AMD/ATI Radeon graphics card drivers.

Installation

Setting up a system to use AMDGPU requires identifying the proper card, installing the corresponding firmware, configuring the kernel, and installing the X11 driver.

Prerequisites

Hardware detection

To choose the right driver, first detect the graphics card. Use lspci for this task:

root #lspci | grep -i VGA

Check the output for one of the product names listed in the table below.

Feature support

Family Chipset name Product name OpenGL OpenGL ES VIDEO_CARDS
Southern Islands3 CAPE VERDE, PITCAIRN, TAHITI, OLAND, HAINAN HD7750-HD7970, R9 270, R9 280, R9 370X, R7 240, R7 250 4.1 3.0 amdgpu radeonsi
Sea Islands1 BONAIRE, KABINI, KAVERI, HAWAII, MULLINS HD7790, R7 260, R9 290, R7 360, R9 390 4.3 3.1 amdgpu radeonsi
Volcanic Islands CARRIZO, FIJI, STONEY, TONGA, TOPAZ R9 285, R9 380, R9 380X, R9 Fury, R9 Nano, R9 Fury X, Pro Duo 4.3 3.1 amdgpu radeonsi
Arctic Islands2 POLARIS10, POLARIS11 RX 460, RX 470, RX 480 4.3 3.1 amdgpu radeonsi
1 Support is optional in the kernel.
2 Since kernel 4.7-rc6
3 Experimental, optional support added since kernel 4.9-rc1

Firmware

It is necessary to install the proper firmware (or microcode) for your card. Firmware files are provided by sys-kernel/linux-firmware.

USE flags for sys-kernel/linux-firmware Linux firmware files

savedconfig Allows individual selection of firmware files local

root #emerge --ask sys-kernel/linux-firmware

The firmware files installed this way will be incorporated into the kernel.

Kernel

Set the following kernel options for the graphic chipsets mentioned above:

KERNEL
Processor type and features  --->
    [*] MTRR (Memory Type Range Register) support
Device Drivers  --->
    Graphics support  --->
        <*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
              [*]   Enable legacy fbdev support for your modesetting driver
        <   > ATI Radeon
        <*/M> AMD GPU
              [ /*] Enable amdgpu support for SI parts
                    (only needed for Southern Islands GPUs with the amdgpu driver)
              [ /*] Enable amdgpu support for CIK parts 
                    (only needed for Sea Islands GPUs with the amdgpu driver)
              [*]   Enable AMD powerplay component  
              ACP (Audio CoProcessor) Configuration  ---> 
                  [*] Enable AMD Audio CoProcessor IP support (CONFIG_DRM_AMD_ACP)
    <*/M> Sound card support  --->
        <*/M> Advanced Linux Sound Architecture  --->
            [*]   PCI sound devices --->
                  HD-Audio  --->
                      <*> HD Audio PCI
                      [*] Support initialization patch loading for HD-audio
                      <*> whatever audio codec your soundcard needs
                      <*> Build HDMI/DisplayPort HD-audio codec support
                  (2048) Pre-allocated buffer size for HD-audio driver
Note
When using AMD GPU, it is recommended to unset the ATI Radeon option so that the radeon module is not built. Or alternatively, the module can be built and blacklisted (after rebooting check with lsmod | grep radeon to see if the blacklisting worked). The amdgpu and radeon modules are not meant to be loaded simultaneously, unless, for example multiseat, system requires it.

The options from the Sound card support menu need only to be set if the card supports HDMI or DisplayPort audio and you want to use it. On newer kernels where Enable AMD Audio CoProcessor IP support appears, that should also be set.

See the radeon article for more details about using HDMI/DisplayPort audio.

Note
Some recent cards, such as those based on the POLARIS10/11 chipset, require AMD's DAL for HDMI/DisplayPort audio to function. It is not yet merged upstream.

Incorporating firmware

The firmware package installed in an earlier section provides files in /lib/firmware/amdgpu (for Volcanic Islands and Arctic Islands cards) and/or /lib/firmware/radeon (for Southern Islands and Sea Islands cards). Configure the kernel to use the correct firmware files by setting the following options:

KERNEL Including firmware in the kernel
Device Drivers  --->
    Generic Driver Options  --->
        -*- Userspace firmware loading support
        [*] Include in-kernel firmware blobs in kernel binary
            (amdgpu/<YOUR-MODEL>.bin or radeon/<YOUR-MODEL>.bin)
            (/lib/firmware) Firmware blobs root directory

amdgpu/<YOUR-MODEL>.bin or radeon/<YOUR-MODEL>.bin should be replaced with the full list of filenames given with the chipset's name in the table below, separated by spaces. Use echo to expand the filenames. E.g. for Volcanic Islands/TONGA, run

user $echo amdgpu/tonga_{ce,k_smc,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,uvd,vce}.bin
amdgpu/tonga_ce.bin amdgpu/tonga_k_smc.bin amdgpu/tonga_mc.bin amdgpu/tonga_me.bin amdgpu/tonga_mec2.bin amdgpu/tonga_mec.bin amdgpu/tonga_pfp.bin amdgpu/tonga_rlc.bin amdgpu/tonga_sdma1.bin amdgpu/tonga_sdma.bin amdgpu/tonga_smc.bin amdgpu/tonga_uvd.bin amdgpu/tonga_vce.bin

Then amdgpu/tonga_ce.bin amdgpu/tonga_k_smc.bin amdgpu/tonga_mc.bin amdgpu/tonga_me.bin amdgpu/tonga_mec2.bin amdgpu/tonga_mec.bin amdgpu/tonga_pfp.bin amdgpu/tonga_rlc.bin amdgpu/tonga_sdma1.bin amdgpu/tonga_sdma.bin amdgpu/tonga_smc.bin amdgpu/tonga_uvd.bin amdgpu/tonga_vce.bin is the string that should be put into the kernel configuration.

Important
If the amdgpu module is compiled as a loadable kernel module (i.e. AMD GPU in the kernel configuration is set to M), the firmware files need to be present on the filesystem at the time the module is loaded. In particular, if the module is loaded from an initrd, the firmware also needs to be included in the initrd. On the other hand, if the module is built into the kernel, the firmware files will also be built into the kernel itself.

After expanding the firmware file names from the following table and copying them into the kernel configuration, save the configuration, then compile and install the new kernel and modules.

Family Chipset name Product name Firmware
Southern Islands CAPE VERDE HD7750, HD7770, R7 250, R7 250X, R9 370X radeon/{verde_{ce,mc,me,pfp,rlc,smc},TAHITI_{uvd,vce}}.bin
PITCAIRN HD7800, R9 270X radeon/{pitcairn_{ce,mc,me,pfp,rlc,smc,k_smc},TAHITI_{uvd,vce}}.bin
TAHITI HD7870 XT, HD7900, R9 280X radeon/{tahiti_{ce,mc,me,pfp,rlc,smc},TAHITI_{uvd,vce}}.bin
OLAND HD8550M-HD8790M, R7 240 radeon/{oland_{ce,mc,me,pfp,rlc,smc},TAHITI_uvd}.bin
HAINAN HD8970M radeon/{hainan_{ce,mc,me,pfp,rlc,smc},TAHITI_uvd}.bin
Sea Islands BONAIRE HD7790, R7 260, R7 260X, R7 360 radeon/bonaire_{ce,k_smc,mc,me,mec,pfp,rlc,sdma1,sdma,smc,uvd,vce}.bin
KABINI HD8180-HD8400 radeon/kabini_{ce,me,mec,pfp,rlc,sdma1,sdma,uvd,vce}.bin
KAVERI radeon/kaveri_{ce,me,mec2,mec,pfp,rlc,sdma1,sdma,uvd,vce}.bin
HAWAII R9 290, R9 290X, R9 390, R9 390X radeon/hawaii_{ce,k_smc,mc,me,mec,pfp,rlc,sdma,sdma1,smc,uvd,vce}.bin
MULLINS radeon/mullins_{ce,me,mec,pfp,rlc,sdma1,sdma,uvd,vce}.bin
Volcanic Islands CARRIZO amdgpu/carrizo_{ce,me,mec2,mec,pfp,rlc,sdma1,sdma,uvd,vce}.bin
FIJI R9 Fury, R9 Fury X, R9 Nano, Pro Duo amdgpu/fiji_{ce,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,uvd,vce}.bin
TONGA R9 285, R9 380, R9 380X amdgpu/tonga_{ce,k_smc,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,uvd,vce}.bin
TOPAZ R7 M260, R7 M265, R7 M340, R7 M360, R7 M360, R7 M370, R7 M440, R7 M445, R7 M460, R7 M465 amdgpu/topaz_{ce,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc}.bin
STONEY amdgpu/stoney_{ce,me,mec,pfp,rlc,sdma,uvd,vce}.bin
Arctic Islands POLARIS10 RX 470, RX 480 amdgpu/polaris10_{ce,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,smc_sk,uvd,vce}.bin
POLARIS11 RX 460 amdgpu/polaris11_{ce,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,smc_sk,uvd,vce}.bin

X11 driver

USE flags

Set the USE flags for the amdgpu driver as needed.

USE flags for x11-drivers/xf86-video-amdgpu Accelerated Open Source driver for AMDGPU cards

glamor Enable Glamor OpenGL 2D acceleration local

The package will be automatically emerged as a dependency of x11-base/xorg-drivers after setting VIDEO_CARDS following the instructions in the next section.

Emerge

Portage uses the VIDEO_CARDS variable for enabling support for various graphics cards in packages. Setting VIDEO_CARDS to amdgpu radeonsi (see the feature matrix section above) and asking Portage to update changed USE flags in the @world set will pull in the correct driver:

FILE /etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi"
root #emerge --ask --changed-use @world

The system should now be prepared to use amdgpu after the next reboot.

Power management

Note
This section only covers dpm method. This method is only available for GPUs from R6xx -series onwards. Users of AMDGPU driver are thus automatically covered. Older dynpm and profile methods aren't covered here. Users who want to read about those should read radeon article instead.
Important
This section assumes that card0 is the GPU users want to adjust. Users should check that paths like /sys/class/drm/card0/ belong to the right GPU. Users with more than one GPU will most likely have more than just card0 entry under said locations.

dpm

In most cases since Linux 3.13 dpm is the default power management method. Unlike with dynpm and profile methods enabling or disabling dpm must be done via kernel command line. Users who have GPUs older than HD5000 -series may need to add radeon.dpm=1 on kernel command line to enable dpm.

In most cases just enabling dpm is enough but there are some tunable settings. dpm has three main modes of operating: battery, balanced and performance. The names are quite self-explanatory. To set the GPU to most performant mode the following command is needed to run:

root #echo performance > /sys/class/drm/card0/device/power_dpm_state

Even if GPU is set to performance -mode it does not mean that the GPU is running with highest clockspeeds at all the time. This is the normal and intended way how dpm works. If it is desirable to run the GPU at the highest speeds all the time, even if there is no actual load, users can then run following command:

root #echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level

This manually overrides dpm's own bahaviour. This is however mainly intended for testing purposes but may also be useful when doing GPU benchmanks.

To give control back to dpm following command is needed to run:

root #echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level
Note
There's also the low forceable performance level, which can be echoed the same way.

Troubleshooting

Kernel

Older kernels which do not support the amdgpu driver will not provide the AMD GPU option. If this is the case, try emerging an unstable (denoted by a ~) kernel.

AMDGPU/RadeonSI drivers do not work

If the graphics card is not supported by including amdgpu and radeonsi alone in VIDEO_CARDS, try adding radeon to make.conf's VIDEO_CARDS definition. For example:

FILE /etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi radeon"

After the values have been set update the system so the changes take effect:

root #emerge --ask --changed-use --deep @world

Full-screen windows perform poorly

The installed version of sys-devel/llvm may be too old. Try emerging an unstable version.

Audio through HDMI does not work

AMDGPU does not currently support audio through HDMI/Display Port on kernel 4.9 due to the Display Abstraction Layer 3 (DAL3), AMD's new driver abstraction layer, not having been merged into the mainline kernel.

Pixel-wide line on left side of screen when X server is started when using a Southern Island card

Those using a Southern Island card may notice a pixel-wide line on the left of the screen in both the X server and console environments after having started a X server. This is a known bug. Disabling audio through HDMI for that display resolves this issue. This may be done via:

user $xrandr --output HDMI-A-0 --auto --no-audio

where HDMI-A-0 should be replaced by the name of the output, obtained by running xrandr.

For more information please see https://bugs.freedesktop.org/show_bug.cgi?id=97861.

See also

  • AMDGPU-PRO — the next generation closed source graphics component that operates on top of the open source AMDGPU drivers for newer AMD/ATI Radeon graphics cards.

External resources