[HOWTO]Tumbleweed, Desktop, Nvidia Prime render offload

“Nvidia Prime render offload” is also available for desktop (thanks to @malcomlewis)
I use Tumbleweed with KDE.
I use the intel iGPU for displaying
I use permanently the dGPU Nvidia for computing (opencl and cuda). The Nvidia compute feature must be permanently “on” for the computing service.
I don’t want to use permanently the NVIDIA card for rendering, just when using for example VLC and Digikam.

HOWTO ?

Create the 90-nvidia.conf with these contents

Section “ServerLayout”
Identifier “layout”
Option “AllowNVIDIAGPUScreens”
EndSection

Put the 90-nvidia.conf file in /ect/X11/xorg.conf.d/ and /usr/share/X11/xorg.conf.d/

Reboot

If GPU screen creation was successful, the log file /var/log/Xorg.0.log should contain lines with “NVIDIA(G0)”, and querying the RandR providers with xrandr --listproviders should display a provider named “NVIDIA-G0” (for “NVIDIA GPU screen 0”). For example:

Providers: number : 2
Provider 0: id: 0x221 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 6 associated providers: 0 name:modesetting
Provider 1: id: 0x1f8 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0

add this option in the launch command of the app

env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

for example for vlc

env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia /usr/bin/vlc

with KDE edit the application by filling the field “environment var” with

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

You can check that the app use nvidia rendering with command nvidia-smi

@promeneur you don’t need to do anything for it to work if you see the following;

You need to ensure suse-prime and all the bbswitch packages are removed (does this work with the rpm nvidia packages?). Any xorg.conf files for nvidia are gone in /etc/X11 and /etc/X11/xorg.conf.d directories (eg that 90-nvidia.conf). Of course nouveau needs to be blacklisted.

Now on a reboot, can you post the output from these commands;

/sbin/lspci -nnk | grep -EA3 "VGA|Display|3D"
xrandr --listproviders
glxinfo | grep "OpenGL renderer"

On the GNOME desktop switcherooctl dbus service offers an addition desktop file option to use the discrete gpu, else switcherooctl launch from the command line.

Or you can always create an alias… I use the following;

alias offload='__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only '

Ref: https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/README/primerenderoffload.html

@malcomlewis

I deleted the two occurrences of 90.nvidia.conf then rebooted.

You are right. By default the Nvidia Prime Offload technology is set by default. I checked that vlc uses the nvidia rendering with nvidia-smi.

thanks

1 Like

:~> /sbin/lspci -nnk | grep -EA3 “VGA|Display|3D”
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:5912] (rev 04)
DeviceName: Onboard IGD
Subsystem: ASUSTeK Computer Inc. Device [1043:8694]
Kernel driver in use: i915

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP108 [GeForce GT 1030] [10de:1d01] (rev a1)
Subsystem: ASUSTeK Computer Inc. Device [1043:85f4]
Kernel driver in use: nvidia
Kernel modules: nouveau, nvidia_drm, nvidia

:~> xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x46; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 3; outputs: 5; associated providers: 1; name: modesetting
output DP-1
output HDMI-1
output HDMI-2
output HDMI-3
output DP-2
Provider 1: id: 0x1fa; cap: 0x2 (Sink Output); crtcs: 2; outputs: 2; associated providers: 1; name: NVIDIA-G0
output DVI-D-1-0
output HDMI-1-0

:~> glxinfo | grep “OpenGL renderer”
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)

@promeneur then can check all working with;

__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only glxinfo | grep "OpenGL renderer"

The important part to check is that you see the NVIDIA Provider in the output, if you don’t, then you are stuck with suse-prime. But AFAIK all the RTX versions should work with PRIME Render Offload.

If your playing games then you may have to use suse-prime, I don’t think steam or proton are up to speed with this yet…

:~> __NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only glxinfo | grep “OpenGL renderer”
OpenGL renderer string: NVIDIA GeForce GT 1030/PCIe/SSE2

1 Like

@promeneur looks good :sunglasses:

i used glmark2 to test the intel igpu and the nvidia dgpu.

result => the HD Graphics 630 score is 2191 > the Nvidia GT 1030 score is 414 !

intel speed > nvidia speed ? I don’t understand.

@promeneur Use something like blender benchmark.

I don’t want to install 1 GB.

@promeneur I use the run file here…

GL_RENDERER:    NVIDIA T400/PCIe/SSE2
GL_VERSION:     4.6.0 NVIDIA 530.41.03
glmark2 Score: 3026

GL_RENDERER:    Tesla P4/PCIe/SSE2
GL_VERSION:     4.6.0 NVIDIA 530.41.03
glmark2 Score: 3976

I stop the computing

OpenGL Information
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce GT 1030/PCIe/SSE2
GL_VERSION: 4.6.0 NVIDIA 525.105.17

                              glmark2 Score: 1166 

=======================================================

1 Like

Another thing I forgot.

You must forbid the installation of the package “suse-prime” with Yast software manager.

If not when updating the Nvidia driver, then suse-prime package will be installed. Thus, Prime Technology will be installed. It is not what we want when using Prime render offload feature.