我的电脑上有两个 GPU桌面计算机、Radeon VII 和 Radeon R7。
$ lspci -knn | grep -iA3 VGA
05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Oland PRO [Radeon R7 240/340 / Radeon 520] [1002:6613]
Subsystem: PC Partner Limited / Sapphire Technology Oland PRO [Radeon R7 240/340] [174b:e263]
Kernel driver in use: radeon
Kernel modules: radeon, amdgpu
--
0d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon VII] [1002:66af] (rev c1)
Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon VII] [1002:081e]
Kernel driver in use: amdgpu
Kernel modules: amdgpu
配置如下xorg.conf
-
Section "ServerLayout"
Identifier "Layout0"
Screen "Screen0" 0 1440
Screen "Screen1" 2560 1440
Screen "Screen2" 0 0
Screen "Screen3" 2560 0
Screen "Screen4"
Screen "Screen5"
Option "Xinerama" "false"
EndSection
Section "Monitor"
Identifier "HDMI-A-1"
Option "Primary" "true"
EndSection
Section "Monitor"
Identifier "DisplayPort-0"
EndSection
Section "Monitor"
Identifier "DisplayPort-1"
EndSection
Section "Monitor"
Identifier "DisplayPort-2"
EndSection
Section "Monitor"
Identifier "HDMI-A-0"
EndSection
Section "Monitor"
Identifier "DVI-D-0"
EndSection
Section "Device"
Identifier "Card0"
Driver "amdgpu"
BusID "PCI:13:0:0"
EndSection
Section "Device"
Identifier "Card1"
Driver "amdgpu"
BusID "PCI:13:0:0"
EndSection
Section "Device"
Identifier "Card2"
Driver "amdgpu"
BusID "PCI:13:0:0"
EndSection
Section "Device"
Identifier "Card3"
Driver "amdgpu"
BusID "PCI:13:0:0"
EndSection
Section "Device"
Identifier "Card4"
Driver "radeon"
BusID "PCI:05:0:0"
EndSection
Section "Device"
Identifier "Card5"
Driver "radeon"
BusID "PCI:05:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "HDMI-A-1"
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "DisplayPort-0"
EndSection
Section "Screen"
Identifier "Screen2"
Device "Card2"
Monitor "DisplayPort-1"
EndSection
Section "Screen"
Identifier "Screen3"
Device "Card3"
Monitor "DisplayPort-2"
EndSection
Section "Screen"
Identifier "Screen4"
Device "Card4"
Monitor "HDMI-A-0"
EndSection
Section "Screen"
Identifier "Screen5"
Device "Card5"
Monitor "DVI-D-0"
EndSection
我遇到的问题是两个 GPU 创建了两个独立的屏幕,我无法用鼠标从一个屏幕移动到另一个屏幕。
另一个问题是,当从配置中移除第二个 GPU 时,Vega II 允许我的窗口管理器将连接的 4 个显示器识别为单独的显示器。但是当两个 GPU 都配置为工作时,窗口管理器会将每个 GPU 识别为单独的显示器。
这些命令更清楚地说明了这个问题:
$ xrandr --listproviders --listmonitors
Providers: number : 1
Provider 0: id: 0x58 cap: 0x9, Source Output, Sink Offload crtcs: 6 outputs: 4 associated providers: 0 name:AMD Radeon VII @ pci:0000:0d:00.0
Monitors: 4
0: +*HDMI-A-1 2560/597x1440/336+0+1440 HDMI-A-1
1: +DisplayPort-0 2560/597x1440/336+2560+1440 DisplayPort-0
2: +DisplayPort-1 2560/597x1440/336+0+0 DisplayPort-1
3: +DisplayPort-2 2560/597x1440/336+2560+0 DisplayPort-2
$ DISPLAY=:0.1 xrandr --listproviders --listmonitors
Providers: number : 1
Provider 0: id: 0xb5 cap: 0x9, Source Output, Sink Offload crtcs: 2 outputs: 3 associated providers: 0 name:OLAND @ pci:0000:05:00.0
Monitors: 1
0: +*HDMI-0 1280/527x1024/296+0+0 HDMI-0
为什么第二个 GPU 会接收单独的屏幕,而不是作为另一个显示器添加到与第一个 GPU 上的前 4 个显示器相同的屏幕上?
此拆分设置的完整 Xorg 日志位于https://gist.github.com/kesor/217daebf0ffbd58c70e2b9ec3a9c8ea6
答案1
我想出了完成这项工作的方法,其中涉及 PRIME 的几个步骤。
部分文档位于https://wiki.archlinux.org/title/PRIME和其他地方。
最初的问题展示了两个 GPU,每个 GPU 都能够作为源输出和接收器卸载。以及多个 crtc(驱动监视器的数量)和实际输出。
Radeon VII 具有outputs: 4
和crtcs: 6
,并且它连接了 4 个物理显示器。三个通过 DisplayPort 连接,一个通过 HDMI 连接。
Radeon R7 具有otputs: 3
和crtcs: 2
。它只有一个通过 HDMI 连接的物理显示器,但它也有一个 VGA 和一个 DVI 连接。但它一次只能驱动 2 个显示器,即使/当您连接所有 3 个连接时也是如此。
现在对于实际的解决方案 - 可以让 VII 将其 crtcs 发送到 R7 的输出。
首先,删除配置第二个 GPU 的任何Monitor
或部分。但保留部分。Screen
Device/Card
然后,请注意两个提供商将出现在同一个 X-screen 上:
$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x58 cap: 0x9, Source Output, Sink Offload crtcs: 6 outputs: 4 associated providers: 1 name:AMD Radeon VII @ pci:0000:0d:00.0
Provider 1: id: 0xa5 cap: 0x6, Sink Output, Source Offload crtcs: 2 outputs: 3 associated providers: 1 name:AMD Radeon R7 200 Series @ pci:0000:05:00.0
记下每个提供商的 ID,并将 RII 设置为接收器,将 R7 设置为输出:
$ xrandr --setprovideroffloadsink 0xa5 0x58
这已经使第二个 HDMI(连接到 R7)正常工作,但还有另一个问题阻止它显示任何有用的内容。它基本上会显示损坏的像素。
问题出在内核驱动器上,因为原始问题一开始就显示了 PCI 设备,它还显示 R7 GPU 正在使用该radeon
驱动程序,而 VII GPU 正在使用该amdgpu
驱动程序。
我必须将该radeon
驱动程序添加到/etc/modprobe.d/...
计算机并重新启动计算机以将其列入黑名单,以便两个设备使用相同的驱动程序。
$ lspci -knn | grep -iA3 VGA
05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Oland PRO [Radeon R7 240/340 / Radeon 520] [1002:6613]
Subsystem: PC Partner Limited / Sapphire Technology Oland PRO [Radeon R7 240/340] [174b:e263]
Kernel driver in use: amdgpu
Kernel modules: radeon, amdgpu
--
0d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon VII] [1002:66af] (rev c1)
Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon VII] [1002:081e]
Kernel driver in use: amdgpu
Kernel modules: amdgpu
现在,R7 的 HDMI 输出可以用作 VII 的另一个输出。