AMDGPU/ja

AMDGPU は、Article description::Vega GPU および Raven Ridge GPU のための、Display Core (DC) フレームワークを利用した、次世代ファミリのオープンソースグラフィックスドライバです. しかしながら、GCN1.0+ ベースの比較的新しい AMD/ATI Radeon グラフィックスカード、具体的には Southern Islands、Sea Islands、Volcanic Islands、および Arctic Islands チップセットも処理することができます.

対象のカードが以下のセクションに無い場合は、そのカードは AMDGPU によってサポートされていません. その場合は、古いオープンソース AMD/ATI Radeon グラフィックスカードドライバの使用方法を含む、 の記事を確認してください.

カーネル 4.15 になるまで、Display Core (DC. Display Abstraction Layer (DAL) によって開発されました) はバニラカーネルソースには含まれていなかったため、AMDGPU はグラフィックス出力を VEGA 以降のチップ上のモニタに提供することができませんでした.

インストール
AMDGPU を使用するようにシステムを設定するには、適切なカードを識別し、対応するファームウェアをインストールし、カーネルを設定し、X11 ドライバをインストールする必要があります.

ハードウェア検出
正しいドライバを見つけるためにはまず、グラフィックスカードを検出してください. そのためには を使用してください:

下の表に列挙されている製品名のいずれかが含まれているか、出力を確認してください.

機能サポート
AMDGPU ドライバによってサポートされているビデオコアは、OpenGL 4.6 および OpenGL ES 3.2 に対応しています. 変数は  に設定する必要があります. (バージョン 20.0 以降) を利用することで、ドライバはさらに (  ドライバ) をサポートすることができ、 2.0 も   を介して利用できます. を利用した と  へのサポートもあります.


 * A AMD previously called the microarchitecture Display Core (DC). GCN stands for Graphics Core Next and was introduced with the Radeon HD7000 series (GCN1.0). It was superseded by RDNA, short for Radeon DNA, introduced with the Radeon RX 5000 series (NAVI) in 2019.
 * B The actual Instruction Set Architecture (ISA) is defined by the Display Core Engine (DCE), which was superseded by Display Core Next (DCN), introduced with the Raven Ridge APUs (mobile Vega graphics core).
 * 1 Experimental, optional support since kernel 4.9-rc1. Stable support for GCN1.x can be found in the older driver.
 * 2 Support is optional in the kernel and must be activated with DRM_AMDGPU_CIK=y, otherwise the older driver provides stable support for Sea Islands (GCN2.x) cards.
 * 3 Since kernel 4.7-rc6.
 * 4 Usable for graphics output since kernel 4.15.
 * 5 Since kernel 4.16.
 * 6 AMD Zen 2 "4000" series and Zen 2/3 "5000" series 7nm APUs
 * 7 Requires at least kernel 5.3, Mesa 19.2 and LLVM 9.0.
 * 8 RX 6*00 series since kernel 5.9.12 with.

ファームウェア
カードに対応した適切なファームウェア (またはマイクロコード) をインストールする必要があります. ファームウェアファイルは によって提供されます. USE フラグを使用している場合は、ハードウェアのために必要なファイルがすべて、設定ファイルに含まれていることを確認してください.

このようにしてインストールされたファームウェアファイルを、カーネルに組み込むことになります.

カーネル
上述のグラフィックチップセットのための、以下のカーネルオプションを設定してください:

Sound card support メニューのオプションは、カードが HDMI または DisplayPort オーディオをサポートしていて、それを使用したい場合のみ設定する必要があります. より新しいカーネルで Enable AMD Audio CoProcessor IP support が現れた場合は、これも設定するべきです.

AMDGPU with Display Core was first implemented for VEGA10 (GCN5.0) and RAVEN (with DCN 1.0) GPUs/APUs. Kernels before version 4.17 have (experimental) DC support for older cards (GCN1.1 and newer) via command line option amdgpu.dc=1, which may work better than the older radeon kernel module. Likewise, if DC needs to be disabled for any particular reason, option amdgpu.dc=0 can be used on the kernel command line.

HDMI/DisplayPort オーディオの使用に関するさらなる詳細については、 の記事を参照してください.

ファームウェアを組み込む
でインストールされたファームウェアパッケージは、 (Volcanic Islands と Arctic Islands カードのために) および (Southern Islands と Sea Islands カードのために) 内にファイルを提供します. モジュールが読み込まれるときに、正しいファームウェアファイルにアクセスできる必要があります.

In the case that the firmware needs to be included in the kernel or in an, and if using the savedconfig USE flag for , make sure that the savedconfig configuration file is updated with a changed set of firmware files as well (like the change in 2018 mentioned above). Incorporate all the newly added files to the kernel configuration file in the firmware line, then rebuild and install the new kernel image. Otherwise boot will likely fail with a blank screen and firmware load errors thrown to the kernel log.

Unknown firmware blobs
A trial and error method often leads to success. In a multi-step process a basic bootable system may suffice to get the required information: missing firmware is indicated by an amdgpu error in dmesg, which helps to identify the required firmware files.

The way the AMDGPU firmware files are named, all files starting with the GPU model code name are the right firmware blobs to include. In the above example the code name is "Green Sardine", thus this command looking for  will get the required list for CONFIG_EXTRA_FIRMWARE :

Known firmware blobs
or  should be replaced with the full list of filenames given with the chipset's name in the table below, separated by spaces. Use to expand the filenames. E.g. for Volcanic Islands/TONGA, run:

Then  is the string that should be put into the kernel configuration.

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.

USE フラグ
Set the USE flags for the  driver as needed.

The package will be automatically emerged as a dependency of 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  (see the  section above) and asking Portage to update changed USE flags in the  will pull in the correct driver:

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

dpm
In most cases since Linux 3.13 dpm is the default power management method. Unlike with and  methods enabling or disabling dpm must be done via kernel command line. Users who have GPUs older than HD5000 -series may need to add  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:

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:

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

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

Clocking and voltages
In order to set clocks and voltages with AMDGPU, first set the performance level to :

Then, adjust clocks/voltages according to the Linux AMDGPU sysfs documentation with the control file.

x11-apps/mesa-progs
It might be helpful to install the package, which provides the and  utilities.

app-misc/radeontop
View the GPU utilization, both for the total activity percent and individual blocks:

Identifying which graphics card is in use
First make sure that the kernel was compiled with the following settings:

Check, if the discrete graphics card was recognized:

After that. Make sure that the path was mounted successfully:

Then, check, if the driver vga_switcheroo was loaded successfully and can output values:

This output has the following structure :

represents the discrete graphics card, which is inactive, but currently disconnected. is the integrated graphics card, which is active and is currently in use.

The status can be manipulated using the following command:

Replace  with one of the following paramters :

By using the environment variable, one can use the discrete graphics card individually:

This opens an X window with rotating gears.

Let it run in the background and check,  again:

Another indicator is to check the temperature sensors. This requires :

To use the discrete graphics card globally, one can set the environment variable in the file:

One might export it in the file as an alternative:

Or individually in front of the command, like above using :

Prime Synchronization
The driver does not support Prime Synchornization. This might cause tearing on monitors connected to the integrated GPU if the AMD GPU is set as the primary GPU. One possible workaround is to use the modesetting driver instead, to do this remove  from the VIDEO_CARDS variable. Or use a xorg configuration file to force the use of the modesetting driver. That being said, other issues may be encountered with the modesetting driver.

Another possible workaround is to set the integrated GPU as the primary GPU. This will not enable Prime Synchronization. However, tearing will be prevented nonetheless through AMD's TearFree. In this case it will be neccesairy to use the,  (for ) and  (for ) variables on applications that should be rendered on the AMD GPU.

Fallback driver
If having no other machine to browse web pages for solutions, the vesa or fbdev drivers can be used to start X without 3d and 2d acceleration.


 * Vesa for classic BIOS systems
 * Fbdev for UEFI booted systems

Older kernels
Older kernels which do not support the amdgpu driver will not provide the AMDGPU option. For VEGA and newer chips there is no video output without DC (Display Code), which was first included in vanilla Kernel 4.15. In both cases a fairly recent kernel can provide the required drivers. For very new AMD graphics cards and APUs trying an unstable (denoted by a ) kernel may provide the required kernel-sources.

AMD Secure Memory Encryption
If amdgpu fails to load or the screen stays frozen, it might be an incompatibility of the amdgpu module with AMD Secure Memory Encryption (SME).

SME can be temporarily disabled on the kernel command line (using GRUB, or in or as part of GRUB_CMDLINE_LINUX ) by adding mem_encrypt=off. If this fixes the issue, a permanent solution is to configure the kernel accordingly.

AMD_MEM_ENCRYPT may remain enabled, but either AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT must remain unset or the kernel command line option mem_encrypt=off must be used in order to turn Memory Encryption off. Likewise, with mem_encrypt=on SME can be activated for unaffected systems on the kernel command line or more permanently using GRUB_CMDLINE_LINUX in for GRUB.

AMDGPU/RadeonSI drivers do not work
If the graphics card is not supported by including  and   alone in VIDEO_CARDS, try adding   to 's VIDEO_CARDS definition. For example:

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

Full-screen windows perform poorly
The installed version of may be too old. Try emerging an.

=== 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 issue doesn't exist when using Linux 4.13 or newer). This is a known bug. Disabling audio through HDMI for that display resolves this issue. This may be done via:

where  should be replaced by the name of the output, obtained by running

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

Xrand doesn't see HDMI port with hybrid system
On hybrid system with AMD iGPU and dGPU xrandr can show only eDP port, but not HDMI:

Where as Xorg log shows that port was detected and EDID of the monitor decoded without issues:

If it doesn't then it is different issue. And it should be addressed first.

Xrandr would have 2 providers since there are 2 GPUs:

And we need to link source with output:

In provided example it would be this:

After this xrandr shows HDMI and can manipulate layout properly:

Screen Tearing
One method to prevent screen tearing on Xorg is to enable the TearFree option in X11 like so:

Flickering and white screens
The suggested fix at upstream level is to set the sg_display module parameter like this:

As an alternative apply the following patch to the kernel source code: https://patchwork.freedesktop.org/patch/519023

Seems to concern Linux kernels >= 6.1.4.

外部資料

 * A list of RadeonSI articles on the Phoronix site.