Como Poner Nvidia como GPU Primario en Portátiles basados en Optimus

Akashdeep Dhar, Jun Aruga, Ankur Sinha Versión F37 Last review: 2022-09-12

Esta página analiza fuentes de software de terceros que no están afiliadas ni respaldadas oficialmente por el Proyecto Fedora. Úselas a su propia discreción. Fedora recomienda el uso de software libre y de código abierto, y evitar el software protegido por patentes.

Introducción

The goal is to have an active NVIDIA GPU on an Optimus-based laptop and use it for all activities on Desktops Environments with Xorg-X11. Avoid using this guide if you prefer to render your desktop with the integrated GPU and selectively choose applications to utilize the NVIDIA GPU.

Las instrucciones en este documento han sido verificadas para funionar en publicaciones de Fedora 32 Workstation y versiones posteriores que utilicen Xorg-X11.

Some guides on the internet recommend a different approach to installing Nvidia drivers on Fedora, such as directly using the binaries provided by Nvidia. However, the Fedora Project cannot guarantee that these will always function with every Fedora release. Therefore, we recommend following the steps outlined in this document instead.

As of Fedora 34, Wayland has become the default display server on Fedora Workstation for GNOME desktop environments. To follow the steps provided in this guide, you must be logged in to a session that runs on Xorg-X11.

Esta guía requiere la arranque seguro para estar apagado con turned off para cargar los módulos del kernel NVIDIA sin signo.

Para hacer todo análisis por defecto en la GPU NVIDIA, necesita seguir estos pasos muy cuidadosamente.

Primero, considere los puntos siguientes:

  • ¿Por qué desearía hacer esto?

    Using the NVIDIA GPU all the time allows for smoother transitions and richer animation effects. Premium desktop environments like GNOME benefit greatly from this.
    Enabling the NVIDIA GPU all the time leads to lower CPU load and memory consumption, which would otherwise be high due to the added in-memory video buffer.
  • ¿Por qué esto no sería ideal?

    Using the NVIDIA GPU all the time can cause a slight increase in battery consumption. This shouldn't be a concern if your device is plugged in while in use.
    The increased heat generation from the constantly enabled NVIDIA GPU might be a concern. You wouldn't want to play demanding games (AAA titles) on Proton while using your laptop on your lap.

Step #1: Update from the existing repositories

Ejecute

sudo dnf upgrade

Una vez que actualice todos sus paquetes primero.

how to set nvidia as primary gpu on optimus based laptops 0

Step #2: Add the RPMFusion repository for NVIDIA drivers

Then you need to add the RPM Fusion repository for NVIDIA drivers. To do that, open up GNOME Software and click on the hamburger menu (three horizontal lines) on the top-right corner. Then click on Software Repositories from the dropdown menu. There you will see this.

how to set nvidia as primary gpu on optimus based laptops 1

Select RPM Fusion for Fedora 32 - Nonfree - NVIDIA Driver and ENABLE it. It requires elevated privileges so enter your password and it will be done.

Step #3: Update from the newly added repositories

Ejecute

sudo dnf upgrade --refresh

to fetch all available updates from the newly added repository.

how to set nvidia as primary gpu on optimus based laptops 2

Step #4: Install the driver and its dependencies

Ejecute

sudo dnf install gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686

to get the driver and all necessary dependencies.

how to set nvidia as primary gpu on optimus based laptops 3

Step #5: Wait for the kernel modules to load up

You must wait 5-10 minutes for the kernel modules to load. Please do not proceed to the next steps immediately.

Step #6: Read from the updated kernel modules

Ejecute

sudo akmods --force
sudo dracut --force

This would force the configuration to be read from the updated kernel modules which now have the NVIDIA drivers in them.

Step #7: Reboot your system

Wait for 3-5 minutes for the changes to take effect and then reboot your system.

Log in to a session with Xorg-X11.

From the desktop, go to the About page in the Settings application. You are likely to see the following output.

how to set nvidia as primary gpu on optimus based laptops 4

This means that the driver installation was successful leading to the detection of two distinct video accelerators - internal and dedicated.

Step #8: Edit the X11 configuration

Please ensure that the xrandr package is installed before proceeding with this step:

sudo dnf install xrandr

Execute the following command to copy the display render details for the X11.

sudo cp -p /usr/share/X11/xorg.conf.d/nvidia.conf /etc/X11/xorg.conf.d/nvidia.conf

Once done, open up the nvidia.conf from the copy destination and edit it to add

Option "PrimaryGPU" "yes"

to the OutputClass section of it.

For example, use nano

sudo nano /etc/X11/xorg.conf.d/nvidia.conf

y haga los cambios.

The file should look like this. Your file should look similar to this.

how to set nvidia as primary gpu on optimus based laptops 5

You can see the additions in both sections.

Guárdalo utilizando [Ctrl]+[S] y salga utiliznado [Ctrl]+[X]

If you are using a display manager other than GDM (the default of Fedora Workstation), you will need to configure it appropriately. Please refer to the Arch wiki for instructions. For SDDM (the KDE spin default) on Fedora32, the Arch wiki is wrong, and you need to edit the /etc/sddm/Xsetup file, not /usr/share/sddm/scripts/Xsetup.

Paso 9: Rearranque su sistema

Rearranque su sistema y proceda a los pasos siguientes para verificar el cambio en la configuración.

Paso 10: Verifique la configuración

Abra un terminal y teclee

glxinfo | egrep "OpenGL vendor|OpenGL renderer"

Mostraría su GPU de NVIDIA.

how to set nvidia as primary gpu on optimus based laptops 6

Compruebe en screenfetch.

screenfetch

Mostraría su GPU NVIDIA bajo el nombre de GPU.

how to set nvidia as primary gpu on optimus based laptops 7

Compruebe en su aplicación de Opciones Verías algo así en la página Acerca de.

how to set nvidia as primary gpu on optimus based laptops 8

Puede hacer otro cambio de configuración utilizando la aplicación Opciones de Servidor NVIDIA X. Además el GPU mostraría actividad en su porcentaje de utilización para significar que de hecho está funcionando.

how to set nvidia as primary gpu on optimus based laptops 9

Referencias

Should you face issues while following these steps or if these do not match your use case, feel free to convey your queries on Fedora Forums.

Aquí están los enlaces que puede referir a para obtener más información.