Configure Nvidia as the primary GPU in Fedora Linux 36.

Advertisement

Introduction


The goal is to enable the NVIDIA GPU in an Optimus-based laptop at all times and use it for every activity. Don't use this guide if you want to render your desktop with the integrated GPU and specifically select which applications will be rendered with the NVIDIA GPU.

Note: The steps listed here have been verified to work on Fedora 32 Workstation through Fedora 36 Workstation.

Note: As Prime works less satisfactorily with the Wayland server, follow the steps provided in this guide to configure the Xorg server by default.

Note: This guide requires that the Secure boot is off to load unsigned NVIDIA kernel modules.

To have all rendering default to the NVIDIA GPU, you need to follow the steps very carefully.

Why would you want to do that?


The use of NVIDIA GPU all the time would allow for smoother transitions and richer animation effects. Premium desktop environments like GNOME would benefit greatly from this.

Enabling the NVIDIA GPU all the time would lead to lower CPU load and memory consumption which would otherwise have been high due to the added in-memory video buffer.

Why wouldn't you want to do that?


With the NVIDIA GPU used all the time, there would be a slight increase in battery consumption, which shouldn't be a concern if your device is used while plugged in.

The increased heat output from the NVIDIA GPU being enabled all the time can be a concern. You wouldn't want to play AAA titles on the Proton while placing your laptop on your lap.

Step #1: Update from existing repositories

Execute

$ sudo dnf update

Last metadata expiration check performed 0:26:18 AM on Fri, Jul 1, 2022, 3:05:00 PM.
Dependencies resolved.
Nothing to do.
Ready!

Once to update all your packages first.

Step #2: Add the RPMFusion repository for NVIDIA drivers

Next, you need to add the RPM Fusion repository for the NVIDIA drivers. To do this, open GNOME Software and click the hamburger menu (three horizontal lines) in the top-right corner. Then, click Software Repositories in the drop-down menu. You'll see this.

Select RPM Fusion for Fedora 36 – Non-Free – NVIDIA Driver and ENABLE it. It requires elevated privileges, so enter your password and you're done.

Step #3: Update from the newly added repositories

Execute

$ sudo dnf update --refresh

To get all available updates from the newly added repository.

Step #4: Install the driver and its dependencies

Execute

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

To get the driver and all necessary dependencies.

Step #5: Wait for the kernel modules to load

You should wait 5 to 10 minutes for the kernel modules to load. Please do not proceed with the following steps immediately.

Advertisement

Step #6: Read from updated kernel modules

Execute

$ sudo dnf install akmods dracut
$ sudo akmods --force
$ sudo dracut --force

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

Step #7: Reboot your system

Wait 3 to 5 minutes for the changes to take effect, then restart your system.

Once your system has started, go to the About page in the Settings app. You'll likely see the following result.

This means that the driver installation was successful, leading to the detection of two different video accelerators: the integrated graphics card and the discrete graphics card.

Step #8: Edit the X1 configuration1

Run the following command to copy the display rendering details for X11.

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

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

Option "PrimaryGPU" "yes"

To the section OutputClass of the same.

For example, use elder brother

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

and make changes.

The file should look like this.

You can see the additions in both sections.

Save it using [Ctrl]+[S] and exit using [Ctrl]+[X].

Note: If you are using a display manager other than GDM (the default for Fedora Workstation), you will need to configure it appropriately. See the Arch wiki for instructions. For SDDM (KDE spin default) on Fedora 36, Arch wiki is incorrect and you need to edit the file /etc/sddm/Xsetup, No /usr/share/sddm/scripts/Xsetup.

Step #9: Reboot your system

Reboot your system and continue with the following steps to verify the configuration change.

Step #10: Verify the configuration

Open a terminal and type

glxinfo | egrep "OpenGL vendor|OpenGL renderer"

It should show your NVIDIA GPU.

Check with screenfetch.
$ screenfetch
Check your Settings app. You'll see something like this on the About page.

You can make other configuration changes using the NVIDIA X Server Settings app. Additionally, the GPU will show activity in its utilization percentage to indicate that it is actually working.

References

This how-to article is an improvement and translation from English to Spanish of the https://docs.fedoraproject.org website about Optimus Prime technology in Fedora Linux 36. https://docs.fedoraproject.org/en-US/quick-docs/how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops/

Our score
Click to rate this post!
(Votes: 0 Average: 0)
Advertisement
Share on social media...

Deja un comentario

Your email address will not be published. Required fields are marked *

Basic information on data protection
ResponsibleJavier Cachón Garrido +info...
PurposeManage and moderate your comments. +info...
LegitimationConsent of the concerned party. +info...
RecipientsAutomattic Inc., USA to spam filtering. +info...
RightsAccess, rectify and cancel data, as well as some other rights. +info...
Additional informationYou can read additional and detailed information on data protection on our page política de privacidad.

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.

Scroll al inicio

Descubre más desde javiercachon.com

Suscríbete ahora para seguir leyendo y obtener acceso al archivo completo.

Seguir leyendo