参考教程:https://jim.plus/blog/post/jim/amd-gpu-drivers-for-synology
存档备份
本文仅为研究学习驱动和测试用途,暂不提供编译好的驱动下载。
前几篇文章介绍了英特尔核显、英伟达独显在群晖下安装驱动,这次我们来研究 AMD 的显卡。
先说结论:在群晖 SA6400 上,移植 AMD 官方提供的显卡驱动是可行的,理论上这几年的 AMD 核显,包括:680M、780M,同时也能支持独立显卡,对比 PCI ID 最高支持到 RX 6900XT
测试硬件
本次的测试硬件是找公司内安全大佬借来的,型号为 MOREFINE M600(R9-6900HX)(https://morefine.com/products/morefine-m600-mini-pc-amd-6900hx-6800u-6600u),群晖型号选择 SA6400,懂得都懂。
配置方面不再赘述了,可以点击上面链接查看,主角是 AMD R9-6900HX 的核显:680M。
PVE 环境准备
- 更新 grub 配置
本次测试基于 PVE 8.1.3,系统安装从 NVMe 盘上,由于某些原因,需要在 /etc/default/grub 里设置:
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on nvme_core.default_ps_max_latency_us=0 pcie_aspm=off"
再 update-grub 后方才稳定使用。
- 禁用默认的驱动
echo "blacklist amdgpu" >> /etc/modprobe.d/blacklist.conf echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf
- 导出 vbios
下载 vbios.c 编译并执行
wget https://cdn.jim.plus/synology/scripts/vbios.c
gcc vbios.c -o vbios
./vbios
cp vbios_*.bin /usr/share/kvm/
4. 新建虚拟机
创建好测试的虚拟机后,设置直通核显,并编辑 /etc/pve/qemu-server/10*.conf
hostpci0: 000000.0,pcie=1,romfile=vbios_1002_1681.bin
这里的 vbios_1002_1681.bin 就是上一步里导出的 vbios
5. 正常安装群晖 SA6400
核显驱动安装
驱动来源:https://www.amd.com/en/support/linux-drivers
复制 firmware
安装驱动
```shell
insmod i2c-algo-bit.ko
insmod backport-sa6400-export.ko
insmod backport-sa6400.ko
insmod backport-dma-buf.ko
insmod hdmi.ko
insmod backlight.ko
insmod drm_panel_orientation_quirks.ko
insmod drm.ko
insmod fbdev.ko
insmod fbcore.ko
insmod drm_kms_helper.ko
insmod hmm.ko
insmod amdkcl.ko
insmod amdttm.ko
insmod gpu-sched.ko
insmod amddrm_buddy.ko
insmod amdxcp.ko
insmod amdgpu.ko
成功安装好的内核日志:
[ 59.857853] [drm] amdgpu kernel modesetting enabled.
[ 59.858403] [drm] amdgpu version: 6.2.4
[ 59.858872] [drm] OS DRM version: 5.10.0
[ 59.859461] amdgpu: CRAT table not found
[ 59.860057] amdgpu: Virtual CRAT table created for CPU
[ 59.860789] amdgpu: Topology: Add CPU node
[ 59.862668] [drm] initializing kernel modesetting (YELLOW_CARP 0x1002:0x1681 0x1002:0x0124 0xC7).
[ 59.863528] [drm] register mmio base: 0x81000000
[ 59.863988] [drm] register mmio size: 524288
[ 59.866814] [drm] add ip block number 0 <nv_common>
[ 59.867286] [drm] add ip block number 1 <gmc_v10_0>
[ 59.867791] [drm] add ip block number 2 <navi10_ih>
[ 59.868275] [drm] add ip block number 3 <psp>
[ 59.868697] [drm] add ip block number 4 <smu>
[ 59.869152] [drm] add ip block number 5 <dm>
[ 59.869568] [drm] add ip block number 6 <gfx_v10_0>
[ 59.870075] [drm] add ip block number 7 <sdma_v5_2>
[ 59.870554] [drm] add ip block number 8 <vcn_v3_0>
[ 59.871058] [drm] add ip block number 9 <jpeg_v3_0>
[ 59.877210] [drm] BIOS signature incorrect 0 0
[ 59.880222] amdgpu 000000.0: amdgpu: Fetched VBIOS from ROM BAR
[ 59.880810] amdgpu: ATOM BIOS: 113-REMBRANDT-X37
[ 59.888232] [drm] VCN(0) decode is enabled in VM mode
[ 59.888684] [drm] VCN(0) encode is enabled in VM mode
[ 59.890245] [drm] JPEG decode is enabled in VM mode
[ 59.890711] amdgpu 000000.0: amdgpu: Trusted Memory Zone (TMZ) feature disabled as experimental (default)
[ 59.891660] [drm] vm size is 262144 GB, 4 levels, block size is 9-bit, fragment size is 9-bit
[ 59.892543] amdgpu 000000.0: amdgpu: VRAM: 512M 0x000000F400000000 - 0x000000F41FFFFFFF (512M used)
[ 59.893456] amdgpu 000000.0: amdgpu: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
[ 59.894289] amdgpu 000000.0: amdgpu: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
[ 59.895261] [drm] Detected VRAM RAM=512M, BAR=256M
[ 59.895715] [drm] RAM width 128bits DDR5
[ 59.896149] pmd_set_huge: Cannot satisfy [mem 0x380000000000-0x380000200000] with a huge-page mapping due to MTRR override.
[ 59.897327] [drm] amdgpu: 512M of VRAM memory ready
[ 59.897820] [drm] amdgpu: 1872M of GTT memory ready.
[ 59.898315] [drm] GART: num cpu pages 262144, num gpu pages 262144
[ 59.899077] [drm] PCIE GART of 1024M enabled (table at 0x000000F400000000).
[ 59.914047] [drm] Loading DMUB firmware via PSP: version=0x0400002E
[ 59.915819] [drm] use_doorbell being set to: [true]
[ 59.916355] [drm] Found VCN firmware Version ENC: 1.23 DEC: 2 VEP: 0 Revision: 5
[ 59.917123] amdgpu 000000.0: amdgpu: Will use PSP to load VCN firmware
[ 59.941251] [drm] reserve 0xa00000 from 0xf41e000000 for PSP TMR
[ 60.246446] amdgpu 000000.0: amdgpu: RAS: optional ras ta ucode is not available
[ 60.256859] amdgpu 000000.0: amdgpu: RAP: optional rap ta ucode is not available
[ 60.257569] amdgpu 000000.0: amdgpu: SECUREDISPLAY: securedisplay ta ucode is not available
[ 60.259593] amdgpu 000000.0: amdgpu: SMU is initialized successfully!
[ 60.260705] [drm] Display Core v3.2.241 initialized on DCN 3.1
[ 60.261311] [drm] DP-HDMI FRL PCON supported
[ 60.263415] [drm] DMUB hardware initialized: version=0x0400002E
[ 60.303114] [drm] kiq ring mec 2 pipe 1 q 0
[ 60.306742] [drm] VCN decode and encode initialized successfully(under DPG Mode).
[ 60.307621] [drm] JPEG decode initialized successfully.
[ 60.309236] [drm] Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance thanks to write-combining
[ 60.310671] kfd kfd: amdgpu: Allocated 3969056 bytes on gart
[ 60.311324] kfd kfd: amdgpu: Total number of KFD nodes to be created: 1
[ 60.312285] amdgpu: Virtual CRAT table created for GPU
[ 60.313527] amdgpu: Topology: Add dGPU node [0x1681:0x1002]
[ 60.314157] kfd kfd: amdgpu: added device 1002:1681
[ 60.314732] amdgpu 000000.0: amdgpu: SE 1, SH per SE 2, CU per SH 6, active_cu_number 12
[ 60.315796] amdgpu 000000.0: amdgpu: ring gfx_0.0.0 uses VM inv eng 0 on hub 0
[ 60.316659] amdgpu 000000.0: amdgpu: ring comp_1.0.0 uses VM inv eng 1 on hub 0
[ 60.317540] amdgpu 000000.0: amdgpu: ring comp_1.1.0 uses VM inv eng 4 on hub 0
[ 60.318408] amdgpu 000000.0: amdgpu: ring comp_1.2.0 uses VM inv eng 5 on hub 0
[ 60.319294] amdgpu 000000.0: amdgpu: ring comp_1.3.0 uses VM inv eng 6 on hub 0
[ 60.320154] amdgpu 000000.0: amdgpu: ring comp_1.0.1 uses VM inv eng 7 on hub 0
[ 60.321076] amdgpu 000000.0: amdgpu: ring comp_1.1.1 uses VM inv eng 8 on hub 0
[ 60.321974] amdgpu 000000.0: amdgpu: ring comp_1.2.1 uses VM inv eng 9 on hub 0
[ 60.322857] amdgpu 000000.0: amdgpu: ring comp_1.3.1 uses VM inv eng 10 on hub 0
[ 60.323742] amdgpu 000000.0: amdgpu: ring kiq_0.2.1.0 uses VM inv eng 11 on hub 0
[ 60.324651] amdgpu 000000.0: amdgpu: ring sdma0 uses VM inv eng 12 on hub 0
[ 60.325494] amdgpu 000000.0: amdgpu: ring vcn_dec_0 uses VM inv eng 0 on hub 8
[ 60.326372] amdgpu 000000.0: amdgpu: ring vcn_enc_0.0 uses VM inv eng 1 on hub 8
[ 60.327303] amdgpu 000000.0: amdgpu: ring vcn_enc_0.1 uses VM inv eng 4 on hub 8
[ 60.328225] amdgpu 000000.0: amdgpu: ring jpeg_dec uses VM inv eng 5 on hub 8
[ 60.330553] [drm] Initialized amdgpu 3.54.0 20150101 for 000000.0 on minor 0
[ 60.340370] [drm] DSC precompute is not needed.
[ 60.378814] Console: switching to colour frame buffer device 240x67
[ 60.399303] amdgpu 000000.0: [drm] fb0: amdgpudrmfb frame buffer device
使用 radeontop 可以查看核显状态:
radeontop v1.4-4-gec97e6f, running on YELLOW_CARP bus 01, 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% │
│
24M / 480M VRAM 4.92% │■■
12M / 1861M GTT 0.63% │■
1.23G / 2.40G Memory Clock 51.39% │■■■■■■■■■■■■■■■■■■■■
0.40G / 2.40G Shader Clock 16.67% │■■■■■■■■
硬解测试
本人非专业测试人员,所有的测试都是想到哪儿测试哪儿,如有不正确的地方,欢迎可留言指点。
测试视频:杜比视界和杜比全景声 4K 原版
时间有限,仅测试 Jellyfin
运行命令
basedir=/volume1/Test/jellyfin/
config=${basedir}/config
media=${basedir}/media
mkdir -p ${config}
mkdir -p ${media}
docker run \
--network=host \
--privileged \
-v "${config}":/config \
-v "${media}":/media \
-e TZ="Asia/Shanghai" \
-e UID=0 \
-e GID=0 \
-e GIDLIST=0 \
--restart always \
--name jellyfin \
-d nyanmisaka/jellyfin:230810-amd64
所有配置均为 N 大镜像默认的,其中硬件加速方式选择 VAAPI。
转码截图
色调映射有点儿问题,忽略
100 帧,应对日常足够用
Jellyfin-AMD-680M-12G-4K-to-1080p.png
核显状态
radeontop v1.4-4-gec97e6f, running on YELLOW_CARP bus 01, 120 samples/sec
│
Graphics pipe 7.50% │■■
───────────────────────────────────────────────┼─────────────────────────────────────────────
Event Engine 0.00% │
│
Vertex Grouper + Tesselator 0.00% │
│
Texture Addresser 7.50% │■■
│
Shader Export 0.00% │
Sequencer Instruction Cache 0.00% │
Shader Interpolator 7.50% │■■
│
Scan Converter 0.00% │
Primitive Assembly 0.00% │
│
Depth Block 0.00% │
Color Block 0.00% │
│
497M / 480M VRAM 103.42% │■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
288M / 1861M GTT 15.47% │■■■■■■
2.40G / 2.40G Memory Clock 100.00% │■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.69G / 2.40G Shader Clock 28.56% │■■■■■■■■■■■
│
引用
https://morefine.com/products/morefine-m600-mini-pc-amd-6900hx-6800u-6600u
https://www.amd.com/en/support/linux-drivers
https://forum.proxmox.com/threads/have-anyone-susscesfully-passthroughed-the-igpu-amd-radeon-680m-to-vm.119178/
近期评论