#239 Added "How to Set NVIDIA as Primary GPU on Optimus-based Laptops" docs and assets
Closed 3 years ago by t0xic0der. Opened 3 years ago by t0xic0der.
Unknown source master  into  master

file modified
+3 -8
@@ -1,17 +1,13 @@

  * xref:howto-file-a-bug.adoc[How to file a bug]

  

- 

  * xref:getting-started-guide.adoc[Getting started with Fedora]

  

- 

  * Installation

  ** xref:creating-and-using-a-live-installation-image.adoc[Creating and using a live installation image]

  ** xref:raspberry-pi.adoc[Fedora on Raspberry Pi]

  ** xref:anaconda/anaconda.adoc[Anaconda: the Fedora installer]

  *** xref:anaconda/anaconda_logging.adoc[Anaconda Logging]

  

- 

- 

  * Usage and customisation

  ** xref:dnf.adoc[Using the DNF software package manager]

  ** xref:repositories.adoc[Fedora Repositories]
@@ -47,28 +43,27 @@

  ** xref:firewalld.adoc[Controlling network traffic with firewalld]

  ** xref:managing-keyboard-shortcuts-for-running-app-in-gnome.adoc[Managing keyboard shortcuts for running an application in GNOME]

  ** xref:creating-a-disk-partition-in-linux.adoc[Creating disk partitions]

- ** xref:bumblebee.adoc[NVIDIA Optimus Bumblebee]

  ** xref:reset-root-password.adoc[Resetting a root password]

  ** xref:using-aide.adoc[Checking file integrity with AIDE]

  ** xref:getting-started-with-apache-http-server.adoc[Getting started with Apache HTTP Server]

  ** xref:how-to-edit-iptables-rules.adoc[How to edit iptables rules]

  

+ * NVIDIA

+ ** xref:bumblebee.adoc[NVIDIA Optimus Bumblebee]

+ ** xref:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops.adoc[How to Set NVIDIA as Primary GPU on Optimus-based Laptops]

  

  * xref:getting-started-with-selinux.adoc[SELinux]

  ** xref:changing-selinux-states-and-modes.adoc[Changing SELinux states and modes]

  ** xref:troubleshooting_selinux.adoc[Troubleshooting SELinux]

  

- 

  * xref:upgrading.adoc[Upgrading to a new release]

  ** xref:dnf-system-upgrade.adoc[Upgrading Fedora using the DNF system upgrade]

  

- 

  * xref:kernel/overview.adoc[Kernel]

  ** xref:kernel/troubleshooting.adoc[Troubleshooting]

  ** xref:kernel/build-custom-kernel.adoc[Building a Custom Kernel]

  ** xref:kernel/howto-kernel-testday.adoc[Guide for Kernel Test Days]

  

- 

  * Virtualization

  ** xref:getting-started-with-virtualization.adoc[Getting started with virtualization (libvirt)]

  ** xref:installing-virtual-systems-with-gnome-boxes.adoc[Installing virtual operating systems with GNOME Boxes]

@@ -0,0 +1,149 @@

+ = How to Set Nvidia as Primary GPU on Optimus-based Laptops

+ 

+ include::{partialsdir}/3rdparty-message.adoc[]

+ 

+ === Introduction

+ The objective is to enable NVIDIA GPU of an Optimus-based laptop *all the time* and use it for every single activity.

+ Please do not use this guide if you want to render your desktop using the integrated GPU and specifically select applications to be rendered using the NVIDIA GPU.

+ 

+ NOTE: The steps listed here have been verified to be working on Fedora 32 Workstation. Please update your installation to include your experiences and any other tweaks that may be needed if you are using any other desktop environments.

+ 

+ NOTE: As Prime works less satisfactorily with Wayland server, following the steps provided in this guide would default the server to Xorg.

+ 

+ WARNING: This guide requires the secure boot to be **turned off** to load up the unsigned NVIDIA kernel modules.

+ 

+ In order to make all the rendering default to the NVIDIA GPU, you need the follow the steps very carefully.

+ 

+ First, you need to see if you really want to achieve this.

+ 

+ ==== Why would you want to do that?

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

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

+ 

+ ==== Why would you not want to do that?

+ 1. With the NVIDIA GPU used all the time, there would be a slight increase in battery consumption which should not be a concern if your device is used while being plugged in.

+ 2. Increased generation of heat from the all-the-time enabled NVIDIA GPU can be worrisome. You would not want to play AAA-titles on Proton while placing your laptop on your lap.

+ 

+ === Step #1: Update from the existing repositories

+ Execute

+ ----

+ sudo dnf update

+ ----

+ once to update all your packages first.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-0.png[]

+ 

+ === 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.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-1.png[]

+ 

+ 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

+ Execute

+ ----

+ sudo dnf update --refresh

+ ----

+ to fetch all available updates from the newly added repository.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-2.png[]

+ 

+ === 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-libs xorg-x11-drv-nvidia-libs.i686

+ ----

+ to get the driver and all necessary dependencies.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-3.png[]

+ 

+ === 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

+ Execute

+ ----

+ 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.

+ 

+ Once your system has started, go to the *About* page in the *Settings* application. You are likely to see the following output.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-4.png[]

+ 

+ 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

+ 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 every section of it.

+ 

+ For example, using `nano`

+ ----

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

+ ----

+ and make changes.

+ 

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

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-5.png[]

+ 

+ You can see the additions in both sections.

+ 

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

+ 

+ === Step #9: Reboot your system

+ Reboot your system and proceed to the next steps to verify the change in configuration.

+ 

+ === Step #10: Verify the configuration

+ Open a terminal and type in

+ ----

+ glxinfo | egrep "OpenGL vendor|OpenGL renderer"

+ ----

+ It should show your NVIDIA GPU.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-6.png[]

+ 

+ Check on `screenfetch`.

+ ----

+ screenfetch

+ ----

+ It should show your NVIDIA GPU under the GPU name.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-7.png[]

+ 

+ Check in your *Settings* application.

+ You would see something like this in the *About* page.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-8.png[]

+ 

+ You can make other configuration changes using *NVIDIA X Server Settings* application.

+ Also the GPU would show activity in its utilization percentage to signify that it is actually working.

+ 

+ image:how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops-9.png[]

+ 

+ === References

+ Should you face issues while following these steps or if these do not match your use case,

+ feel free to convey your queries on https://ask.fedoraproject.org[Fedora Forums].

+ 

+ Here are the links you can refer to for obtaining more information.

+ 

+ 1. https://rpmfusion.org/Howto/Optimus[RPMFusion's Optimus How-to guide]

+ 2. https://rpmfusion.org/Howto/NVIDIA[RPMFusion's NVIDIA How-to guide]

+ 3. https://unix.stackexchange.com/questions/16407/how-to-check-which-gpu-is-active-in-linux[GPU Activity on UNIX StackExchange]

+ 4. https://www.reddit.com/r/Fedora/comments/bw4b0p/how_to_fedora_nvidia_prime/[Fedora Subreddit (zvitaly’s response only)]

+ 

+ Please do not refer to the misleading information available on this site https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/

10 images and 1 asciidoc. Made slight changes to the writeup to sound neutral.

This isn't needed, the commit log shows who the author of the document is.

"The objective is to use the Nvidia GPU all the time. If you are looking to only use the Nvidia GPU for selected applications, please refer to... "?

I am sorry I did not get you. What is not needed you say?

I have referred to the RPMFusion's NVIDIA How-to guide. Should I edit it to fall in line with those lines you added?

Since it uses proprietary software, you need to include the "third party" header. Copy it from "setup_rpmfusion".

This is subjective, so it isn't needed. It works quite well for people with nouveau too.

Better to say "The steps listed here have been verified on a Fedora 32 Workstation. If you use them on other Desktop Environments, please update it to include your experiences and any other tweaks that may be needed".

Is this needed here? You're asking them to update in step 3 again anyway.

Make the section headings more informative? "Step 2: Enable the Nvidia RPMFusion repository"?

It doesn't list, it runs the update. dnf check-update lists updates. Remove "of yours".

"to install the drivers and other necessary software". Remove "This command .."

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

That secure boot needs to be disabled for this to work should be stated right at the top of this document so that people do not run all these steps if they do not want to disable it.

Just say "Restart your system". They're using the workstation, no reason to use the command line to reboot.

This should also be mentioned right at the start of the document. Also, your document header implies that Nvidia will be used for everything, no? So this may confuse end-users.

Remove "do not panic..". Just say "Your file should look similar to this."

"Reboot your system, and proceed to the next steps to verify the change in configuration"

Rephrase "It should show your discrete GPU". Perhaps better to write "Nvidia GPU" instead of "discrete GPU" everywhere?

How does one check on screenfetch? If it is a command line utility, list the steps as you've done above.

General comments:

  • Put each sentence on a new line, that makes working with git easier since git does line-by-line diffs.
  • The images do not show. Check the other sources on how to refer to them correctly.
  • Please add this to the nav.adoc file so users can see it listed in the side bar. Perhaps after the "Optimus" entry?

Metadata Update from @ankursinha:
- Pull-request tagged with: needs changes, new change

3 years ago

Alright. This is my to-do for now.
- Rephrase to "Please do not use this guide... ". to keep away people from using this guide altogether if they do not wish to enable NVIDIA all the time.
- Add third party header to it as it involves RPMFusion. (I might need some assistance here. I would let you know on SIG on exactly what I need so)
- Rephrase exclusivity to Fedora 32 Workstation like you specified.
- Remove the first update - Maybe it is needed to get the existing repo update first and then in third step it would get the update from new repos.
- Make headers informative.
- Rephrase the third step.
- Rephrase the fourth step.
- Remove the second sentence in the fourth step.
- Rephrase the fifth step.
- Mention about disabling secure boot at the start.
- Maintain one sentence per line to make diffs clear.
- Correct the image references.
- Add a link to the documentation to nav.adoc under the Optimus entry

4 new commits added

  • Added the article to nav.adoc
  • Added headers and replaced "dedicated" with "NVIDIA"
  • Corrected step numbering
  • Made all suggested changes
3 years ago

1 new commit added

  • Added the third-party header
3 years ago

1 new commit added

  • Corrected image location references
3 years ago

Looks pretty good. One query: does this mean that users have to use X, or does this also work for Wayland? If it's only for X, that needs to be mentioned, and perhaps users also need to be told how to login to Gnome on Xorg from GDM?

Prime defaults to Xorg when activated. As a matter of fact, when Prime is enabled - Wayland is removed from selection on the GDM greeter. This is done by-design as Wayland does not work satisfactorily good in Prime settings.

Probably good to note that in the beginning too. It'll prevent users
from wondering if they've broken something when their system switches to
X during the process.

I will add it as a CAUTION admonition right away

Sure. Generally NOTEs are preferred. Warnings and cautions are to be
used with caution too ;)

Surely. Let us assume it would have a positive effect by keeping people more aware about what they are doing when they see those signs. Pushed the commit now.

1 new commit added

  • Added caution about defaulting to Xorg
3 years ago

Or, when they see that warnings and cautions are used too often, they
stop paying attention to them. It's the story of the boy who cried wolf:
https://en.wikipedia.org/wiki/The_Boy_Who_Cried_Wolf

As with programming, the higher the severity of an issue or message, the
more cautiously it should be used. If one uses "CRITICAL" everywhere,
then the issues cease to be critical.

Anyway, the material here is OK. Will merge when I can (replying from
e-mail at the moment).

One last commit to push then. I would use those admonitions in a justified manner.

1 new commit added

  • Converted some needless cautions to notes
3 years ago

Pull-Request has been closed by t0xic0der

3 years ago

@t0xic0der Hi, why did you close this? Was that an accident or on purpose?

Edit: Oh, never mind, it was a duplicate of #240, right?

i'd rather say that #240 is a duplicate of #239 but done right. I jumped into making changes to the master of my fork so I reforked again and made changes in a branch. @ankursinha knows.

Got it. I just wanted to make sure we're not going to lose anything by accidentally closing an incomplete but viable PR. :)

This might just happen with #241 XD