zelikos / davincibox

Container for DaVinci Resolve installation and runtime dependencies on Linux
Apache License 2.0
129 stars 7 forks source link

Handle Nvidia dGPUs in laptops #40

Open zelikos opened 9 months ago

zelikos commented 9 months ago

On a laptop with Nvidia, DaVinci doesn't use the dGPU by default, and GNOME's "launch with discrete GPU" option doesn't work because it sets environment variables which don't get passed through by distrobox. The fix I found was editing the desktop file and replacing

Exec=/usr/bin/distrobox-enter -n davincibox -- /opt/resolve/bin/resolve %u

with

Exec=/usr/bin/distrobox-enter -n davincibox -- env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia /opt/resolve/bin/resolve %u

Originally posted by @flexagoon in https://github.com/zelikos/davincibox/issues/21#issuecomment-1827508764

Ideally, we'd handle this automatically, but in the short term we can add an argument for add-davinci-launcher and the run-davinci script to apply the environment variables here.

not-a-dev-stein commented 9 months ago

This finally fixed the issue I was having (error 999), thanks!

not-a-dev-stein commented 2 months ago

I'm not sure what's changed in the meantime, but ever since updating to the 555 NVIDIA drivers, something broke, both distrobox and toolbox don't recognize CUDA anymore and I get the "Failed to initialize GPU" error whenever I launch Davinci, which I'm working around by using the integrated GPU with rusticl, but it's obviously much, much slower than the dedicated GPU.

flexagoon commented 2 months ago

@not-a-dev-stein did you also update the driver inside of the distrobox?

not-a-dev-stein commented 2 months ago

@not-a-dev-stein did you also update the driver inside of the distrobox?

Yup, I'm on latest on both. If I don't run the command to open Davinci with rusticl it gives out an error and gives me the menu to change GPU configuration, where I can see it detects both the integrated and the NVIDIA GPU but only gives OpenCL as an option, and the program doesn't run at all when I restart, it always gives me the GPU error. With rusticl at least it runs on the integrated GPU.

Alexios13 commented 2 months ago

I am using the latest bazzite on my laptop. My configuration is an intel i7-8750H with integrated Intel UHD Graphics 630 and a discrete NVIDIA GeForce GTX 1050 Ti Mobile. I use this Setup Guide but I have the same issue with @not-a-dev-stein. When I open the Davinci I get an "unable to intialize GPU" and gives me the menu to update GPU configuration, where I can see it detects both the integrated and the NVIDIA GPU but only gives OpenCL as an option and the program doesn't run at all even after I restart, it always gives me the GPU error.

zelikos commented 1 month ago

If things are broken in both distrobox and toolbox, my guess would be something was broken on the Nvidia driver side. I'm unable to troubleshoot this directly since I don't have an Nvidia GPU, though