All-ways-eGPU: Script for Wayland Linux Desktops
 
Notifications
Clear all

All-ways-eGPU: Script for Wayland Linux Desktops  

  RSS

nu_ninja
(@nu_ninja)
Reputable Member
Joined: 3 years ago
 

Introduction:

For Linux-based systems, desktops using Wayland have become more and more popular as a replacement for the X (Xorg) display server. Most recently, the transition of Ubuntu 21.04 to a Wayland-based GNOME desktop by default has made the most news, however many other distros and desktops exist using a Wayland protocol either optionally or by default. This includes desktops such as KDE Plasma, Weston and Sway.

If you have an Xorg based desktop, existing solutions such as gswitch or egpu-switcher allow for setting the eGPU as the primary display renderer for best performance and responsiveness. For Xorg desktops, these solutions are still the best option and should be preferred over this script. However, due to the nature of the Wayland protocol, there is not yet any universal way (at least as far as I know) to specify the primary GPU renderer for the compositor. This seems to be left to the specific way the compositor is implemented. Thus, GNOME's mutter may have a different process compared to Sway's wl-roots or KDE's KWin, etc.

This results in 2 options. Either the compositor could implement a specific way to control the primary renderer, or the user could use DRI_PRIME to offload rendering to a secondary GPU. Neither of these are optimal. The first requires specific work from the project developing the compositor and their specific method of control may not be the same as for other compositors. The second method of using DRI_PRIME (or similar offloading techniques) results in significantly reduced performance for eGPUs due to unnecessary transfer of display data across the eGPU's bandwidth-limited connection. The purpose of this script is to use a universal system that works across all compositors and enables maximum possible eGPU performance.

How does this script work?:

This script requests that the user disables their iGPU graphics device(s) at boot. This leaves the compositor no other choice except to use the eGPU when booting. This may seem like an extreme solution and it is in some ways, however, as this script was designed for portability across desktops and distros, this method makes for the most universal solution. Note that there is also an option to re-enable the iGPU device after login or if no other GPU is found (if the eGPU is not plugged in or not working).

In order to disable the iGPU graphics, their PCI Bus IDs and drivers are stored in /usr/share/all-ways-egpu/user-bus-ids, which is then used by the script to unbind the virtual terminals, drivers and finally PCIe device addresses.

It is again stressed that this script is focussed on maximum performance on eGPU connected displays. Displays connected to the iGPU such as the laptop’s internal display may stay blank.

Installation and Usage:

Installation of the script can be done with the following one-line command in the terminal:

[Please login to see this]

After installing, setup the script with the following command:

[Please login to see this]

After following the prompts, the script should now be ready to use. If you have the eGPU connected, you may try it out by manually switching to the eGPU.

[Please login to see this]

If this works, you may configure the script to automatically switch every bootup:

[Please login to see this]

That’s all that needs to be done. More info can be found in the `help` command or on the github project page: https://github.com/ewagner12/all-ways-egpu

Final Notes:

Wayland based desktops have continued to pick up steam and become more stable. Some have even started adding GPU hot-plugging support, though none can currently switch the primary rendering GPU without restarting the display manager. However, not every desktop can implement every feature. This script was made to specifically bring the best possible eGPU performance to all Linux desktops without needing any changes. However, this comes with the shortcomings that iGPU connected displays (such as the laptop’s screen) and anything requiring the iGPU may not work while in this mode. As a result, nearly any other method of enabling the eGPU as primary is preferable to this one. Xorg desktop users should stick with gswitch or egpu-switcher. Gnome Wayland users may try gnome-egpu and Sway users should try sway-eGPU-setup. But if none of these work for your particular desktop, all-ways-egpu is the solution that should always work to get the most out of any eGPU connected displays.

Mid-2012 13" Macbook Pro (MacBookPro9,2) TB1 -> RX 460/560 (AKiTiO Node/Thunder2)
+ macOS 10.15+Win10 + Linux Mint 19.1

 
2012 13" MacBook Pro [3rd,2C,M] + RX 460 @ 10Gbps-TB1 (AKiTiO Thunder2) + macOS 10.14.4 [build link]  


itsage, mac_editor, nando4 and 1 people liked
ReplyQuote
Topic Tags
nu_ninja
(@nu_ninja)
Reputable Member
Joined: 3 years ago
 

@lennox84 @raggamuffin

This script should work with KDE Plasma's Wayland desktop specifically.

Mid-2012 13" Macbook Pro (MacBookPro9,2) TB1 -> RX 460/560 (AKiTiO Node/Thunder2)
+ macOS 10.15+Win10 + Linux Mint 19.1

 
2012 13" MacBook Pro [3rd,2C,M] + RX 460 @ 10Gbps-TB1 (AKiTiO Thunder2) + macOS 10.14.4 [build link]  


Lennox84 liked
ReplyQuote
Lennox84
(@lennox84)
Active Member
Joined: 7 months ago
 

@nu_ninja, OMG!!!

 

That's it, it's official... I'm in love with you (Purely your eGPU.io persona tho hahaha)

 

I'll try this out in a few hours but if this works a need a donation link or something to reward you for your efforts Starry Eyes Smile  

 

Big thanks

 

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
Lennox84
(@lennox84)
Active Member
Joined: 7 months ago
 

O.K. Tried it on my Fedora 34 KDE spin and...

No go yet. Raised and issue on GitHub and will work with Ninja to get this going.

Looking forward to hearing of other testing it.

Didn't not harm my system, rebooted and everything was back to normal (Obviously I didn't do the last step to make it permanent)

Hoping to get this working... Sooooo excited

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
Lennox84
(@lennox84)
Active Member
Joined: 7 months ago
 

UPDATE: After a recommendation from @nu_ninja I:

A) Changed my display manager from SDDM to GDM (I tried LightDM which ninja said would work but I didn't have any luck with it. I booted but the Login screen did not come up so I couldn't continue any further with it and dropped down to TTY to reverse the switch and went with GDM)

B) Tried the eGPU script and had what was expected with only the External display working. I tried to enable the Laptop screen as well which was doable in Display Settings but ended up hanging the system so for the moment I would recommend against it Wink  

C) Noticed a change in laptop fans running lower so it seems like the load has shifted, my Ext performance isn't much better than when I was running mirrored but the system is less loaded which is a positive.

 

Love to see others give this a try and put up some feedback. Hopefully, we can make this work better moving forward. I'm personally happy to put some $$ behind it if it'll help so that a dev or devs can spend their time on it Smile  

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
nu_ninja
(@nu_ninja)
Reputable Member
Joined: 3 years ago
 

Glad you got it at least somewhat working! If you want to enable the laptop screen you can do the switch internal command after you've logged in with the egpu and it should bring up the internal screen while still keeping the eGPU as primary.

Definitely would like to see people try it out. I'm not a pro dev or anything, just one guy with an old macbook who likes to make things work. But the more machines testing it out, the better. 

Mid-2012 13" Macbook Pro (MacBookPro9,2) TB1 -> RX 460/560 (AKiTiO Node/Thunder2)
+ macOS 10.15+Win10 + Linux Mint 19.1

 
2012 13" MacBook Pro [3rd,2C,M] + RX 460 @ 10Gbps-TB1 (AKiTiO Thunder2) + macOS 10.14.4 [build link]  


Lennox84 liked
ReplyQuote
Lennox84
(@lennox84)
Active Member
Joined: 7 months ago
 

@nu_ninja, As always Thanks soooo much. I appreciate you doing what you've already done.

 

I'll start running some comparison benchmarks soon so people (and we) can see the differences between the setups and also comparatively against windows so we know the goal post. I'll be doing this as I also finally document my build for this site and my signature lol.

 

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote