Hi all,
I was trying to install Nvidia prime on fedora 32 and I faced many issues as I had to follow many steps from different websites, forums and It was very tricky (but trust me, it is simple, lol)
I am just going to put steps to setup NVIDIA Prime(or whatever the hell people call it), on fedora 32 KDE, I guess, it will work with any version of fedora.
1.) I followed this guide up to step 7 to setup NVIDIA drivers and Intel drivers.
https://docs.fedoraproject.org/en-US/quick-docs/how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops/
(As newer drivers block nouveau drivers automatically from grub so, I think, we do not need to worry about it, but still if it disturbs you, then you can always follow this page (Step 2 of the link) to block those drivers.
[Reddit - Dive into anything](http://Block nouveau)
BTW, I have kept nvidia-drm.modeset=1
in grub, if it is not there in your grub config.)
2.) I copied the nvidia.conf file, just did as following (Do not add PrimaryGPU “yes” in nvidia conf or do not edit)
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
Mine looks something like this,
#This file is provided by xorg-x11-drv-nvidia
#Do not edit
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "SLI" "Auto"
Option "BaseMosaic" "on"
EndSection
Section "ServerLayout"
Identifier "layout"
Option "AllowNVIDIAGPUScreens"
EndSection
3.) you can check the openGL renderer by this command,
glxinfo | egrep “OpenGL vendor|OpenGL renderer”
it should show something like this,
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)
4.) we will setup Nvidia’s dynamics power management settings,
sudo -s
dnf update
cat > /etc/modprobe.d/nvidia.conf <<EOF
# Enable DynamicPwerManagement
# Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management
options nvidia NVreg_DynamicPowerManagement=0x02
EOF
you can read about this more details on this page,
https://rpmfusion.org/Howto/Optimus
5.) You can check for sourced and sink drivers using this command,
xrandr --listproviders
But for now, it won’t show any output as we haven’t set up xorg.conf file yet for device and screen inputs, it is important to get right output for this, if it gives output then, you can simply jump to last step.
6.) let’s setup xorg.conf file,
you can put this command to edit or create xorg.conf file to add sections of source and sink device
sudo nano /usr/share/X11/xorg.conf
you can copy this configuration in the file.
It will require to replace PCI as per your graphics card
you can check the PCI number using:
lspci | grep -E “VGA|3D”
##Content of xorg file
#please replace PCI port as per your card
Section "ServerLayout"
Identifier "layout"
Screen 0 "intel"
Inactive "nvidia"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration" "True"
# Option "PrimaryGPU" "yes"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Yes, I have bypassed NVIDIA as primary GPU here.
you can now restart the system after that to load up those settings.
you can read more about Prime render offload here.
[Chapter 35. PRIME Render Offload](http://NVIDIA prime render offload guide)
7.) It is almost done,
now check xrandr --listproviders
it will show something like this.
Providers: number : 2
Provider 0: id: 0x43 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 1 associated providers: 1 name:modesetting
Provider 1: id: 0x26f cap: 0x2, Sink Output crtcs: 4 outputs: 3 associated providers: 1 name:NVIDIA-G0
it is important to get modesetting and NVIDIA-G0 in respective order as provider 0 will be used to render screen for normal application using iGPU and we will setup other application to render using dGPU.
8.) Now is the time to setup environment variable for the particular application which require to run using dedicated graphics card, or you can simply use this command in konsole to run the software.
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia "appliation name"
I personally prefer to copy these variables in the environment file of the particular application as I use Houdini(3d vfx software), so I copy these lines in the houdini.env file.
__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
these are reference image without and with variables, it is so easy to configure app for this.
That is it…!!!
I am getting around 12-16 W with my laptop in ideal state with firefox on wireless drivers using powertop.
You might get even less consumption as I have 17" inch screen and 144hz display(I am keeping it on 60, anyway) On idle, it sometimes go as low as 9-11.
I have also configured tlp using tlpui for convenience, I have disabled bluetooth in the startup, kept it off.
I have kept processor and disk setup with default settings as it will load up company settings and I think it is good. you can do as per your convenience.
I hope, this article was helpful.
Please drop a message if there is something I am doing wrong or can be done in another way as well. This worked for me.
I will just drop some links related to this article which is good to read for more details.
https://forums.developer.nvidia.com/t/prime-and-prime-synchronization/44423
http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/dynamicpowermanagement.html
https://rpmfusion.org/Howto/Optimus
https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Using_Bumblebee