Hybrid graphics

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

This page details the system management of NVIDIA or AMD switchable graphics and Intel hybrid graphics.

When are hybrid graphics useful?

  • The display is connected to the iGPU (Integrated Graphics Processing Unit).
  • There is no hardware multiplexer available (and therefore no BIOS/Firmware option to switch to one of the cards).
  • NVIDIA or AMD cards and Intel SOC are the two graphic cards on the device.
  • Maximizing battery life is a priority.


user $xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x6e cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel
Provider 1: id: 0x45 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 0 name:Unknown 
AMD Radeon GPU @ pci:0000:01:00.0

Basic setup

Make sure the appropriate drivers installed. If the correct drivers are not installed random crashes may occur when turning on external screens, or manual configuration of something like PRIME Render may seem to be the only way to force certain outputs to work when in reality the amdgpu and radeonsi drivers were not installed.

AMD CPU with iGPU/Nvidia dGPU

For an AMD CPU with an iGPU, it is important to ensure the following set is present in the make.conf:

FILE /etc/portage/make.confSet correct GPUs
VIDEO_CARDS="nvidia amdgpu radeonsi"

Nvidia dGPU

The most common configurations will be one of the following:

  • Intel iGPU/Nvidia dGPU
  • AMD iGPU/Nvidia dGPU

When the package x11-drivers/nvidia-drivers is installed, the driver documentation can be found at

/usr/share/doc/nvidia-drivers-<driver version>/html/index.html

The following will reference pages in that documentation for more information. All of the configuration settings come from the documentation provided by Nvidia.

Nvidia PRIME

"PRIME render offload is the ability to have an X screen rendered by one GPU, but choose certain applications within that X screen to be rendered on a different GPU."

This means that the X display server will run on the iGPU and save the use of the dGPU for graphics intensive tasks such as playing games. Fortunately on X server 1.20.7 and newer this should setup automatically.

PRIME on X server 1.20.7 and newer

"On systems with both an integrated GPU and an NVIDIA discrete GPU, the X.Org X server version 1.20.7 and newer will automatically use NVIDIA's PRIME render offload..." [1]

On X server 1.20.7 and newer, PRIME should be configured to work by default. The iGPU will offload rendering of specific tasks to the dGPU with very little configuration required.

To check if it is automatically configured:

user $xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x58 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 6 associated providers: 1 name:AMD Radeon Graphics @ pci:0000:34:00.0
Provider 1: id: 0x1fc cap: 0x2, Sink Output crtcs: 4 outputs: 1 associated providers: 1 name:NVIDIA-G0

The output should list a NVIDIA-G0 like above.

PRIME on older X Server versions

"NVIDIA's PRIME render offload support requires X.Org xserver version 1.20.7 or newer." The X server must be newer than 1.20.7

The nvidia-xconfig (provided by the package x11-drivers/nvidia-drivers ) tool has the flag --prime which will write a configuration to /etc/X11/Xorg.conf that should setup Nvidia PRIME.

root # nvidia-xconfig --prime

Using X configuration file: "/etc/X11/xorg.conf".

VALIDATION ERROR: Data incomplete in file /etc/X11/xorg.conf.
                  At least one Device section is required.

X Configuration file set up for PRIME. Please run "xrandr
--setprovideroutputsource modesetting NVIDIA-0" and "xrandr --auto" to enable.
See the README for more details.
Option "AllowEmptyInitialConfiguration" "True" added to Screen "Screen0".
Backed up file '/etc/X11/xorg.conf' as
Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup'
New X configuration file written to '/etc/X11/xorg.conf'

For more information see: /usr/share/doc/nvidia-drivers-<driver version>/html/primerenderoffload.html

Choosing when to use the Nvidia dGPU

To enable all OpenGL and Vulkan apps run on the Nvidia dGPU, add the following to the /etc/environment file:

FILE /etc/environmentUse Nvidia dGPU for Vulkan and OpenGL apps

For more information on the keys available to set, see /usr/share/doc/nvidia-drivers-<driver version>/html/primerenderoffload.html

To do this on a per application basis, use the program prime-run provided by the package x11-misc/prime-run

Combined with glxinfo which is provided by the package x11-apps/mesa-progs, the GPU that is being used to render OpenGL applications, in this case it is the dGPU.

user $prime-run glxinfo | grep "OpenGL renderer string"
OpenGL renderer string: NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2

Or in the terminal preface the command like so (this is what prime-run is doing)

user $__GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep "OpenGL renderer string"
OpenGL renderer string: NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2

Completely powering down the Nvidia dGPU

It is possible to completely turn off the Nvidia dGPU with minimal adjustments in the settings.

This is notably simpler on Ampere cards and newer models, as the default configuration options have this almost completely setup. Nonetheless, it is also feasible to accomplish this on older cards.

To achieve this, the dynamic power management feature must be enabled. Configuring this feature will maximize laptop battery life.

Dynamic power management

Ampere and Newer

Ampere and newer Nvidia GPU's use the configuration option NVreg_DynamicPowerManagement=0x03 by default [2], so no additional settings are necessary in /etc/modprobe.d/nvidia.

Older than Ampere

If the Nvidia GPU is older than Ampere then add the following:

FILE /etc/modprobe.d/nvidia-pm.confEnabling dynamic power management
options nvidia \
    NVreg_DynamicPowerManagement=0x02 \

Please note that on older hardware the option 0x03 will disable dynamic power management!

udev rules

To completely turn off the dGPU, add a few udev rules:

Kernels 5.5 and newer

Add the following:

FILE /lib/udev/rules.d/80-nvidia-pm.rulesAdding udev rules
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto"

# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on"
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"


Kernels prior to version 5.5

In addition to the rules added above, add the following:

FILE /lib/udev/rules.d/80-nvidia-pm.rulesAdding udev rules
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1"

# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"

# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{remove}="1"


as per /usr/share/doc/nvidia-drivers-<driver version>/html/dynamicpowermanagement.html


To test if the dGPU is powering down, use the tool nvidia-smi which is part of the x11-drivers/nvidia-drivers when compiled with the tools USE flag.

user $nvidia-smi
Sun Feb  5 16:49:23 2023       
| NVIDIA-SMI 525.85.05    Driver Version: 525.85.05    CUDA Version: 12.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   46C    P8    N/A /  35W |   1001MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |

The N/A / 35W in the example above indicates that the dGPU is turned off.

Points to note

Here are a few points to note:

  • Executing nvidia-smi will turn the dGPU on.
  • Sensor programs that probe for something like the temperature of the dGPU will turn it on.
  • When the dGPU turns on it can cause stuttering.

Other options that are available?

Bumblebee does not work correctly with Nouveau.

See also

External resources


  1. 'Configure the X Server' /usr/share/doc/nvidia-drivers-<driver version>/html/primerenderoffload.html
  2. 'Driver Settings' usr/share/doc/nvidia-drivers-<driver version>/html/dynamicpowermanagement.html
  3. 'Automated Setup' /usr/share/doc/nvidia-drivers-<driver version>/html/dynamicpowermanagement.html
  4. 'Automated Setup' /usr/share/doc/nvidia-drivers-<driver version>/html/dynamicpowermanagement.html