supergfxctl manual

supergfxctl

You need this only if you:

  1. have a laptop that can't suspend its dGPU
  2. need an easy way to use vfio
  3. want to monitor the dGPU status
  4. want to try using hotplug and/or ASUS ROG dgpu_disable (results will vary)
  5. have an ASUS with an eGPU and need to switch to it (testing required please)

Xorg is no-longer supported (but supergfxd still works with it)

supergfxd can switch graphics modes between:

  • Hybrid, enables dGPU-offload mode
  • Integrated, uses the iGPU only and force-disables the dGPU
  • Vfio, binds the dGPU to vfio for VM pass-through

If rebootless switch fails: you may need the following:

sudo sed -i 's/#KillUserProcesses=no/KillUserProcesses=yes/' /etc/systemd/logind.conf

ASUS ROG Flow series only

  • AsusEgpu, this is for certain ASUS laptops like 13" Flow to enable external GPU. The option shows up automatically if detected.

Other ASUS gaming laptops

  • AsusMuxDgpu, toggle the ASUS MUX to use dGPU as primary. The option shows up automatically if detected. (A reboot is always required due to how this works in ACPI)
  • hotplug_type config option, see end of this doc.

This switcher conflicts with other gpu switchers like optimus-manager, suse-prime or ubuntu-prime, system76-power, and bbswitch. If you have issues with supergfxd always defaulting to integrated mode on boot then you will need to check for stray configs blocking nvidia modules from loading in:

  • /etc/modprobe.d/
  • /usr/lib/modprope.d/

ASUS laptops require a kernel 6.1.x or newer.

Runtime D3

Most Nvidia laptops support different levels of runtime power management that can prolong battery life. These have been buggy in some use cases, so they are not set by default. To configure these, copy this text into a file other than supergfxd.conf in /etc/modprobe.d/ and modify it to meet your needs.

# 0x00 - no power management, 0x01 - coarse power management, 0x02 - fine power management
options nvidia NVreg_DynamicPowerManagement=0x02

More information is available here.

Building

First you need to install the dev packages required.

  • Debian/Ubuntu: sudo apt update && sudo apt install curl git build-essential
  • Fedora/RHEL: sudo dnf upgrade && sudo dnf install curl git && sudo dnf groupinstall "Development Tools"
  • Arch/Manjaro: sudo pacman -Syu && sudo pacman -S curl git base-devel

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

Clone supergfxctl repository

git clone https://gitlab.com/asus-linux/supergfxctl.git

Install supergfxctl

cd supergfxctl
make && sudo make install

Enable and start the service

sudo systemctl enable supergfxd.service --now

Add user to group

Depending on your distro add your username to one of adm, users, wheel then refresh your session (easiest way is to reboot).

  • sudo usermod -a -G users $USER

Switch GPU modes

  • Switching to/from Hybrid mode requires a logout only. (no reboot)
  • Switching between integrated/vfio is instant. (no logout or reboot)
  • Mode can be set via kernel cmdline with supergfxd.mode=. Capitalisation does not matter.
GPU ModesCommand
Integratedsupergfxctl --mode Integrated
Hybridsupergfxctl --mode Hybrid
VFIOsupergfxctl --mode Vfio
AsusEgpusupergfxctl --mode AsusEgpu
AsusMuxDgpusupergfxctl --mode AsusMuxDgpu

supergfxctl

supergfxctl --help
Optional arguments:
  -h, --help         print help message
  -m, --mode         Set graphics mode
  -v, --version      Get supergfxd version
  -g, --get          Get the current mode
  -s, --supported    Get the supported modes
  -V, --vendor       Get the dGPU vendor name
  -S, --status       Get the current power status
  -p, --pend-action  Get the pending user action if any
  -P, --pend-mode    Get the pending mode change if any

Config options /etc/supergfxd.conf

  1. mode: : any of supported modes, must be capitalised
  2. vfio_enable : enable vfio switching for dGPU passthrough
  3. vfio_save : save vfio state in mode (so it sticks between boots)
  4. always_reboot : always require a reboot to change modes (helps some laptops)
  5. no_logind : don't use logind to see if all sessions are logged out and therefore safe to change mode. This will be useful for people not using a login manager. Ignored if always_reboot is set.
  6. logout_timeout_s : the timeout in seconds to wait for all user graphical sessions to end. Default is 3 minutes, 0 = infinite. Ignored if no_logind or always_reboot is set.
  7. hotplug_type : None (default), Std, or Asus. Std tries to use the kernel hotplug mechanism if available, while Asus tries to use dgpu_disable if available

You must restart the service if you edit the config file

Changing hotplug_type requires a reboot to ensure correct state, for example if you were in integrated mode with hotplug_type = Asus and changed to hotplug_type = None you would not have dGPU available until reboot.

Graphics switching notes

ASUS G-Sync + ASUS GPU-MUX note: This can also be set by asusctl. If you don't require anything but Hybrid mode usually, then asusctl may be the better option for you if you also want the ability to toggle the MUX sometimes.

vfio note: The vfio modules must not be compiled into the kernel, they need to be separate modules. If you don't plan to use vfio mode then you can ignore this otherwise you may need a custom built kernel.

Legal Matters

ASUS and ROG Trademark is either a US registered trademark or trademark of ASUSTeK Computer Inc. in the United States and/or other countries.

Reference to any ASUS products, services, processes, or other information and/or use of ASUS Trademarks does not constitute or imply endorsement, sponsorship, or recommendation thereof by ASUS.

The use of ROG and ASUS trademarks within this website and associated tools and libraries is only to provide a recognisable identifier to users to enable them to associate that these tools will work with ASUS ROG laptops.

Privacy Policy

We use Matomo

Matomo is an open source web analytics platform. A web analytics platform is used by a website owner in order to measure, collect, analyse and report visitor data for purposes of understanding and optimizing their website.

Purpose of the processing

Matomo is used to get an idea how our website is used by our users so we can optimize things further so that the user may find the most relevant information more quickly.

Data Matomo is processing

  • User IP address
  • Optional User ID
  • Date and time of the request
  • Title of the page being viewed
  • URL of the page being viewed
  • Referrer URL
  • Screen resolution being used
  • Time in local user’s timezone
  • Files that were clicked and downloaded
  • Links to an outside domain that were clicked
  • Page generation time
  • User location: country, region, city, approximate latitude and longitude
  • Main Language of the browser being used
  • User Agent of the browser being used

Pick up the one you are using:

  • Cookies
  • IP address
  • User ID
  • Custom Dimensions
  • Custom Variables
  • Location of the user

And also:

  • Date and time
  • Title of the page being viewed
  • URL of the page being viewed
  • URL of the page that was viewed prior to the current page
  • Screen resolution
  • Time in local timezone
  • Files that were clicked and downloaded
  • Link clicks to an outside domain
  • Pages generation time
  • Country, region, city
  • Main Language of the browser
  • User Agent of the browser

This list can be completed with additional features such as:

  • Form interactions
  • Media interactions
  • A/B Tests

The processing of personal data with Matomo is based on legitimate interests

If you wish us to not process any personal data with Matomo, you can opt-out from it at any time. There will be no consequences at all regarding the use of our website.

You can withdraw at any time your consent by clicking here

The right to lodge a complaint with a supervisory authority

If you think that the way we process your personal data with Matomo analytics is infringing the law, you have the right to lodge a complaint with a supervisory authority.

We are not doing any profiling.