AMDGPU
AMDGPU は、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 グラフィックスカードドライバの使用方法を含む、radeon の記事を確認してください。
カーネル 4.15 になるまで、Display Core (DC。Display Abstraction Layer (DAL) によって開発されました) はバニラカーネルソースには含まれていなかったため、AMDGPU はグラフィックス出力を VEGA 以降のチップ上のモニタに提供することができませんでした。
インストール
AMDGPU を使用するようにシステムを設定するには、適切なカードを識別し、対応するファームウェアをインストールし、カーネルを設定し、X11 ドライバをインストールする必要があります。
前提条件
ハードウェア検出
正しいドライバを見つけるためにはまず、グラフィックスカードを検出してください。そのためには lspci を使用してください:
root #
lspci | grep -i VGA
下の表に列挙されている製品名のいずれかが含まれているか、出力を確認してください。
機能サポート
AMDGPU ドライバによってサポートされているビデオコアは、OpenGL 4.6 および OpenGL ES 3.2 に対応しています。VIDEO_CARDS 変数は "amdgpu radeonsi"
に設定する必要があります。media-libs/mesa (バージョン 20.0 以降) を利用することで、ドライバはさらに Vulkan (RADV
ドライバ) をサポートすることができ、OpenCL 2.0 も ROCm (dev-libs/rocm-opencl-runtime) を介して利用できます。radeonsi
を利用した VDPAU と VAAPI へのサポートもあります。
ファミリ | チップセット名 | マイクロアーキテクチャA | ISAB | 製品名 |
---|---|---|---|---|
Southern Islands1 | CAPE VERDE, PITCAIRN, TAHITI, OLAND, HAINAN | GCN1.0+ | DCE 6.x | HD7750-HD7970, R9 270, R9 280, R9 370X, R7 240, R7 250 |
Sea Islands2 | BONAIRE, KABINI, KAVERI, HAWAII, MULLINS | GCN2.x | DCE 8.x | HD7790, R7 260, R9 290, R7 360, R9 390 |
Volcanic Islands | CARRIZO, FIJI, STONEY, TONGA, TOPAZ, WANI | GCN3.x | DCE 10/11.x | R9 285, R9 380, R9 380X, R9 Fury, R9 Nano, R9 Fury X, Pro Duo |
Arctic Islands3 | POLARIS10/11/12, VEGAM | GCN4.x | DCE 11.2 | RX 460, RX 470, RX 480, RX 540, RX 550, RX 560, RX 570, RX 580, RX 590 |
Vega4 | VEGA10/11/12/20 | GCN5.x | DCE 12.x | RX Vega 56, RX Vega 64, Radeon Vega II, Radeon VII |
RAVEN5 | DCN 1.0 | Raven Ridge APU シリーズ5 | ||
RENOIR6 | DCN 2.1 | Renoir, Lucienne, および Cezanne APU シリーズ6 | ||
Navi7 | NAVI10/14/21/22/23 | RDNA | DCN 2.0 | RX 5500, RX 5500 XT, RX 5600, RX 5600 XT, RX 5700, RX 5700 XT |
RDNA2 | DCN 3.08 | RX 6600, RX 6600 XT, RX 6700, RX 6700 XT, RX 6800, RX 6800 XT, RX 6900 XT |
- 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 radeon driver.
- 2 Support is optional in the kernel and must be activated with DRM_AMDGPU_CIK=y, otherwise the older radeon 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.[1][2]
- 6 AMD Zen 2 "4000" series and Zen 2/3 "5000" series 7nm APUs[3][4][5][6]
- 7 Requires at least kernel 5.3, Mesa 19.2 and LLVM 9.0.[7]
- 8 RX 6*00 series since kernel 5.9.12 with
CONFIG_DRM_AMD_DC_DCN3_0=Y
.[8][9]
ファームウェア
カードに対応した適切なファームウェア (またはマイクロコード) をインストールする必要があります。ファームウェアファイルは sys-kernel/linux-firmware によって提供されます。savedconfig USE フラグを使用している場合は、ハードウェアのために必要なファイルがすべて、設定ファイルに含まれていることを確認してください。
USE flags for sys-kernel/linux-firmware Linux firmware files
compress-xz
|
Compress firmware using xz (app-arch/xz-utils) before installation |
compress-zstd
|
Compress firmware using zstd (app-arch/zstd) before installation |
initramfs
|
Create and install initramfs for early microcode loading in /boot (only AMD for now) |
redistributable
|
Install also non-free (but redistributable) firmware files |
savedconfig
|
Allows individual selection of firmware files |
unknown-license
|
Install firmware files whose license is unknown |
root #
emerge --ask sys-kernel/linux-firmware
このようにしてインストールされたファームウェアファイルを、カーネルに組み込むことになります。
Navi10 カード (RX 5700、RX 5700XT [FE]) は少なくとも sys-kernel/linux-firmware のバージョン 20190923 を必要とします。
カーネル
最も簡単なインストール方法は、"AMD GPU" をモジュール (M) として選択し、initramfs に含めないという方法です。こうすると、ドライバが少し遅れて、udev がアクティブになってからロードされますが、この場合はファームウェアを手動で管理する必要がなくなるでしょう。そうしない場合は、下のファームウェアを組み込むのセクションを注意深くお読みください。
上述のグラフィックチップセットのための、以下のカーネルオプションを設定してください:
Processor type and features ---> [*] MTRR (Memory Type Range Register) support (CONFIG_MTRR) Memory Management options ---> [*] Allow for memory hot-add [*] Allow for memory hot remove [*] Device memory (pmem, HMM, etc...) hotplug support [*] Unaddressable device memory (GPU memory, ...) Device Drivers ---> Graphics support ---> <*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> (DRM_FBDEV_EMULATION) [*] Enable legacy fbdev support for your modesetting driver < > ATI Radeon <M/*> AMD GPU [ /*] Enable amdgpu support for SI parts (DRM_AMDGPU_SI) (only needed for Southern Islands GPUs with the amdgpu driver) [ /*] Enable amdgpu support for CIK parts (DRM_AMDGPU_CIK) (only needed for Sea Islands GPUs with the amdgpu driver) ACP (Audio CoProcessor) Configuration ---> [*] Enable AMD Audio CoProcessor IP support (CONFIG_DRM_AMD_ACP) (only needed for APUs) Display Engine Configuration ---> [*] AMD DC - Enable new display engine (DRM_AMD_DC) [ /*] DC support for Polaris and older ASICs (only needed for Polaris, Carrizo, Tonga, Bonaire, Hawaii) [ /*] AMD FBC - Enable Frame Buffer Compression [ /*] DCN 1.0 Raven family (only needed for Vega RX as part of Raven Ridge APUs) [ /*] DCN 3.0 family (only needed for NAVI21/Sienna Cichlid GPUs with the amdgpu driver) <*/M> HSA kernel driver for AMD GPU devices (HSA_AMD) <*/M> Sound card support ---> <*/M> Advanced Linux Sound Architecture ---> [*] PCI sound devices ---> (CONFIG_SND_PCI) HD-Audio ---> <*> HD Audio PCI (CONFIG_SND_HDA_INTEL) [*] Support initialization patch loading for HD-audio (CONFIG_SND_HDA_PATCH_LOADER) <*> whatever audio codec your soundcard needs <*> Build HDMI/DisplayPort HD-audio codec support (CONFIG_SND_HDA_CODEC_HDMI) (2048) Pre-allocated buffer size for HD-audio driver (CONFIG_SND_HDA_PREALLOC_SIZE)
AMDGPU を使用するときは、radeon モジュールがビルドされないように、ATI Radeon オプションの設定を解除することをおすすめします。それか、モジュールをビルドしつつ、ブラックリストに入れることもできます (再起動後に、ブラックリストが機能しているか lsmod | grep radeon で確認してください)。multiseat など、システムがそれを要求しない限り、amdgpu と radeon モジュールは同時にロードされることを意図していません。
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 オーディオの使用に関するさらなる詳細については、radeon の記事を参照してください。
ファームウェアを組み込む
以前の節でインストールされたファームウェアパッケージは、/lib/firmware/amdgpu (Volcanic Islands と Arctic Islands カードのために) および /lib/firmware/radeon (Southern Islands と Sea Islands カードのために) 内にファイルを提供します。amdgpu
モジュールが読み込まれるときに、正しいファームウェアファイルにアクセスできる必要があります。
amdgpu
モジュールがローダブルカーネルモジュールとしてコンパイルされる (つまり、カーネルコンフィグで AMDGPU が M
に設定されている) 場合、モジュールがロードされる時点でファームウェアファイルにアクセス可能でなくてはなりません。特にモジュールが initrd/initramfs からロードされる場合、カーネルは、モジュールがカーネルに直接組み込まれた (つまり、カーネルコンフィグで AMDGPU が *
に設定されている) 場合と同じように、ブートの早期ステージ中にモジュールを初期化しようとします。このステージでファームウェアファイルにアクセスできるようにするためには、ファームウェアは initrd/initramfs (これは GRUB などのブートローダによってロードする必要があります) に含めるか、カーネルイメージ内に直接含める必要があります。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) (CONFIG_EXTRA_FIRMWARE) (/lib/firmware) Firmware blobs root directory
Device Drivers ---> Generic Driver Options ---> Firmware loader ---> -*- Firmware loading facility (amdgpu/<YOUR-MODEL>.bin or radeon/<YOUR-MODEL>.bin) Build named firmware blobs into the kernel binary (/lib/firmware) Firmware blobs root directory
sys-kernel/genkernel > 4.0 を使用すると、指定されたファームウェアファイルを initramfs に簡単に含めることができます。genkernel の記事の Firmware loading の節を参照してください。
Kernels before 4.15.x (Aug. 2018) and 4.19.9[10] (Dec. 2018) require a different (older) set of firmware files than listed here in order to boot successfully. For all current kernels it is recommended to always make sure that sys-kernel/linux-firmware is updated.
In the case that the firmware needs to be included in the kernel or in an initramfs, and if using the savedconfig USE flag for sys-kernel/linux-firmware, 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.
This method will, without any firmware files, very likely result in a blank screen since the AMDGPU driver doesn't work properly without firmware. A very basic method to still get the required information is to type in the blind and save the dmesg output into a file, which can be analyzed when rebooting without the AMDGPU driver in use. A better choice might be to intermittently include all the firmware,
amdgpu/*
, but then dmesg normally doesn't show which firmware was loaded, unless sys-kernel/gentoo-sources is installed with USE="experimental" and CONFIG_GENTOO_PRINT_FIRMWARE_INFO=y
is set in the kernel .config, or to force the use of another framebuffer driver (like vesafb or efifb).root #
dmesg -t | grep amdgpu | grep firmware
amdgpu 0000:07:00.0: Direct firmware load for amdgpu/green_sardine_sdma.bin failed with error -2 [drm:sdma_v4_0_early_init] *ERROR* sdma_v4_0: Failed to load firmware "amdgpu/green_sardine_sdma.bin" amdgpu 0000:07:00.0: Direct firmware load for amdgpu/green_sardine_asd.bin failed with error -2
root #
dmesg -t | grep amdgpu | grep firmware
Loading firmware: amdgpu/green_sardine_sdma.bin Loading firmware: amdgpu/green_sardine_asd.bin Loading firmware: amdgpu/green_sardine_ta.bin Loading firmware: amdgpu/green_sardine_pfp.bin Loading firmware: amdgpu/green_sardine_me.bin Loading firmware: amdgpu/green_sardine_ce.bin Loading firmware: amdgpu/green_sardine_rlc.bin Loading firmware: amdgpu/green_sardine_mec.bin Loading firmware: amdgpu/green_sardine_dmcub.bin Loading firmware: amdgpu/green_sardine_vcn.bin
The following will only work when sys-kernel/linux-firmware is installed and the required (but in the example above missing) firmware is actually available. For very new graphics cards the firmware may be included in the unstable package, which can be installed using
~
in ACCEPT_KEYWORDS, e.g. ~amd64
like in ACCEPT_KEYWORDS="~amd64" emerge --ask sys-kernel/linux-firmware or by adding it to /etc/portage/package.accept_keywords.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 green_sardine
will get the required list for CONFIG_EXTRA_FIRMWARE:
user $
ls /lib/firmware/amdgpu/green_sardine*.bin | sed 's/\/lib\/firmware\///' | echo $(cat)
amdgpu/green_sardine_asd.bin amdgpu/green_sardine_ce.bin amdgpu/green_sardine_dmcub.bin amdgpu/green_sardine_me.bin amdgpu/green_sardine_mec2.bin amdgpu/green_sardine_mec.bin amdgpu/green_sardine_pfp.bin amdgpu/green_sardine_rlc.bin amdgpu/green_sardine_sdma.bin amdgpu/green_sardine_ta.bin amdgpu/green_sardine_vcn.bin
Known firmware blobs
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.
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.
ファミリ | チップセット名 | 製品名 | ファームウェア |
---|---|---|---|
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 | amdgpu/oland_{uvd,smc,rlc,pfp,me,mc,ce}.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 | amdgpu/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, RX 570, RX 580, RX 590 | amdgpu/polaris10_{ce,ce_2,k_smc,k2_smc,k_mc,mc,me,me_2,mec2,mec2_2,mec,mec_2,pfp,pfp_2,rlc,sdma1,sdma,smc,smc_sk,uvd,vce}.bin |
POLARIS11 | RX 460, RX 550 640SP, RX 560 | amdgpu/polaris11_{ce,k_smc,k2_smc,k_mc,mc,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,smc_sk,uvd,vce}.bin | |
POLARIS12 | RX 540, RX 550 | amdgpu/polaris12_{ce,ce_2,k_mc,k_smc,mc,me,me_2,mec,mec2,mec2_2,mec_2,pfp,pfp_2,rlc,sdma,sdma1,smc,uvd,vce}.bin | |
Vega | VEGA10 | RX Vega 56, RX Vega 64 | amdgpu/vega10_{acg_smc,asd,ce,gpu_info,me,mec,mec2,pfp,rlc,sdma,sdma1,smc,sos,uvd,vce}.bin |
RAVEN | Raven Ridge APU series | amdgpu/raven_{asd,ce,gpu_info,me,mec,mec2,pfp,rlc,sdma,vcn}.bin | |
VEGA12 | Raven 2 Vega Mobile | amdgpu/vega12_{asd,ce,gpu_info,me,mec,mec2,pfp,rlc,sdma,sdma1,smc,sos,uvd,vce}.bin | |
RENOIR | Renoir APU series | amdgpu/renoir_{asd,ce,dmcub,gpu_info,me,mec2,mec,pfp,rlc,sdma,vcn}.bin | |
CEZANNE | Cezanne (Zen 3; Renoir) | amdgpu/green_sardine_{asd,ce,dmcub,me,mec2,mec,pfp,rlc,sdma,ta,vcn}.bin | |
Navi | NAVI10 | RX 5600, RX 5600 XT, RX 5700, RX 5700 XT | amdgpu/navi10_{asd,ce,gpu_info,me,mec2,mec,pfp,rlc,sdma1,sdma,smc,sos,ta,vcn}.bin |
NAVI14 | RX 5500 XT | amdgpu/navi14_{asd,ce,ce_wks,gpu_info,me,mec2,mec2_wks,mec,mec_wks,me_wks,pfp,pfp_wks,rlc,sdma1,sdma,smc,sos,ta,vcn}.bin | |
NAVI21 | RX 6800, RX 6800 XT, RX 6900 XT | amdgpu/sienna_cichlid_{ce,dmcub,me,mec2,mec,pfp,rlc,sdma,smc,sos,ta,vcn}.bin | |
NAVI22 | RX 6700 XT | amdgpu/navy_flounder_{ce,me,mec2,rlc,smc,ta,dmcub,mec,pfp,sdma,sos,vcn}.bin | |
NAVI23 | RX 6600, RX 6600 XT | amdgpu/dimgrey_cavefish_{ce,me,mec2,rlc,smc,ta,dmcub,mec,pfp,sdma,sos,vcn}.bin | |
NAVI24 | RX 6400, RX 6500 XT | amdgpu/beige_goby_{ce,ta,rlc,sos,dmcub,smc,sdma,mec,mec2,pfp,vcn,me}.bin | |
NAVI31 | RX 7900 XT | amdgpu/{gc_11_0_0_{imu,pfp,me,rlc,mec,mes,mes1},psp_13_0_0_sos,psp_13_0_0_ta,smu_13_0_0,dcn_3_2_0_dmcub,sdma_6_0_0,vcn_4_0_0}.bin |
X11 ドライバ
emerge
Portage は、さまざまなグラフィックスカードのためのサポートをパッケージで有効化させるために、VIDEO_CARDS USE_EXPAND 変数を使用しています。VIDEO_CARDS を amdgpu radeonsi
に設定して (上の機能サポート表の節を参考にしてください)、Portage に USE フラグの変更を適用して @world 集合を更新させれば、正しいドライバがインストールされるでしょう:
/etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi"
root #
emerge --ask --deep --changed-use @world
これで、次の再起動後に amdgpu を使うためにシステムの準備ができたはずです。
電源管理
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.
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 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:
root #
echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level
There's also the low forceable performance level, which can be echoed the same way. A list of all available modes can be found on dri.freedesktop.org
クロックと電圧
AMDGPU でクロックと電圧を設定するには、まずパフォーマンスレベルを manual
に設定してください:
root #
echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level
そして、Linux AMDGPU sysfs ドキュメンテーションに従って、pp-od-clk-voltage コントロールファイルを利用してクロック/電圧を調整してください。
トラブルシューティング
デバッグツール
x11-apps/mesa-progs
glxgears と glxinfo ユーティリティを提供する、パッケージ x11-apps/mesa-progs をインストールしておくと役立つかもしれません。
app-misc/radeontop
GPU 使用率を、全体と、個別のブロックごとの両方で表示します:
user $
radeontop
Collecting data, please wait.... radeontop 1.4, running on RAVEN bus 06, 120 samples/sec │ Graphics pipe 0.00% │ ─────────────────────────────────────────┼────────────────────────────────────── Event Engine 0.00% │ │ Vertex Grouper + Tesselator 0.00% │ │ Texture Addresser 0.00% │ │ Shader Export 0.00% │ Sequencer Instruction Cache 0.00% │ Shader Interpolator 0.00% │ │ Scan Converter 0.00% │ Primitive Assembly 0.00% │ │ Depth Block 0.00% │ Color Block 0.00% │ │ 67M / 2016M VRAM 3.35% │ 23M / 3063M GTT 0.76% │ 1.20G / 1.20G Memory Clock 100.00% │████████████████████████████████████████ 0.20G / 1.20G Shader Clock 16.67% │██████ │
使用中のグラックスカードを特定する
まず、カーネルが次の設定でコンパイルされていることを確認してください:
Device Drivers ---> Graphics support ---> -*- VGA Arbitration [*] Laptop Hybrid Graphics - GPU switching support
具体的なグラフィックスカードが認識されているか確認してください:
user $
lspci -k
[...] 01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars [Radeon HD 8670A/8670M/8750M] Subsystem: Lenovo Mars [Radeon HD 8670A/8670M/8750M] Kernel driver in use: radeon [...]
その後、パス /sys/kernel/debug/ のマウントが成功していることを確認してください:
root #
findmnt debugfs
TARGET SOURCE FSTYPE OPTIONS /sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime
そして、ドライバ vga_switcheroo が正しくロードされ、値を出力できるか確認してください:
root #
< /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :DynOff:0000:01:00.0 1:IGD:+:Pwr:0000:00:02.0
この出力は以下の構造を持っています[11]:
イテレータ | ID | アクティブ状態 | 電源状態 | デバイス ID (xxxx:xx:xx.x) |
---|---|---|---|---|
0 | DIS | 非アクティブ (+ 記号が無いことによって示されています)
|
DynOff | 0000:01:00.0 |
1 | IGD | アクティブ (+ 記号によって示されています)
|
Pwr | 0000:00:02.0 |
DIS
はディスクリート (discrete) グラフィックスカードを表現していて、これは非アクティブですが現在接続されていません (DynOff
)。
IGD
は統合 (integrated) グラフィックスカードで、これはアクティブ (+
) かつ現在使用中 (Pwr
) です。
次のコマンドを使用してステータスを操作することができます:
root #
echo "<some_parameter>" > /sys/kernel/debug/vgaswitcheroo/switch
<some_parameter>
を以下のパラメータのいずれかで置き換えてください[12]:
Parameter | Description |
---|---|
ON | Turns on the disconnected GPU, which is currently not displaying anything and does not switch outputs. |
IGD | Connects the integrated graphics card with the display. |
DIS | Connects the discrete graphics card with the display. |
OFF | Turns off the graphics card, which is currently disconnected. |
DIGD | Inside of an X session: Queues a switch to the integrated graphics card to occur, when the X server is next restarted. |
DDIS | Inside of an X session: Queues a switch to the discrete graphics card to occur, when the X server is next restarted. |
環境変数 DRI_PRIME=1
を使用することによって、ディスクリートグラフィックスカードを個別に使用することができます:
user $
DRI_PRIME=1 glxgears
これは回転する歯車を表示する X ウィンドウを開きます。
これはバックグラウンドで実行しておいて、再度 vga_switcheroo
を確認してください:
root #
< /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :DynPwr:0000:01:00.0 1:IGD:+:Pwr:0000:00:02.0
今回はディスクリートグラフィックスカードのステータスが DynPwr に切り換わっていて、これはアクティブで動作中になっていることを意味します。
Another indicator is to check the temperature sensors. This requires sys-apps/lm-sensors:
user $
sensors
[...] radeon-pci-0100 Adapter: PCI adapter temp1: +42.0°C (crit = +120.0°C, hyst = +90.0°C) [...]
When
vga_switcheroo
displays the status DynOff
, sensors
will display the temperature as N/A
or as something else, which may not make sense; for example: -128°C.To use the discrete graphics card globally, one can set the environment variable in the /etc/environment file:
/etc/environment
DRI_PRIME=1
One might export it in the ~/.bashrc file as an alternative:
/home/larry/.bashrc
export DRI_PRIME=1
Or individually in front of the command, like above using glxgears:
user $
DRI_PRIME=1 /usr/bin/chromium
user $
DRI_PRIME=1 /usr/bin/vlc
Prime 同期
The x11-drivers/xf86-video-amdgpu 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 amdgpu
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[13].
/etc/X11/xorg.conf.d/force-modesetting.conf
Section "Device" Identifier "modesetting" Driver "modesetting" EndSection
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 DRI_PRIME=1
, VDPAU_DRIVER=radeonsi
(for VDPAU) and LIBVA_DRIVER_NAME=radeonsi
(for VAAPI) variables on applications that should be rendered on the AMD GPU.
フォールバックドライバ
解決策を求めて web ページを閲覧するための他のマシンを持っていない場合は、3D および 2D アクセラレーション無しで X を開始するために、vesa または fbdev ドライバを使用することができます。
- 伝統的な BIOS システムのためには vesa
- UEFI ブートのシステムのためには fbdev
/etc/partage/make.conf
VIDEO_CARDS="... vesa fbdev"
root #
emerge --ask --update --newuse --deep @world
カーネル
古いカーネル
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 /etc/default/grub 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.
Processor type and features ---> [*] AMD Secure Memory Encryption (SME) support [ ] Activate AMD Secure Memory Encryption (SME) by default
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 /etc/default/grub for GRUB.
AMDGPU/RadeonSI ドライバが機能しない
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:
/etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi radeon"
値を設定したら、変更を適用するためにシステムを更新してください:
root #
emerge --ask --changed-use --deep @world
フルスクリーンウィンドウの性能が悪い
インストールされている sys-devel/llvm のバージョンが古すぎるのかもしれません。unstable/testing バージョン を emerge してみてください。
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:
user $
xrandr --output HDMI-A-0 --auto --set audio off
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.
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:
user $
xrandr
Screen 0: minimum 320 x 200, current 1920 x 2160, maximum 16384 x 16384 eDP connected primary 1920x1080+0+1080 (normal left inverted right x axis y axis) 382mm x 215mm 1920x1080 144.03*+ 60.01 1680x1050 144.03 1280x1024 144.03 1440x900 144.03 1280x800 144.03 1280x720 144.03 1024x768 144.03 800x600 144.03 640x480 144.03
Where as Xorg log shows that port was detected and EDID of the monitor decoded without issues:
user $
cat /var/log/Xorg.0.log
[...] [ 8.282] (II) AMDGPU(G0): Output HDMI-A-1-0 has no monitor section [ 8.294] (II) AMDGPU(G0): EDID for output HDMI-A-1-0 [ 8.295] (II) AMDGPU(G0): Manufacturer: DEL Model: a11e Serial#: 843731010 [...] [ 8.295] (II) AMDGPU(G0): Supported established timings: [ 8.295] (II) AMDGPU(G0): 720x400@70Hz [...] [ 8.295] (II) AMDGPU(G0): EDID (in hex): [ 8.295] (II) AMDGPU(G0): 00ffffffffffff0010ac1ea142504a32 [ 8.295] (II) AMDGPU(G0): 0c1f010380351e78ea05f5a557529c27 [...] [ 8.296] (II) AMDGPU(G0): Printing probed modes for output HDMI-A-1-0 [ 8.296] (II) AMDGPU(G0): Modeline "1920x1080"x60.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz eP) [...]
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:
user $
xrandr --listproviders
Providers: number : 2 Provider 0: id: 0x54 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 1 associated providers: 1 name:Unknown AMD Radeon GPU @ pci:0000:07:00.0 Provider 1: id: 0x84 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 5 outputs: 1 associated providers: 1 name:Radeon RX 5500M @ pci:0000:03:00.0
And we need to link source with output:
user $
xrandr --setprovideroutputsource provider source
In provided example it would be this:
user $
xrandr --setprovideroutputsource 1 0
After this xrandr shows HDMI and can manipulate layout properly:
user $
xrandr
Screen 0: minimum 320 x 200, current 1920 x 2160, maximum 16384 x 16384 eDP connected primary 1920x1080+0+1080 (normal left inverted right x axis y axis) 382mm x 215mm 1920x1080 144.03*+ 60.01 [...] HDMI-A-1-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm 1920x1080 60.00*+ 50.00 59.94 [...]
Screen Tearing
One method to prevent screen tearing on Xorg is to enable the TearFree option in X11 like so:
/usr/share/X11/xorg.conf.d/10-amdgpu.conf
Section "OutputClass" Identifier "AMDgpu" MatchDriver "amdgpu" Driver "amdgpu" Option "TearFree" "true" EndSection
Flickering and white screens
This issue has already been reported in the Gentoo forums: https://forums.gentoo.org/viewtopic-t-1160883.html
The suggested fix at upstream level is to set the sg_display module parameter like this:
amdgpu.sg_display=0
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.
関連項目
- 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.
- AMDVLK — an open-source Vulkan driver for AMD Radeon™ graphics adapters on Linux led by GPUOpen initiative.
- OpenCL — ヘテロジニアス (異種) コンピューティングプラットフォーム (CPU、GPU、DSP、FPGA、ASIC など) にわたって実行されるプログラムを作成するためのフレームワーク
- Vulkan — a next-generation graphics API created by The Khronos Group.
- VAAPI — provides access to graphics hardware (GPU) acceleration for video processing.
- VDPAU — how to setup the Video Decode and Presentation API for Unix (VDPAU).
外部資料
参照
- ↑ Phoronix - Report: Ryzen "Raven Ridge" APU Not Using HBM2 Memory
- ↑ Phoronix - 25 More AMDGPU DC Patches, Mostly Focused On Raven DCN
- ↑ WikiChip - Renoir - Cores - AMD - WikiChip
- ↑ WikiChip - Lucienne - Cores - AMD - WikiChip
- ↑ WikiChip - Cezanne - Cores - AMD - WikiChip
- ↑ Phoronix - AMD Renoir APUs Bringing "DCN 2.1" Display Engine
- ↑ Phoronix - AMD Navi 10 Firmware Finally Lands In The Linux-Firmware Tree
- ↑ https://www.phoronix.com/scan.php?page=news_item&px=Radeon-RX-6900-XT
- ↑ https://cateee.net/lkddb/web-lkddb/DRM_AMD_DC_DCN3_0.html
- ↑ Linux kernel commit 39bdb32 with added firmware files to POLARIS10 and POLARIS11
- ↑ https://github.com/torvalds/linux/blob/be8454afc50f43016ca8b6130d9673bdd0bd56ec/drivers/gpu/vga/vga_switcheroo.c#L653-L660
- ↑ https://help.ubuntu.com/community/HybridGraphics
- ↑ https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/-/issues/11