Amd nvidia hybrid linux

Hybrid graphics

This article has been flagged for not conforming to the wiki guidelines (Second person language). Please help out, if possible.

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

  • 1 When are hybrid graphics useful?
  • 2 Basic setup
  • 3 AMD CPU with iGPU/Nvidia dGPU
  • 4 Nvidia dGPU
    • 4.1 Nvidia PRIME
      • 4.1.1 PRIME on X server 1.20.7 and newer
      • 4.1.2 PRIME on older X Server versions
      • 4.1.3 Choosing when to use the Nvidia dGPU
      • 4.2.1 Dynamic power management
        • 4.2.1.1 Ampere and Newer
        • 4.2.1.2 Older than Ampere
        • 4.2.2.1 Kernels 5.5 and newer
        • 4.2.2.2 Kernels prior to version 5.5

        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. [1]
        • Maximizing battery life is a priority.
        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:

         
        VIDEO_CARDS="nvidia amdgpu radeonsi" 

        Nvidia dGPU

        The most common configurations will be one of the following:

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

        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 you can have your X display server running on your iGPU and save the use of 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. " [2]

        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:

        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.

        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 '/etc/X11/xorg.conf.nvidia-xconfig-original' 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-/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:

        __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

        For more information on the keys available to set, see /usr/share/doc/nvidia-drivers-/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.

        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)

        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 [3] , 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:

         
        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
         
        # Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind ACTION=="bind", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x030000", TEST=="power/control", ATTRpower/control>="auto" ACTION=="bind", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x030200", TEST=="power/control", ATTRpower/control>="auto" # Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind ACTION=="unbind", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x030000", TEST=="power/control", ATTRpower/control>="on" ACTION=="unbind", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x030200", TEST=="power/control", ATTRpower/control>="on" 
        Kernels prior to version 5.5

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

         
        # Remove NVIDIA USB xHCI Host Controller devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x0c0330", ATTRremove>="1" # Remove NVIDIA USB Type-C UCSI devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x0c8000", ATTRremove>="1" # Remove NVIDIA Audio devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTRvendor>=="0x10de", ATTRclass>=="0x040300", ATTRremove>="1" 

        as per /usr/share/doc/nvidia-drivers-/html/dynamicpowermanagement.html

        Testing

        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.

        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?

        See also

        • Nouveau — the open source driver for NVIDIA graphic cards.
        • NVIDIA/nvidia-drivers — The x11-drivers/nvidia-drivers package contains the proprietary graphics driver for NVIDIA graphic cards.
        • NVIDIA/Bumblebee — an open source implementation of NVIDIA Optimus.
        • AMDGPU — the next generation family of open source graphics drivers using the new Display Core (DC) framework for Vega GPUs and Raven Ridge GPUs. It is however also capable of handling newer AMD/ATI Radeon graphics cards based on GCN1.0+, namely the Southern Islands, Sea Islands, Volcanic Islands, and Arctic Islands chipsets.

        External resources

        • http://www.ashmew2.me/#adventures_nvidia - Experiences with setting up a hybrid graphics setup and running into multiple problems.
        • https://github.com/Bumblebee-Project/bumblebee-gentoo/ - Bumblebee Overlay
        • https://wiki.archlinux.org/index.php/PRIME - Arch documentation on switchable graphics using either the Nvidia or AMD open source or closed source drivers
        • https://www.linux.ncsu.edu/bumblebee/ - More Fedora documentation on switchable graphics

        References

        1. ↑ PRIME works with both NVIDIA Optimus and AMD technology https://www.linux.ncsu.edu/bumblebee/
        2. ↑ 'Configure the X Server' /usr/share/doc/nvidia-drivers-/html/primerenderoffload.html
        3. ↑ 'Driver Settings' usr/share/doc/nvidia-drivers-/html/dynamicpowermanagement.html
        4. ↑ 'Automated Setup' /usr/share/doc/nvidia-drivers-/html/dynamicpowermanagement.html
        5. ↑ 'Automated Setup' /usr/share/doc/nvidia-drivers-/html/dynamicpowermanagement.html

        Источник

        Читайте также:  Отобразить команды в линукс
Оцените статью
Adblock
detector