4

For some flatpak applications, it is better to use the dedicated GPU but how do you ensure that PRIME is offloading correctly when you cant run the usual testing commands inside the sandboxed applciations?

WiR3D
  • 7,340

2 Answers2

4

Check that PRIME offloading is working

  1. This is better answered in this question: https://askubuntu.com/a/1316539/253247
  2. Install the flatpak GPUViewer application.

Set Application for offloading

Then you must change add the required environment variables in order to activate the GPU offloading:

via cli

# for OPENGL
flatpak override --env="__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia" full.application.Name
# for vulkan
flatpak override --env="__NV_PRIME_RENDER_OFFLOAD=1" full.application.Name

for our testing we will do OpenGL with the GPUViewer application

flatpak override --env="__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia" io.github.arunsivaramanneo.GPUViewer

Flatseal

flatseal setting GPUViewer to use PRIME offloading

Testing

Launch GPUViewer and go to the OpenGL tab, You should see the Nvidia graphics cards selected. If it still shows the Intel card then the offloading is not working.

enter image description here

WiR3D
  • 7,340
1

Ensure that u enable Nvidia Prime Offloading link

Test:

$ prime-run glxinfo | grep 'OpenGL renderer'
OpenGL renderer string: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2

Than run command:

flatpak override --user --device=dri --env=__NV_PRIME_RENDER_OFFLOAD=1 --env=__VK_LAYER_NV_optimus=NVIDIA_only --env=__GLX_VENDOR_LIBRARY_NAME=nvidia org.blender.Blender

Run Blender. Do something.

Check dGPU Usage:

watch -n 1 nvidia-smi