OCuLink and Thunderbolt 3/USB4 eGPU on Linux with GPD Win Max 2

On Windows 11 Radeon and Nvidia GPUs work via OCuLink and Thunderbolt 3. Nvidia does require a custom script to fix error 34 but it then does work. Intel Arc does not work for me with the OCuLink board I have, but it does work over TB3.

On Linux things get a bit more complicated due to GPU switching. Windows has much less hassle/problems with this.

eGPU on Linux

For open source drivers (xf86-video-nouveau, xf86-video-ati, xf86-video-amdgpu, xf86-video-intel) you will have to use PRIME to launch a given app or game on the external GPU. For Nvidia proprietary drivers you have to use the Nvidia settings app and for Wayland, it's also a bit different. ArchLinux has a wiki page for all of those cases.

Here is a short version using the open-source drivers and X11. We start with checking if both GPUs are detected and present in the system:

xrandr --listproviders

Providers: number : 2
Provider 0: id: 0x5a cap: 0x9, Source Output, Sink Offload crtcs: 4 outputs: 8 associated providers: 1 name:AMD Radeon Graphics @ pci:0000:68:00.0
Provider 1: id: 0x8e cap: 0x6, Sink Output, Source Offload crtcs: 4 outputs: 4 associated providers: 1 name:AMD Radeon Graphics @ pci:0000:03:00.0

Provider 0 should be the integrated graphics, while 1 should be the external one. If you are using eGPU with a laptop that already has a dGPU then you should get all three here.

To run an app on a specific GPU you use DRI_PRIME environment variable like so:

DRI_PRIME=1 ./Superposition

You can set it globally for the system in /etc/environment or for user in ~/.bashrc but it can end up with some problems (did not work on my setup). Gentoo wiki has more info on those options.

Thunderbolt 3 devices must be trusted by the system to work
Thunderbolt 3 devices must be set as trusted by the system to work

Test setup

I used GPD Win Max 2 laptop with 32GB LPDDR5x 7500MT/s RAM, Ryzen 7840U at 24W TDP. The graphics cards were connected over OCuLink and USB4/Thunderbolt 3 dock. OCuLink was limited to PCIe 3.0 x4, with 4.0 possible in a different setup which I didn't use, specific to some PCIe issues of this laptop.

Tests were done on Kubuntu 23.10 with some repeated on OpenSuSE Tumbleweed.

AMD Radeon graphics cards

Radeon cards seem to be the winner when it comes to Linux eGPU support. In my tests, RX 7600 worked over TB3/USB4 as well as OCuLink. Just like on Windows, there was a huge performance drop when tested over Thunderbolt.

I tested the setup using an external display connected to the eGPU and a second time while using the laptop's own screen. When a laptop screen is used some of the connection bandwidth is used to send the data back to the laptop display which lowers performance on Windows. On Linux for some reason I got better Superposition scores while running on the laptop's internal screen.

Linux eGPU Unigine Superposition
Linux eGPU Unigine Valley

Nvidia graphics cards

Radeon cards seem to be the winner when it comes to Linux eGPU support. In my tests, RX 7600 worked over TB3/USB4 as well as OCuLink. Just like on Windows, there was a huge performance drop when tested over Thunderbolt.

I tested the setup using an external display connected to the eGPU and a second time while using the laptop's own screen. When a laptop screen is used some of the connection bandwidth is used to send the data back to the laptop display which lowers performance on Windows. On Linux, for some reason, I got better Superposition scores while running on the laptop's internal screen.

NVRM: GPU 0000:01:00.0: RmInitAdapter failed! (0x26:0x56:1482)

With Thunderbolt 3 the eGPU was detected by proprietary drivers but after selecting Performance Mode and rebooting the system did not boot properly with error messages like:

calc_l12_pwron: Invalid T_PwrOn scale: 3
Nvidia PRIME settings
Nvidia PRIME settings
OpenSuSE hang during boot process with nouveau drivers
OpenSuSE hang during boot process with nouveau drivers

Kubuntu 23.10 as well as OpenSuSE had problems with the Nvidia card and in the end, I could not get it to work.

Intel ARC graphics cards

On Windows only Thunderbolt 3 worked, while on Linux I did not get it to work in any of the configurations. There were no error logs either or I'm missing something (tested on Kubuntu 23.10).

Comment article