Difference between revisions of "AMDGPU"

From ArchWiki
Jump to navigation Jump to search
(flagged broken section links (interactive))
Tag: wiki-scripts
 
(75 intermediate revisions by 25 users not shown)
Line 3: Line 3:
 
[[de:AMDGPU]]
 
[[de:AMDGPU]]
 
[[ja:AMDGPU]]
 
[[ja:AMDGPU]]
[[ru:AMDGPU]]
+
[[zh-hans:AMDGPU]]
 
{{Related articles start}}
 
{{Related articles start}}
 
{{Related|AMD Catalyst}}
 
{{Related|AMD Catalyst}}
Line 11: Line 11:
 
{{Related articles end}}
 
{{Related articles end}}
  
'''amdgpu''' is the open source graphics driver for the latest AMD Radeon graphics cards.
+
[[Wikipedia:AMDGPU|AMDGPU]] is the open source graphics driver for the latest AMD Radeon graphics cards.
  
At the moment there is support for [https://www.x.org/wiki/RadeonFeature/ Volcanic Islands (VI) and newer] and experimental support for [https://www.phoronix.com/scan.php?page=news_item&px=AMD-AMDGPU-Released Sea Islands (CI)] and [https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-SI-Experimental-Code Southern Islands (SI)] cards. AMD has absolutely no plans for supporting the pre-GCN GPUs.
+
== Selecting the right driver ==
  
Owners of unsupported AMD/ATI video cards may use the [[ATI|Radeon open source]] or [[AMD Catalyst|AMD's proprietary]] driver instead.
+
Depending on the card you have, find the right driver in [[Xorg#AMD]]. This page has instructions for '''AMDGPU''' and '''AMDGPU PRO'''.
  
== Selecting the right driver ==
+
At the moment there is support for [https://www.x.org/wiki/RadeonFeature/ Volcanic Islands (VI)] (and newer) and experimental support for [https://www.phoronix.com/scan.php?page=news_item&px=AMD-AMDGPU-Released Sea Islands (CI)] and [https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-SI-Experimental-Code Southern Islands (SI)] cards. AMD has no plans to support pre-GCN GPUs.
  
Depending on the card you have, find the right driver in [[Xorg#AMD]]. This page has instructions for '''AMDGPU''' and '''AMDGPU PRO'''.
+
Owners of unsupported GPUs may use the open source [[radeon]] or the [[AMD Catalyst]] driver instead.
  
 
== Installation ==
 
== Installation ==
Line 31: Line 31:
 
* For [[Vulkan]] support, install the {{Pkg|vulkan-radeon}} package. Optionally install the {{Pkg|lib32-vulkan-radeon}} package for 32-bit application support.
 
* For [[Vulkan]] support, install the {{Pkg|vulkan-radeon}} package. Optionally install the {{Pkg|lib32-vulkan-radeon}} package for 32-bit application support.
  
Support for [[#Enabling video acceleration|accelerated video decoding]]{{Broken section link}} is provided by {{Pkg|libva-mesa-driver}} and {{Pkg|lib32-libva-mesa-driver}} or {{Pkg|libva-vdpau-driver}} for VA-API and {{Pkg|mesa-vdpau}} and {{Pkg|lib32-mesa-vdpau}} packages for VDPAU.
+
Support for [[#Video acceleration|accelerated video decoding]] is provided by {{Pkg|libva-mesa-driver}} and {{Pkg|lib32-libva-mesa-driver}} for VA-API and {{Pkg|mesa-vdpau}} and {{Pkg|lib32-mesa-vdpau}} packages for VDPAU.
 +
 
 +
=== Experimental ===
 +
 
 +
It may be worthwhile for some users to use the upstream experimental build of mesa, to enable features such as ACO or for AMD Navi improvements that haven't landed in the standard mesa packages.
 +
 
 +
Install the {{AUR|mesa-git}} package, which provides the DRI driver for 3D acceleration.
 +
 
 +
* For 32-bit application support, also install the {{AUR|lib32-mesa-git}} package from the ''mesa-git'' repository or the [[AUR]].
 +
* For the DDX driver (which provides 2D acceleration in [[Xorg]]), install the {{AUR|xf86-video-amdgpu-git}} package.
 +
* For [[Vulkan]] support using the ''mesa-git'' repository below, install the ''vulkan-radeon-git'' package. Optionally install the ''lib32-vulkan-radeon-git'' package for 32-bit application support. This shouldn't be required if building {{AUR|mesa-git}} from the AUR.
 +
 
 +
{{Note|It may be necessary to symlink LibLLVM for X to start. eg. ln -s /usr/lib/libLLVM-10git.so /usr/lib/libLLVM-10svn.so}}
 +
 
 +
{{Tip|Users who do not wish to go through the process of compiling the {{AUR|mesa-git}} package can use the [[Unofficial user repositories#mesa-git|mesa-git]] unofficial repository.}}
  
 
=== Enable Southern Islands (SI) and Sea Islands (CIK) support ===
 
=== Enable Southern Islands (SI) and Sea Islands (CIK) support ===
 +
 
The {{Pkg|linux}} package enables AMDGPU support for cards of the Southern Islands (SI) and Sea Islands (CIK). When building or compiling a [[kernel]], {{ic|1=CONFIG_DRM_AMDGPU_SI=Y}} and/or {{ic|1=CONFIG_DRM_AMDGPU_CIK=Y}} should be be set in the config.
 
The {{Pkg|linux}} package enables AMDGPU support for cards of the Southern Islands (SI) and Sea Islands (CIK). When building or compiling a [[kernel]], {{ic|1=CONFIG_DRM_AMDGPU_SI=Y}} and/or {{ic|1=CONFIG_DRM_AMDGPU_CIK=Y}} should be be set in the config.
  
Even when AMDGPU support for SI/CIK has been enabled by the kernel, the [[radeon]] driver may be used instead of the AMDGPU driver.
+
==== Specify the correct module order ====
 +
 
 +
Even when AMDGPU support for SI/CIK has been enabled by the kernel, the [[radeon]] driver may be loaded before the {{ic|amdgpu}} driver.
  
To make sure the {{ic|amdgpu}} is loaded first use the following [[Mkinitcpio#MODULES]] array, e.g. {{ic|1=MODULES=(amdgpu radeon)}}.
+
Make sure {{ic|amdgpu}} has been set as first module in the [[Mkinitcpio#MODULES]] array, e.g. {{ic|1=MODULES=(amdgpu radeon)}}.
  
 
==== Set required module parameters ====
 
==== Set required module parameters ====
  
To enable full support for SI/CIK when using the {{ic|amdgpu}}, set the following [[kernel parameters]] to prevent the {{ic|radeon}} module from being used [http://www.phoronix.com/scan.php?page=article&item=linux-413-gcn101&num=1]:
+
The [[module parameters]] of both {{ic|amdgpu}} and {{ic|radeon}} modules are {{ic|1=cik_support=}} and {{ic|1=si_support=}}.
 +
 
 +
They need to be set as kernel parameters or in a ''modprobe'' configuration file, and depend on the cards GCN version.
 +
 
 +
{{Tip|[[dmesg]] may indicate the correct kernel parameter to use: {{ic|1=[..] amdgpu 0000:01:00.0: Use radeon.cik_support=0 amdgpu.cik_support=1 to override}}.}}
 +
 
 +
===== Set module parameters in kernel command line =====
  
{{hc|$ dmesg|2=
+
Set one of the following [[kernel parameters]]:
[..] amdgpu 0000:01:00.0: CIK support provided by radeon.
 
[..] amdgpu 0000:01:00.0: Use radeon.cik_support=0 amdgpu.cik_support=1 to override.
 
}}
 
  
The flags depend on the cards GCN version:
 
 
* Southern Islands (SI): {{ic|1=radeon.si_support=0 amdgpu.si_support=1}}
 
* Southern Islands (SI): {{ic|1=radeon.si_support=0 amdgpu.si_support=1}}
 
* Sea Islands (CIK): {{ic|1=radeon.cik_support=0 amdgpu.cik_support=1}}
 
* Sea Islands (CIK): {{ic|1=radeon.cik_support=0 amdgpu.cik_support=1}}
  
=== AMD DC ===
+
===== Set module parameters in modprobe.d =====
AMD DC (display code), introduced in {{Pkg|linux}} 4.15-4.17, is a new display stack that brings support for atomic mode-setting and HDMI/DP audio.
+
 
For more info about AMDGPU-DC, see [https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-DC-Accepted this article].
+
Create the configuration [[modprobe]] files in {{ic|/etc/modprobe.d/}}, see {{man|5|modprobe.d}} for syntax details.
 +
 
 +
For Southern Islands (SI) use option {{ic|1=si_support=1}}, for Sea Islands (CIK) use option {{ic|1=cik_support=1}}, e.g.:
  
If you are on GCN 1.1 or newer with AMDGPU and want to use DC, set {{ic|1=amdgpu.dc=1}} as [[kernel parameter]] or [[Kernel_module#Setting_module_options|module option]] when using [[KMS]].
+
{{hc|/etc/modprobe.d/amdgpu.conf|2=
 +
options amdgpu si_support=1
 +
options amdgpu cik_support=0
 +
}}
 +
 
 +
{{hc|/etc/modprobe.d/radeon.conf|2=
 +
options radeon si_support=0
 +
options radeon cik_support=0
 +
}}
 +
 
 +
Make sure {{ic|modconf}} is in the the {{ic|HOOKS}} array in {{ic|/etc/mkinitcpio.conf}} and [[regenerate the initramfs]].
  
 
=== AMDGPU PRO ===
 
=== AMDGPU PRO ===
{{Warning|Arch Linux is officially not supported.}}
 
{{Note|
 
*To use the proprietary OpenCL component without AMDGPU PRO, [[install]] {{AUR|opencl-amd}} instead.
 
*A [[downgrade]] of the {{pkg|linux}} (4.9) and [[Xorg]] (1.18) packages is required to use AMDGPU PRO 17.10.
 
}}
 
  
AMD provides a proprietary, binary userland driver called ''AMDGPU PRO'', which works on top of the open-source AMDGPU kernel driver. The driver provides OpenGL, [[OpenCL]], [[Vulkan]] and [[VDPAU]] support (although this is also supported by the open-source driver). For some workloads it provides better performance than the open-source driver ([https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-PRO-16.40-Deus-MD example benchmark]), while for others the contrary is true ([https://openbenchmarking.org/prospect/1610315-TA-AMDGPUPRO08/998ba9b677230564e0fbca342a8e1b9a7e85b6ab example benchmark]).
+
AMD provides a proprietary, binary userland driver called ''AMDGPU PRO'', which works on top of the open-source AMDGPU kernel driver.
 +
 
 +
From [http://www.phoronix.com/vr.php?view=27266 Radeon Software 18.50 vs Mesa 19 benchmarks] article: When it comes to OpenGL games, the RadeonSI Gallium3D driver simply dominates the proprietary AMD OpenGL driver. About the only advantage to the closed-source AMD OpenGL driver is its support for GL 4.6 while RadeonSI is still limited to GL 4.5 until its SPIR-V ingestion support is completed.
 +
 
 +
Install the {{AUR|amdgpu-pro-libgl}}. Optionally install the {{AUR|lib32-amdgpu-pro-libgl}} package for 32-bit application support.
 +
 
 +
=== ACO compiler ===
 +
 
 +
[https://steamcommunity.com/games/221410/announcements/detail/1602634609636894200 ACO] is an open-source shader compiler developed by [[wikipedia:Valve_Corporation|Valve]] to directly compete with [http://llvm.org/ LLVM] and [[Wikipedia:Windows 10|Windows 10]]. It offers lesser compilation time and also provides more FPS (sources from [https://itsfoss.com/linux-games-performance-boost-amd-gpu/ It's FOSS], [https://www.forbes.com/sites/jasonevangelho/2019/07/17/these-windows-10-vs-pop-os-benchmarks-reveal-a-surprising-truth-about-linux-gaming-performance/#d5e808c5e747 Forbes] and [https://www.phoronix.com/scan.php?page=article&item=radv-aco-llvm&num=1 Phoronix]).
  
See the [https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx release notes] and the [https://www.phoronix.com/forums/forum/linux-graphics-x-org-drivers/amd-linux/855699-amd-representative-says-their-vulkan-linux-driver-will-be-here-soon/page6 announcement at the Phoronix forum] for more information.
+
{{Warning|ACO is a very early development and still is marked as '''testing''', you may experience issues.}}
  
A patched version of the official AMDGPU PRO driver is available as {{AUR|amdgpu-pro}} in [[AUR]].
+
Support for ACO is currently only available in {{AUR|mesa-git}} and can be enable by exporting {{ic|1=RADV_PERFTEST=aco}} before starting an application.
  
 
== Loading ==
 
== Loading ==
Line 85: Line 119:
 
=== Enable early KMS ===
 
=== Enable early KMS ===
  
{{Tip|If you have problems with the resolution, [[Kernel mode setting#Forcing modes and EDID]] may help.}}
+
See [[Kernel mode setting#Early KMS start]].
 
 
[[Kernel mode setting]] (KMS) is supported by the amdgpu driver, is mandatory and enabled by default.
 
 
 
KMS is typically initialized after the [[Arch boot process#initramfs|initramfs stage]]. It is possible, however, to enable KMS during the initramfs stage. To do this, add the {{ic|amdgpu}} module to the {{ic|MODULES}} line in {{ic|/etc/mkinitcpio.conf}}:
 
 
 
MODULES=(amdgpu radeon)
 
 
 
Now, regenerate the initramfs:
 
 
 
# mkinitcpio -p linux
 
 
 
The change takes effect at the next reboot.
 
  
 
== Xorg configuration ==
 
== Xorg configuration ==
Line 106: Line 128:
  
 
{{hc|/etc/X11/xorg.conf.d/20-amdgpu.conf|2=
 
{{hc|/etc/X11/xorg.conf.d/20-amdgpu.conf|2=
Section "Device"
+
Section "Device"
 
     Identifier "AMD"
 
     Identifier "AMD"
 
     Driver "amdgpu"
 
     Driver "amdgpu"
EndSection
+
EndSection
 
}}
 
}}
  
 
Using this section, you can enable features and tweak the driver settings, see {{man|4|amdgpu}} first before setting driver options.
 
Using this section, you can enable features and tweak the driver settings, see {{man|4|amdgpu}} first before setting driver options.
  
=== Tear Free Rendering ===
+
=== Tear free rendering ===
''TearFree'' controls tearing prevention using the hardware page flipping mechanism. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option isn't set, the default value of the property is auto, which means that TearFree is on for rotated outputs, outputs with RandR transforms applied and for RandR 1.4 slave outputs, otherwise off:
+
 
 +
''TearFree'' controls tearing prevention using the hardware page flipping mechanism. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option is not set, the default value of the property is auto, which means that TearFree is on for rotated outputs, outputs with RandR transforms applied and for RandR 1.4 slave outputs, otherwise off:
  
 
  Option "TearFree" "true"
 
  Option "TearFree" "true"
 +
 +
You can also enable TearFree temporarily with [[xrandr]]:
 +
 +
# xrandr --output ''output'' --set TearFree on
  
 
=== DRI level ===
 
=== DRI level ===
Line 123: Line 150:
 
''DRI'' sets  the maximum level of DRI to enable. Valid values are ''2'' for DRI2 or ''3'' for DRI3. The default is ''3'' for DRI3 if the [[Xorg]] version is >=  1.18.3, otherwise DRI2 is used:
 
''DRI'' sets  the maximum level of DRI to enable. Valid values are ''2'' for DRI2 or ''3'' for DRI3. The default is ''3'' for DRI3 if the [[Xorg]] version is >=  1.18.3, otherwise DRI2 is used:
  
  Option "DRI" "3"  
+
  Option "DRI" "3"
 +
 
 +
=== Variable refresh rate ===
 +
 
 +
See [[Variable refresh rate]].
  
 
== Features ==
 
== Features ==
 +
 
=== Video acceleration ===
 
=== Video acceleration ===
  
 
See [[Hardware video acceleration]].
 
See [[Hardware video acceleration]].
 +
 +
=== Monitoring ===
 +
 +
Monitoring your GPU is often used to check the temperature and also the P-states of your GPU.
 +
 +
==== CLI (default) ====
 +
 +
To check your GPU's P-states, execute:
 +
# cat /sys/class/drm/card0/device/pp_od_clk_voltage
 +
To monitor your GPU, execute:
 +
# watch -n 0.5  cat /sys/kernel/debug/dri/0/amdgpu_pm_info
 +
 +
==== GUI ====
 +
 +
* {{App|WattmanGTK|A GTK GUI tool to monitor your GPU's temperatures P-states|https://github.com/BoukeHaarsma23/WattmanGTK|{{AUR|wattman-gtk-git}}}}.
 +
* {{App|TuxClocker|A Qt5 monitoring and overclocking tool.|https://github.com/Lurkki14/tuxclocker|{{AUR|tuxclocker}} {{AUR|tuxclocker-git}}}}
  
 
=== Overclocking ===
 
=== Overclocking ===
  
Since Linux 4.17, it is possible to adjust clocks and voltages of the graphics card via {{Ic|1=/sys/class/drm/card0/device/pp_od_clk_voltage}}. It is however required to unlock access to it in sysfs by appending the boot parameter {{Ic|1=amdgpu.ppfeaturemask=0xffffffff}}.
+
Since Linux 4.17, it is possible to adjust clocks and voltages of the graphics card via {{Ic|1=/sys/class/drm/card0/device/pp_od_clk_voltage}}.
 +
 
 +
==== Boot parameter ====
 +
 
 +
It is required to unlock access to adjust clocks and voltages in sysfs by appending the [[Kernel parameter]] {{Ic|1=amdgpu.ppfeaturemask=0xfffd7fff}}.
 +
 
 +
==== Manual (default) ====
  
After this, the range of allowed values must be increased to allow higher clocks than used by default. To allow the maximum GPU clock to be increased by e.g. up to 2%, run:
+
{{Note|In sysfs, paths like {{Ic|1=/sys/class/drm/...}} are just symlinks and may change between reboots. Persistent locations can be found in {{Ic|1=/sys/devices/}}, e.g. {{Ic|1=/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/}}. Adjust the commands accordingly for a reliable result.}}
echo "2" > /sys/class/drm/card0/device/pp_sclk_od
 
{{Note|Running cat {{Ic|/sys/class/drm/card0/device/pp_sclk_od}} does always return either 1 or 0, no matter the value added to it via {{Ic|echo}}.}}
 
Unlike with previous kernel versions, this alone doesn't lead to a higher clock. The values in {{Ic|pp_od_clk_voltage}} for the pstates have to be adjusted as well. It's a good idea to get the default values as a guidance by simply reading the file. In this example, the default clock is 1196MHz and a range increase by 2% allows up to 1219MHz.
 
  
To set the GPU clock for the maximum pstate 7 on a Polaris GPU to 1209MHz and 900mV voltage, run:
+
To set the GPU clock for the maximum P-state 7 on e.g. a Polaris GPU to 1209MHz and 900mV voltage, run:
 
  # echo "s 7 1209 900" > /sys/class/drm/card0/device/pp_od_clk_voltage
 
  # echo "s 7 1209 900" > /sys/class/drm/card0/device/pp_od_clk_voltage
 +
The same procedure can be applied to the VRAM, e.g. maximum P-state 2 on Polaris 5xx series cards:
 +
# echo "m 2 1850 850" > /sys/class/drm/card0/device/pp_od_clk_voltage
 
{{Warning|1=Double check the entered values, as mistakes might instantly cause fatal hardware damage!}}
 
{{Warning|1=Double check the entered values, as mistakes might instantly cause fatal hardware damage!}}
 
To apply, run
 
To apply, run
Line 148: Line 201:
 
You can reset to the default values using this:
 
You can reset to the default values using this:
 
  # echo "r" > /sys/class/drm/card0/device/pp_od_clk_voltage
 
  # echo "r" > /sys/class/drm/card0/device/pp_od_clk_voltage
 +
 +
It is also possible to forbid the driver so switch to certain P-states, e.g. to workaround problems with deep powersaving P-states like flickering artifacts or stutter. To force the highest VRAM P-state on a Polaris RX 5xx card, while still allowing the GPU itself to run with lower clocks, run:
 +
# echo "manual" > /sys/class/drm/card0/device/power_dpm_force_performance_level
 +
# echo "2" >  /sys/class/drm/card0/device/pp_dpm_mclk
 +
Allow only the three highest GPU P-states:
 +
# echo "5 6 7" >  /sys/class/drm/card0/device/pp_dpm_sclk
  
 
To set the allowed maximum power consumption of the GPU to e.g. 50 Watts, run
 
To set the allowed maximum power consumption of the GPU to e.g. 50 Watts, run
 
  # echo 50000000 > /sys/class/drm/card0/device/hwmon/hwmon0/power1_cap
 
  # echo 50000000 > /sys/class/drm/card0/device/hwmon/hwmon0/power1_cap
If the video card bios doesn't provide a maximum value above the default setting, you can only decrease the power limit, but not increase.
+
Until Linux kernel 4.20, it will only be possible to decrease the value, not increase.
  
 
{{Note|The above procedure was tested with a Polaris RX 560 card. There may be different behavior or bugs with different GPUs.}}
 
{{Note|The above procedure was tested with a Polaris RX 560 card. There may be different behavior or bugs with different GPUs.}}
 +
 +
==== Assisted ====
 +
 +
If you are not inclined to fully manually overclock your GPU, there are some overclocking tools that are offered by the community to assist you to overclock and monitor your AMD GPU.
 +
 +
===== CLI tools =====
 +
 +
* {{App|amdgpu-clocks|A script that can be used to monitor and set custom power states for AMD GPUs. It also offers a Systemd service to apply the settings automatically upon boot.|https://github.com/sibradzic/amdgpu-clocks|{{AUR|amdgpu-clocks-git}}}}
 +
 +
===== GUI tools =====
 +
 +
* {{App|TuxClocker|A Qt5 monitoring and overclocking tool.|https://github.com/Lurkki14/tuxclocker|{{AUR|tuxclocker}} {{AUR|tuxclocker-git}}}}
 +
* {{App|CoreCtrl|A GUI overclocking tool with a WattMan-like UI that supports per-application profiles.|https://gitlab.com/corectrl/corectrl|{{AUR|corectrl}} {{AUR|corectrl-git}}}}
 +
 +
==== Startup on boot ====
 +
 +
If you want your settings to apply automatically upon boot, consider looking at this [https://www.reddit.com/r/Amd/comments/agwroj/how_to_overclock_your_amd_gpu_on_linux/ Reddit thread] to configure and apply your settings on boot.
  
 
=== Enable GPU display scaling ===
 
=== Enable GPU display scaling ===
Line 160: Line 236:
  
 
To avoid the usage of the scaler which is built in the display, and use the GPU own scaler instead, when not using the native resolution of the monitor, execute:
 
To avoid the usage of the scaler which is built in the display, and use the GPU own scaler instead, when not using the native resolution of the monitor, execute:
  $ xrandr --output "<output>" --set "scaling mode" "<scaling mode>"
+
  $ xrandr --output ''output'' --set "scaling mode" ''scaling_mode''
Possible values for {{ic|"scaling mode"}} are: {{ic|None, Full, Center, Full aspect}}
+
Possible values for {{ic|"scaling mode"}} are: {{ic|None}}, {{ic|Full}}, {{ic|Center}}, {{ic|Full aspect}}.
  
 
* To show the available outputs and settings, execute:
 
* To show the available outputs and settings, execute:
Line 171: Line 247:
 
== Troubleshooting ==
 
== Troubleshooting ==
  
=== Xorg or applications won't start ===
+
=== Xorg or applications will not start ===
  
 
* "(EE) AMDGPU(0): [DRI2] DRI2SwapBuffers: drawable has no back or front?" error after opening glxgears, can open Xorg server but OpenGL apps crash.
 
* "(EE) AMDGPU(0): [DRI2] DRI2SwapBuffers: drawable has no back or front?" error after opening glxgears, can open Xorg server but OpenGL apps crash.
* "(EE) AMDGPU(0): Given depth (32) is not supported by amdgpu driver" error, Xorg won't start.
+
* "(EE) AMDGPU(0): Given depth (32) is not supported by amdgpu driver" error, Xorg will not start.
  
 
Setting the screen's depth under Xorg to 16 or 32 will cause problems/crash. To avoid that, you should use a standard screen depth of 24 by adding this to your "screen" section:
 
Setting the screen's depth under Xorg to 16 or 32 will cause problems/crash. To avoid that, you should use a standard screen depth of 24 by adding this to your "screen" section:
Line 196: Line 272:
 
There is also a GUI solution [https://github.com/marazmista/radeon-profile] where you can manage the "power_dpm" with {{aur|radeon-profile-git}} and {{aur|radeon-profile-daemon-git}}.
 
There is also a GUI solution [https://github.com/marazmista/radeon-profile] where you can manage the "power_dpm" with {{aur|radeon-profile-git}} and {{aur|radeon-profile-daemon-git}}.
  
=== Screen flickering ===
+
=== R9 390 series poor performance and/or instability ===
 +
 
 +
If you experience issues [https://bugs.freedesktop.org/show_bug.cgi?id=91880] with a AMD R9 390 series graphics card, set {{ic|1=radeon.cik_support=0 radeon.si_support=0 amdgpu.cik_support=1 amdgpu.si_support=1 amdgpu.dpm=1 amdgpu.dc=1}} as [[kernel parameters]] to force the use of amdgpu driver instead of radeon.
 +
 
 +
If it still does not work, try disabling DPM, by setting the [[kernel parameters]] to: {{ic|1=radeon.cik_support=0 radeon.si_support=0 amdgpu.cik_support=1 amdgpu.si_support=1}}
 +
 
 +
=== Freezes with "[drm] IP block:gmc_v8_0 is hung!" kernel error ===
 +
 
 +
If you experience freezes and kernel crashes during a GPU intensive task with the kernel error " [drm] IP block:gmc_v8_0 is hung!" [https://bugs.freedesktop.org/show_bug.cgi?id=102322], a workaround is to set {{ic|1=amdgpu.vm_update_mode=3}} as [[kernel parameters]] to force the GPUVM page tables update to be done using the CPU. Downsides are listed here [https://bugs.freedesktop.org/show_bug.cgi?id=102322#c15].
 +
 
 +
=== Cursor corruption ===
 +
 
 +
If you experience issues with the mouse cursor sometimes not rendering properly, set {{ic|Option "SWCursor" "True"}} in the {{ic|"Device"}} section of the {{ic|/etc/X11/xorg.conf.d/20-amdgpu.conf}} configuration file.
  
If you experience flickering [https://bugzilla.kernel.org/show_bug.cgi?id=199101] add {{ic|1=amdgpu.dc=0}} to your kernel parameters.
+
If you are using {{ic|xrandr}} for scaling and the cursor is flickering or disappearing, you may be able to fix it by setting the {{ic|TearFree}} property: {{ic|xrandr --output HDMI-A-0 --set TearFree on}}.
  
=== R9 390 series Poor Performance and/or Instability ===
+
=== System freeze or crash when gaming on Vega cards ===
  
If you experience issues [https://bugs.freedesktop.org/show_bug.cgi?id=91880] with a AMD R9 390 series graphics card, set {{ic|1=radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dpm=1 amdgpu.dc=1}} as [[kernel parameters]] to force DPM support.
+
[[ATI#Dynamic power management|Dynamic power management]] may cause a complete system freeze whilst gaming due to issues in the way GPU clock speeds are managed. [https://bugs.freedesktop.org/show_bug.cgi?id=109955] A workaround is to disable dynamic power management, see [[ATI#Dynamic power management]] for details.
  
=== Freezes with "[drm] IP block:gmc_v8_0 is hung!" kernel error ===
+
=== Navi power consumption ===
  
If you experience freezes and kernel crashes during a GPU intensive task with the kernel error " [drm] IP block:gmc_v8_0 is hung!" [https://bugs.freedesktop.org/show_bug.cgi?id=102322], a workaround is to set {{ic|1=amggpu.vm_update_mode=3}} as [[kernel parameters]] to force the GPUVM page tables update to be done using the CPU. Downsides are listed here [https://bugs.freedesktop.org/show_bug.cgi?id=102322#c15].
+
Some users have reported higher than usual idle power consumption when using kernel 5.3. There is a [https://cgit.freedesktop.org/~agd5f/linux/tag/?h=drm-next-5.4-2019-08-30 patch set] available for kernel 5.4 that appears to fix the issues.

Latest revision as of 21:21, 7 December 2019

AMDGPU is the open source graphics driver for the latest AMD Radeon graphics cards.

Selecting the right driver

Depending on the card you have, find the right driver in Xorg#AMD. This page has instructions for AMDGPU and AMDGPU PRO.

At the moment there is support for Volcanic Islands (VI) (and newer) and experimental support for Sea Islands (CI) and Southern Islands (SI) cards. AMD has no plans to support pre-GCN GPUs.

Owners of unsupported GPUs may use the open source radeon or the AMD Catalyst driver instead.

Installation

Note: If coming from the proprietary Catalyst driver, see AMD Catalyst#Uninstallation first.

Install the mesa package, which provides the DRI driver for 3D acceleration.

Support for accelerated video decoding is provided by libva-mesa-driver and lib32-libva-mesa-driver for VA-API and mesa-vdpau and lib32-mesa-vdpau packages for VDPAU.

Experimental

It may be worthwhile for some users to use the upstream experimental build of mesa, to enable features such as ACO or for AMD Navi improvements that haven't landed in the standard mesa packages.

Install the mesa-gitAUR package, which provides the DRI driver for 3D acceleration.

  • For 32-bit application support, also install the lib32-mesa-gitAUR package from the mesa-git repository or the AUR.
  • For the DDX driver (which provides 2D acceleration in Xorg), install the xf86-video-amdgpu-gitAUR package.
  • For Vulkan support using the mesa-git repository below, install the vulkan-radeon-git package. Optionally install the lib32-vulkan-radeon-git package for 32-bit application support. This shouldn't be required if building mesa-gitAUR from the AUR.
Note: It may be necessary to symlink LibLLVM for X to start. eg. ln -s /usr/lib/libLLVM-10git.so /usr/lib/libLLVM-10svn.so
Tip: Users who do not wish to go through the process of compiling the mesa-gitAUR package can use the mesa-git unofficial repository.

Enable Southern Islands (SI) and Sea Islands (CIK) support

The linux package enables AMDGPU support for cards of the Southern Islands (SI) and Sea Islands (CIK). When building or compiling a kernel, CONFIG_DRM_AMDGPU_SI=Y and/or CONFIG_DRM_AMDGPU_CIK=Y should be be set in the config.

Specify the correct module order

Even when AMDGPU support for SI/CIK has been enabled by the kernel, the radeon driver may be loaded before the amdgpu driver.

Make sure amdgpu has been set as first module in the Mkinitcpio#MODULES array, e.g. MODULES=(amdgpu radeon).

Set required module parameters

The module parameters of both amdgpu and radeon modules are cik_support= and si_support=.

They need to be set as kernel parameters or in a modprobe configuration file, and depend on the cards GCN version.

Tip: dmesg may indicate the correct kernel parameter to use: [..] amdgpu 0000:01:00.0: Use radeon.cik_support=0 amdgpu.cik_support=1 to override.
Set module parameters in kernel command line

Set one of the following kernel parameters:

  • Southern Islands (SI): radeon.si_support=0 amdgpu.si_support=1
  • Sea Islands (CIK): radeon.cik_support=0 amdgpu.cik_support=1
Set module parameters in modprobe.d

Create the configuration modprobe files in /etc/modprobe.d/, see modprobe.d(5) for syntax details.

For Southern Islands (SI) use option si_support=1, for Sea Islands (CIK) use option cik_support=1, e.g.:

/etc/modprobe.d/amdgpu.conf
options amdgpu si_support=1
options amdgpu cik_support=0
/etc/modprobe.d/radeon.conf
options radeon si_support=0
options radeon cik_support=0

Make sure modconf is in the the HOOKS array in /etc/mkinitcpio.conf and regenerate the initramfs.

AMDGPU PRO

AMD provides a proprietary, binary userland driver called AMDGPU PRO, which works on top of the open-source AMDGPU kernel driver.

From Radeon Software 18.50 vs Mesa 19 benchmarks article: When it comes to OpenGL games, the RadeonSI Gallium3D driver simply dominates the proprietary AMD OpenGL driver. About the only advantage to the closed-source AMD OpenGL driver is its support for GL 4.6 while RadeonSI is still limited to GL 4.5 until its SPIR-V ingestion support is completed.

Install the amdgpu-pro-libglAUR. Optionally install the lib32-amdgpu-pro-libglAUR package for 32-bit application support.

ACO compiler

ACO is an open-source shader compiler developed by Valve to directly compete with LLVM and Windows 10. It offers lesser compilation time and also provides more FPS (sources from It's FOSS, Forbes and Phoronix).

Warning: ACO is a very early development and still is marked as testing, you may experience issues.

Support for ACO is currently only available in mesa-gitAUR and can be enable by exporting RADV_PERFTEST=aco before starting an application.

Loading

The amdgpu kernel module should load fine automatically on system boot.

If it does not happen, then:

Enable early KMS

See Kernel mode setting#Early KMS start.

Xorg configuration

Xorg will automatically load the driver and it will use your monitor's EDID to set the native resolution. Configuration is only required for tuning the driver.

If you want manual configuration, create /etc/X11/xorg.conf.d/20-amdgpu.conf, and add the following:

/etc/X11/xorg.conf.d/20-amdgpu.conf
Section "Device"
     Identifier "AMD"
     Driver "amdgpu"
EndSection

Using this section, you can enable features and tweak the driver settings, see amdgpu(4) first before setting driver options.

Tear free rendering

TearFree controls tearing prevention using the hardware page flipping mechanism. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option is not set, the default value of the property is auto, which means that TearFree is on for rotated outputs, outputs with RandR transforms applied and for RandR 1.4 slave outputs, otherwise off:

Option "TearFree" "true"

You can also enable TearFree temporarily with xrandr:

# xrandr --output output --set TearFree on

DRI level

DRI sets the maximum level of DRI to enable. Valid values are 2 for DRI2 or 3 for DRI3. The default is 3 for DRI3 if the Xorg version is >= 1.18.3, otherwise DRI2 is used:

Option "DRI" "3"

Variable refresh rate

See Variable refresh rate.

Features

Video acceleration

See Hardware video acceleration.

Monitoring

Monitoring your GPU is often used to check the temperature and also the P-states of your GPU.

CLI (default)

To check your GPU's P-states, execute:

# cat /sys/class/drm/card0/device/pp_od_clk_voltage

To monitor your GPU, execute:

# watch -n 0.5  cat /sys/kernel/debug/dri/0/amdgpu_pm_info

GUI

  • WattmanGTK — A GTK GUI tool to monitor your GPU's temperatures P-states
https://github.com/BoukeHaarsma23/WattmanGTK || wattman-gtk-gitAUR.
  • TuxClocker — A Qt5 monitoring and overclocking tool.
https://github.com/Lurkki14/tuxclocker || tuxclockerAUR tuxclocker-gitAUR

Overclocking

Since Linux 4.17, it is possible to adjust clocks and voltages of the graphics card via /sys/class/drm/card0/device/pp_od_clk_voltage.

Boot parameter

It is required to unlock access to adjust clocks and voltages in sysfs by appending the Kernel parameter amdgpu.ppfeaturemask=0xfffd7fff.

Manual (default)

Note: In sysfs, paths like /sys/class/drm/... are just symlinks and may change between reboots. Persistent locations can be found in /sys/devices/, e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/. Adjust the commands accordingly for a reliable result.

To set the GPU clock for the maximum P-state 7 on e.g. a Polaris GPU to 1209MHz and 900mV voltage, run:

# echo "s 7 1209 900" > /sys/class/drm/card0/device/pp_od_clk_voltage

The same procedure can be applied to the VRAM, e.g. maximum P-state 2 on Polaris 5xx series cards:

# echo "m 2 1850 850" > /sys/class/drm/card0/device/pp_od_clk_voltage
Warning: Double check the entered values, as mistakes might instantly cause fatal hardware damage!

To apply, run

# echo "c" > /sys/class/drm/card0/device/pp_od_clk_voltage

To check if it worked out, read out clocks and voltage under 3D load:

# watch -n 0.5  cat /sys/kernel/debug/dri/0/amdgpu_pm_info

You can reset to the default values using this:

# echo "r" > /sys/class/drm/card0/device/pp_od_clk_voltage

It is also possible to forbid the driver so switch to certain P-states, e.g. to workaround problems with deep powersaving P-states like flickering artifacts or stutter. To force the highest VRAM P-state on a Polaris RX 5xx card, while still allowing the GPU itself to run with lower clocks, run:

# echo "manual" > /sys/class/drm/card0/device/power_dpm_force_performance_level
# echo "2" >  /sys/class/drm/card0/device/pp_dpm_mclk

Allow only the three highest GPU P-states:

# echo "5 6 7" >  /sys/class/drm/card0/device/pp_dpm_sclk

To set the allowed maximum power consumption of the GPU to e.g. 50 Watts, run

# echo 50000000 > /sys/class/drm/card0/device/hwmon/hwmon0/power1_cap

Until Linux kernel 4.20, it will only be possible to decrease the value, not increase.

Note: The above procedure was tested with a Polaris RX 560 card. There may be different behavior or bugs with different GPUs.

Assisted

If you are not inclined to fully manually overclock your GPU, there are some overclocking tools that are offered by the community to assist you to overclock and monitor your AMD GPU.

CLI tools
  • amdgpu-clocks — A script that can be used to monitor and set custom power states for AMD GPUs. It also offers a Systemd service to apply the settings automatically upon boot.
https://github.com/sibradzic/amdgpu-clocks || amdgpu-clocks-gitAUR
GUI tools
  • TuxClocker — A Qt5 monitoring and overclocking tool.
https://github.com/Lurkki14/tuxclocker || tuxclockerAUR tuxclocker-gitAUR
  • CoreCtrl — A GUI overclocking tool with a WattMan-like UI that supports per-application profiles.
https://gitlab.com/corectrl/corectrl || corectrlAUR corectrl-gitAUR

Startup on boot

If you want your settings to apply automatically upon boot, consider looking at this Reddit thread to configure and apply your settings on boot.

Enable GPU display scaling

Tango-go-next.pngThis article or section is a candidate for moving to xrandr.Tango-go-next.png

To avoid the usage of the scaler which is built in the display, and use the GPU own scaler instead, when not using the native resolution of the monitor, execute:

$ xrandr --output output --set "scaling mode" scaling_mode

Possible values for "scaling mode" are: None, Full, Center, Full aspect.

  • To show the available outputs and settings, execute:
$ xrandr --prop
  • To set scaling mode = Full aspect for just every available output, execute:
$ for output in $(xrandr --prop | grep -E -o -i "^[A-Z\-]+-[0-9]+"); do xrandr --output "$output" --set "scaling mode" "Full aspect"; done

Troubleshooting

Xorg or applications will not start

  • "(EE) AMDGPU(0): [DRI2] DRI2SwapBuffers: drawable has no back or front?" error after opening glxgears, can open Xorg server but OpenGL apps crash.
  • "(EE) AMDGPU(0): Given depth (32) is not supported by amdgpu driver" error, Xorg will not start.

Setting the screen's depth under Xorg to 16 or 32 will cause problems/crash. To avoid that, you should use a standard screen depth of 24 by adding this to your "screen" section:

/etc/X11/xorg.conf.d/10-screen.conf
Section "Screen"
       Identifier     "Screen"
       DefaultDepth    24
       SubSection      "Display"
               Depth   24
       EndSubSection
EndSection

Screen artifacts and frequency problem

Dynamic power management may cause screen artifacts to appear when displaying to monitors at higher frequencies (120+Hz) due to issues in the way GPU clock speeds are managed[1][2].

A workaround [3] is saving high or low in /sys/class/drm/card0/device/power_dpm_force_performance_level.

There is also a GUI solution [4] where you can manage the "power_dpm" with radeon-profile-gitAUR and radeon-profile-daemon-gitAUR.

R9 390 series poor performance and/or instability

If you experience issues [5] with a AMD R9 390 series graphics card, set radeon.cik_support=0 radeon.si_support=0 amdgpu.cik_support=1 amdgpu.si_support=1 amdgpu.dpm=1 amdgpu.dc=1 as kernel parameters to force the use of amdgpu driver instead of radeon.

If it still does not work, try disabling DPM, by setting the kernel parameters to: radeon.cik_support=0 radeon.si_support=0 amdgpu.cik_support=1 amdgpu.si_support=1

Freezes with "[drm] IP block:gmc_v8_0 is hung!" kernel error

If you experience freezes and kernel crashes during a GPU intensive task with the kernel error " [drm] IP block:gmc_v8_0 is hung!" [6], a workaround is to set amdgpu.vm_update_mode=3 as kernel parameters to force the GPUVM page tables update to be done using the CPU. Downsides are listed here [7].

Cursor corruption

If you experience issues with the mouse cursor sometimes not rendering properly, set Option "SWCursor" "True" in the "Device" section of the /etc/X11/xorg.conf.d/20-amdgpu.conf configuration file.

If you are using xrandr for scaling and the cursor is flickering or disappearing, you may be able to fix it by setting the TearFree property: xrandr --output HDMI-A-0 --set TearFree on.

System freeze or crash when gaming on Vega cards

Dynamic power management may cause a complete system freeze whilst gaming due to issues in the way GPU clock speeds are managed. [8] A workaround is to disable dynamic power management, see ATI#Dynamic power management for details.

Navi power consumption

Some users have reported higher than usual idle power consumption when using kernel 5.3. There is a patch set available for kernel 5.4 that appears to fix the issues.