You are not logged in.
The laptop has both Intel and NVIDIA GPUs.
Although I'm not gaming on Linux, I do have programs which could make use of more powerful NVIDIA GPU, while by default the Intel one is used. Mostly, it is graphics software, such as GIMP, Inkscape, Natron, OBS, etc.
For this reason I have set up PRIME render offload. As far as I understand, all it allows you to do is to start an application with NVIDIA GPU instead of the Intel one:
❯ glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Graphics (RPL-P)
❯ prime-run glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 4050 Laptop GPU/PCIe/SSE2It is not obvious to me how I can verify if it works with Inkscape, for instance, but Natron clearly states what GPU it uses for rendering:
Unfortunately, it shows the same information (Intel) above for both commands:
❯ flatpak run fr.natron.Natron
❯ prime-run flatpak run fr.natron.NatronIt is installed via Flatpak, so I tried to follow these recommendations to enable NVIDIA GPU for rendering in Natron.
With recommended environment variables though, application won't start at all:
❯ flatpak override --user --show fr.natron.Natron
[Context]
devices=dri;
[Environment]
__VK_LAYER_NV_optimus=NVIDIA_only
__GLX_VENDOR_LIBRARY_NAME=nvidia
__NV_PRIME_RENDER_OFFLOAD=1It works almost exactly the same for GPUViewer application:
Results don't change with or without "prime-run" command (only Intel for OpenGL and Vulkan), but if those environment variables are set - it doesn't crash instantly without any error message like Natron does.
Instead, it starts as transparent window on the main display and from that moment second display freezes forever for some reason (until reconnecting it by xrandr).
System information, in case it is relevant:
❯ neofetch
-` sofie@sasao
.o+` ------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: Victus by HP Gaming Laptop 15-fa1xxx
`+oooooo: Kernel: 6.6.63-1-lts
-+oooooo+: Uptime: 5 mins
`/:-:++oooo+: Packages: 893 (pacman), 22 (flatpak)
`/++++/+++++++: Shell: zsh 5.9
`/++++++++++++++: Resolution: 1920x1080, 1920x1080
`/+++ooooooooooooo/` WM: i3 (picom)
./ooosssso++osssssso+` Theme: Adwaita [GTK2/3]
.oossssso-````/ossssss+` Icons: Adwaita [GTK2/3]
-osssssso. :ssssssso. Terminal: tmux
:osssssss/ osssso+++. CPU: 13th Gen Intel i5-13500H (16) @ 4.700GHz
/ossssssss/ +ssssooo/- GPU: Intel Raptor Lake-P [Iris Xe Graphics]
`/ossssso+/:- -:/+osssso+- GPU: NVIDIA GeForce RTX 4050 Max-Q / Mobile
`+sso+:-` `.-/+oso: Memory: 2907MiB / 15631MiB
`++:. `-/+/
.` `/What am I missing? How do I properly set up software (flatpak or not) to use NVIDIA graphics card? Is PRIME offloading wrong solution for this problem?
Offline
PRIME offloading is the correct solution, but flatpak isn't. Does flatpak even know you have a nvidia device? Is the flatpak nvidia driver installed? Though device dri should hopefully expose that without such a need, but I avoid flatpaks since it routinely runs into the very problems it wants to avoid.
Last edited by V1del (2024-12-12 21:09:27)
Offline
PRIME offloading is the correct solution, but flatpak isn't.
I understand that the "flatpak" part of the issue seems to be its root cause. I do avoid flatpak where I can, but it looks like the most reasonable choice for some cases.
Also, I still cannot think of another good "real world" test of my PRIME offloading set up without flatpak except that one with glxinfo. So, I'm not sure if it works properly even without flatpak.
Does flatpak even know you have a nvidia device? Is the flatpak nvidia driver installed?
Sorry, I'm not sure how to properly answer these questions. How do I "tell" flatpak I have a NVIDIA device?
The recommendations I linked are pretty much the best I found so far to get flatpak application and NVIDIA GPU to talk to each other.
There is some information that may help though:
❯ flatpak list
Name Application ID Version Branch Installation
...
Natron fr.natron.Natron 2.5.0 stable system
GPU-Viewer io.github.arunsivaramanneo.GPUViewer 3.10 stable system
Mesa org.freedesktop.Platform.GL.default 24.0.7 23.08 system
Mesa (Extra) org.freedesktop.Platform.GL.default 24.0.7 23.08-extra system
Mesa org.freedesktop.Platform.GL.default 24.2.7 24.08 system
Mesa (Extra) org.freedesktop.Platform.GL.default 24.2.7 24.08extra system
nvidia-550-54-14 org.freedesktop.Platform.GL.nvidia-550-54-14 1.4 system
nvidia-550-78 org.freedesktop.Platform.GL.nvidia-550-78 1.4 system
nvidia-565-57-01 org.freedesktop.Platform.GL.nvidia-565-57-01 1.4 system
Intel org.freedesktop.Platform.VAAPI.Intel 23.08 system
Intel VAAPI driver org.freedesktop.Platform.VAAPI.Intel 24.08 system
...Offline
So, I'm not sure if it works properly even without flatpak.
nvidia-smi will list the GPU clients, you can generally expect prime-run to work everywhere if "prime-run glxinfo -B" tells you that you're running on the nvidia GPU.
For flatschpaks, they need to match the host driver version, ie currently 565.77, which isn't in your list - so you probably have to install/update that version from… flathub, I guess?
Online
nvidia-smi will list the GPU clients
Sure, thank you. nvidia-smi list always displays a xorg process, and the "obs" process were added only when I run the program with prime-run.
However, I couldn't get Inkscape or GIMP to be listed. I guess it either needs to be additionally configured in these programs' settings, or I am doing something wrong.
For flatschpaks, they need to match the host driver version, ie currently 565.77, which isn't in your list - so you probably have to install/update that version from… flathub, I guess?
I checked host driver version, and it seems to match the one I have in flatpak list.
❯ pacman -Q nvidia
nvidia-dkms 565.57.01-2To be sure, I updated the host driver and installed one from flathub as you recommended:
❯ flatpak list | grep nvidia | awk '{print $1}'
nvidia-550-54-14
nvidia-550-78
nvidia-565-57-01
nvidia-565-77
❯ pacman -Q nvidia
nvidia-dkms 565.77-1After that I tried running GPUViewer again without setting any environment variables. With or without prime-run command I get the same terminal output (only number in the end is different):
❯ flatpak run io.github.arunsivaramanneo.GPUViewer
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:763: FINISHME: support YUV colorspace with DRM format modifiers
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:794: FINISHME: support more multi-planar formats with DRM modifiers
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /usr/lib/x86_64-linux-gnu/GL/default/lib/libvulkan_virtio.so. Skipping this driver.
(python3:2): Gtk-CRITICAL **: 22:16:08.172: gtk_box_append: assertion 'gtk_widget_get_parent (child) == NULL' failed
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /usr/lib/x86_64-linux-gnu/GL/default/lib/libvulkan_virtio.so. Skipping this driver.
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
5.489267826080322Despite those warnings and error, program displays a transparent window for a second, and then renders GUI into it, which still shows Intel vendor for OpenGL:
Interestingly, the output in terminal is exactly the same when those environment variables from earlier are set. But unfortunately, in this case the window does not respond and remains transparent forever until I close it. It also sometimes freezes second display like I described earlier, and I can't imagine why this happens. But while that transparent window is running, nvidia-smi shows a new process, so I guess it works, just the program fails to render for some reason...
But the issue with Natron is still the same: if I set those variables for this program - it just crashes without any error message, while without them program runs, but shows Intel in GPU rendering tab.
I suppose updating drivers didn't change anything for me, but they are at least up-to-date now. Sadly, the issue still persists. It seems like a software specific issue now, but I believe without flatpak it wouldn't be a problem at all, since the OBS test at the beginning shows positive results.
Offline
However, I couldn't get Inkscape or GIMP to be listed.
prime-run inkscapedoesn't work?
I updated the host driver
How? pacman -Syu? Are you running partial updates?
Despite those warnings and error
Ok, that's vulkan, https://wiki.archlinux.org/title/Vulkan … initialize (export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/nvidia_icd.json)
But the issue with Natron is still the same: if I set those variables for this program - it just crashes without any error message, while without them program runs, but shows Intel in GPU rendering tab.
Do you have a https://wiki.archlinux.org/title/Core_d … _core_dump for the crash?
Online
prime-run inkscapedoesn't work?
It works, Inkscape runs normally, it just does not show up in nvidia-smi list of processes.
The only setting I found within Inkscape that could be connected to this issue is "Enable OpenGL", which I tried both on and off.
How? pacman -Syu? Are you running partial updates?
I performed full system update with "yay -Syu".
Despite those warnings and error
Ok, that's vulkan, https://wiki.archlinux.org/title/Vulkan … initialize (export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/nvidia_icd.json)
Well, I tried. I must be doing it completely wrong, but there is another error now:
❯ flatpak override --user --env="VK_DRIVER_FILES=/usr/share/vulkan/icd.d/nvidia_icd.json" io.github.arunsivaramanneo.GPUViewer
❯ flatpak run io.github.arunsivaramanneo.GPUViewer
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file /usr/share/vulkan/icd.d/nvidia_icd.json
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /run/build/vulkan-tools/vulkaninfo/./vulkaninfo.h:456:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
1.2922356128692627Application still opens, but "Vulkan" tab is not there anymore.
Not sure why it cannot open the file. It exists and seems to be valid:
❯ cat /usr/share/vulkan/icd.d/nvidia_icd.json
{
"file_format_version" : "1.0.1",
"ICD": {
"library_path": "libGLX_nvidia.so.0",
"api_version" : "1.3.289"
}
}However, without this variable "Vulkan" tab is there despite that previous error and it also detects both Intel and NVIDIA devices (and also llvmpipe) and lists them in the dropdown menu:
I'm not exactly sure why that error with creating VDPAU device matters then, but it's there.
Do you have a https://wiki.archlinux.org/title/Core_d … _core_dump for the crash?
Yes, here is the message from it:
Signal: 11 (SEGV)
Command Line: /app/natron/bin/Natron
Executable: /app/natron/bin/Natron
Message: Process 57744 (Natron) of user 1000 dumped core.
Module /app/natron/lib/libpcre2-8.so.0 without build-id.
Module /app/natron/lib/libpcre2-8.so.0
Module /app/natron/lib/libcrypto.so.1.1 without build-id.
Module /app/natron/lib/libcrypto.so.1.1
Module /app/natron/lib/libglib-2.0.so.0 without build-id.
Module /app/natron/lib/libglib-2.0.so.0
Module /app/natron/lib/libgthread-2.0.so.0 without build-id.
Module /app/natron/lib/libz.so.1 without build-id.
Module /app/natron/lib/libz.so.1
Module /app/natron/lib/libpng16.so.16 without build-id.
Module /app/natron/lib/libpng16.so.16
Module /app/natron/lib/libpixman-1.so.0 without build-id.
Module /app/natron/lib/libpixman-1.so.0
Module /app/natron/lib/libshiboken.cpython-310-x86_64-linux-gnu.so.1.2 without build-id.
Module /app/natron/lib/libshiboken.cpython-310-x86_64-linux-gnu.so.1.2
Module /app/natron/lib/libexpat.so.1 without build-id.
Module /app/natron/lib/libexpat.so.1
Module /app/natron/lib/libpython3.10.so.1.0 without build-id.
Module /app/natron/lib/libpython3.10.so.1.0
Stack trace of thread 2:
#0 0x000074a5b8cdc618 n/a (/usr/lib/x86_64-linux-gnu/GL/nvidia-565-77/extra/libnvidia-tls.so.565.77 + 0x2618)
#1 0x000074a5b9035a75 n/a (/usr/lib/x86_64-linux-gnu/libc.so.6 + 0x34a75)
#2 0x000074a5b9035f39 n/a (/usr/lib/x86_64-linux-gnu/libc.so.6 + 0x34f39)
#3 0x000074a5b902cdef n/a (/usr/lib/x86_64-linux-gnu/libc.so.6 + 0x2bdef)
#4 0x000074a5b902b9a6 n/a (/usr/lib/x86_64-linux-gnu/libc.so.6 + 0x2a9a6)
#5 0x000074a5b902b568 n/a (/usr/lib/x86_64-linux-gnu/libc.so.6 + 0x2a568)
#6 0x000074a5b97b2701 n/a (/app/natron/lib/libQtCore.so.4 + 0x1b2701)
ELF object binary architecture: AMD x86-64Offline
Not sure why it cannot open the file. It exists and seems to be valid:
Apparently not in the flatpak.
It works, Inkscape runs normally, it just does not show up in nvidia-smi list of processes.
prime-run strace inkscape |& grep libglIt only accesses libGL* for me when checking the "use opengl" box.
The performance under strace will expectably suck, but the software mode also outperforms opengl here in inkscape (and from what I can tell you'll have to actually restart inkscape to apply the actual impact of the checkbox, so activate it, restart inkscape and check nvidia-smi then)
Natron crashes from QtCore => libc and only ends up in nvidia-tls.
There's a bunch of natron packages in the AUR, none of them depends on Qt4 in any way shape or form - I highly suspect that this is an intra-flatpak incompatibility where a really old build of natron links some incompatible nvidia-tls. There was an ABI break in the latter two years ago affecting the 390xx drivers, https://bbs.archlinux.org/viewtopic.php?id=283327 but I can't tell what the flatpak ships there and whether there's an alternative TLS library you could load or what that natron build expects…
There's a bunch of natron packages in the AUR …
Online
It only accesses libGL* for me when checking the "use opengl" box.
I have no experience in using strace, but I hope this output confirms it:
❯ prime-run strace inkscape |& grep libgl # with checked "Enable OpenGL"
openat(AT_FDCWD, "/usr/bin/../lib/inkscape/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/bin/../lib/inkscape/libglibmm-2.4.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libglibmm-2.4.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libglib-2.0.so.0.8200.4", O_RDONLY) = 19
openat(AT_FDCWD, "/usr/lib/libglibmm-2.4.so.1.3.0", O_RDONLY) = 19
❯ prime-run strace inkscape |& grep libgl # with unchecked "Enable OpenGL"
openat(AT_FDCWD, "/usr/bin/../lib/inkscape/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/bin/../lib/inkscape/libglibmm-2.4.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libglibmm-2.4.so.1", O_RDONLY|O_CLOEXEC) = 3There's a bunch of natron packages in the AUR
There's a bunch of natron packages in the AUR …
I'm starting to suspect there might be a bunch of natron packages in the AUR...
Jokes aside though, building AUR natron package was the first thing I tried before making the flatpak mistake. There is also a natron-bin one, but it doesn't seem to be updated that often.
It doesn't depend on Qt4, but unfortunately it does depend on pyside2, which I'm unable to install for some reason:
❯ yay -Sy pyside2
...
==> ERROR: Could not resolve all dependencies.
-> error making: pyside2-exit status 8
-> Failed to install the following packages. Manual intervention is required:
python-shiboken2 - exit status 8
pyside2 - exit status 8However, this issue is most definitely off topic as it has nothing to do with running a flatpak application with PRIME offloading. It is what initially led me to this issue though.
Still, I'm not sure if this issue has to be marked SOLVED, because I didn't manage to run any flatpak application with NVIDIA device.
Last edited by SofieSasao (2024-12-16 21:33:18)
Offline
Fails when installing https://aur.archlinux.org/packages/python-shiboken2 - but "some reason" wa replaced w/ "...". For some reaosn ![]()
Online
I tried a bunch of alternative ways to install Natron, and eventually I managed to do it properly (at least I think i did), without using Flatpak.
The problem is not related to Flatpak anymore, but since a lot of context is here - I believe it is reasonable to continue this discussion.
Please, correct me if I should have created another issue for it. The title has nothing to do with Natron after all, and it may also be wrong forum even...
So, newly installed Natron still refuses to work with PRIME offloading.
Running without prime-run command gives the exact same result as Flatpak Natron did: it detects Intel device and works properly.
Adding prime-run command causes program to crash, but differently this time:
❯ ./Natron
Natron Version 2.5
(C) 2018-2022 The Natron developers
(C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
>>>Use the --help or -h option to print usage.<<<
Info: init.py script not loaded (this is not an error)
Info: initGui.py script not loaded (this is not an error)
❯ prime-run ./Natron
Natron Version 2.5
(C) 2018-2022 The Natron developers
(C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
>>>Use the --help or -h option to print usage.<<<
Error while loading OpenGL: closest = -1
OpenGL rendering is disabled.
closest = -1
closest = -1
Info: init.py script not loaded (this is not an error)
Info: initGui.py script not loaded (this is not an error)
closest = -1Before closing it shows dialog with an error that says:
Error while creating OpenGL context: closest = -1
Natron requires at least OpenGL 2.0 with the following extensions so the viewer works appropriately:
GL_ARB_vertex_buffer_object,GL_ARB_pixel_buffer_objectWhile I don't know how to verify if those extensions are present - I do know that I have up-to-date drivers which should satisfy such requirements.
Offline
https://github.com/NatronGitHub/Natron/issues/1001
Our releases only support X11/XWayland.
But you're on i3?
prime-run glxinfo
GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb prime-run ./NatronSanity check: you've lib32-nvidia-utils ?
(Just in case this ends up being 32bit code)
Online
But you're on i3?
Yes, I am.
prime-run glxinfoSure, thanks. This command lists specified extensions under "OpenGL core profile extensions" (GL_ARB_vertex_buffer_object, GL_ARB_pixel_buffer_object).
GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb prime-run ./NatronThis results in exactly the same output as above, and the same error message.
Sanity check: you've lib32-nvidia-utils ?
Apparently, I didn't, so I enabled multilib and installed lib32-nvidia-utils using pacman.
Still, nothing has changed after that. Maybe I missed some steps?
Offline
This command lists specified extensions
Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855
Post the complete output.
Then let's see what libraries Natron is using:
LD_DEBUG=libs prime-run ./Natron >/dev/null 2>/tmp/ld.debug.txt
cat /tmp/ld.debug.txt | curl -F 'file=@-' 0x0.stOnline
Post the complete output.
Sure, here is the output of the "prime-run glxinfo" command.
LD_DEBUG=libs prime-run ./Natron >/dev/null 2>/tmp/ld.debug.txt
cat /tmp/ld.debug.txt | curl -F 'file=@-' 0x0.stAnd here is the result of commands above.
Offline