This tutorial was made for Gentoo, Arch and Fedora/RHEL base distros, this can be adapt for any distro open a pull request or a issue indicating the package name (or just use the manually way of install.
Note: The tool use in this guide were developer for Asus laptop if you are using a Asus laptop please refer to this link for other brands try this method
Note: Don't use on PopOS they have there own way of managing Optimus Laptop built in the distro!!!*
My Setup:
- Lenovo Legion 5 15ACH6H running Vanila Arch and Gentoo on two sepreate btrfs subvolume;
- The laptop need to stay in hybrid mode and iGPU set at minium to use 1Gbit of memory in the bios (call UMA in the bios);
- I also use the Nvidia dGPU as passthouth for a Windows 11 VM for this you need a HDMI (or Mini-DP/DP) dummy plug when you don’t have a external display (optional);
Prerequisite: have both igpu (Intel or AMD) and NVIDIA drivers install this guide dosent cover that.
- Gentoo:
Frist you need to add and sync zGentoo overlay
sudo eselect repository enable zGentoo
sudo emerge --sync -r zGentoo
Then you need to install supergfxctl:
sudo emerge --ask sys-power/supergfxctl
#To install gnome extension:
sudo emerge --ask gnome-extra/gnome-shell-extension-supergfxctl-gex
- Arch:
You have to opcion install AUR package manually or using a aur helper:
Using and Aur Helper to install the package:
#Using yay
sudo yay -Sy supergfxctl
#To install plasma tray icon:
sudo yay -Sy plasma6-applets-supergfxctl
#Using paru
sudo paru -Sy supergfxctl
#To install plasma tray icon:
sudo paru -Sy plasma6-applets-supergfxctl
Installing the package manually
git clone https://aur.archlinux.org/supergfxctl.git
cd supergfxctl
makepkg -Si
- Fedora/RHEL base distros:
#Ading Fedora copr repo
sudo dnf copr enable eyecantcu/supergfxctl
sudo dnf install supergfxctl
#To install gnome extension:
sudo dnf install gnome-shell-extension-supergfxctl-gex
#To install plasma tray icon:
sudo dnf install supergfxctl-plasmoid
- From source or other distros:
Find the name of the package on your distro or go to this link with instruction how to compile from source
You need to create this file /etc/supergfxd.conf
:
/etc/supergfxd.conf
----------------------
{
"mode": "Integrated", # choose between hybrid, integrated or vfio
"vfio_enable": true, # binds the dGPU to vfio for VM pass-through (optional is set to false by default)
"vfio_save": false, # save the vfio state
"compute_save": false, # only asus laptop
"always_reboot": false, # not necessary to reboot (changing from hybrid -> integrated -> vfio can required a reboot on some machines [pls test on yours if you use vfio])
"no_logind": true, # set to true if you have a login manager like sddm or lightdm
"logout_timeout_s": 180 #not need to change
}%
After this you only need to enable supergfxd.service and reboot
sudo systemctl enable supergfxd.service
NOTE: DONT FORGET TO CHANGE GRAPHIC MODE TO HYBRID IN THE BIOS
This is made using a kernel parameter:
- Grub:
/etc/default/grub
----------------------
# For the IGPU
...
GRUB_CMDLINE_LINUX_DEFAULT="... supergfxd.mode=integrated"
#For Hybrid
GRUB_CMDLINE_LINUX_DEFAULT="... supergfxd.mode=hybrid"
...
Then you just need to update Grub:
sudo update-grub
- Dracut:
/etc/dracut.conf.d/cmdline.conf or /etc/dracut.conf
----------------------
# For the IGPU
...
kernel_cmdline="... supergfxd.mode=integrated"
#For Hybrid
kernel_cmdline="... supergfxd.mode=hybrid"
...
Then you just need to update dracut:
#Gentoo
sudo emerge --config sys-kernel/gentoo-kernel-bin
#Arch
doas dracut --regenerate-all --force --uefi
In the supergfxctl repo we have this statement:
"ASUS G-Sync + ASUS GPU-MUX note: Some ASUS laptops are capable of using the dGPU as the sole GPU in the system which is generally to enable g-sync on the laptop display panel. This is controlled by asusctl at this time, and may be added to supergfxd later. If mux/g-sync is enabled then supergfxd will halt itself until it is disabled again."
Last time I try now it possible to use supergfxctl for dgpu mode on non Asus laptop [Tested on Lenovo Legion 5 gen 6]:
- Set superglfx mode to Hybrid:
supergfxctl -m Hybrid
Note: if you add Integrated to the cmdline you need to change it and probably rebuild the initramfs
- Reboot
If you get a black screen go back to hybrid and try to disable supergfxd.service and reboot to dGPU:
sudo systemctl disable supergfxd.service
If still getting a black screen you will need to unistall supergfxctl before changing to hybrid on your machine
- no warranty, use this tutorial at you own risk
Done