this is what nvidia is like for me on linux!
this is what nvidia is like for me on linux!
so, i have a dual gpu laptop, it contains an amd igpu and a nvidia dgpu, i think this is common for laptops now (at least those with a dedicated gpu)
normally i run everything under my igpu, be it the wayland compositor or xorg server, browsers editors and everything of the sorts too!
most of the time this is fine, both xorg and wayland know to use my igpu (although xorg sometimes acts weird and shows up as under nvidia, but it doesn't keep it from sleeping, so it's not actually running it?)
opengl applications run fine too, they run by default on my igpu and i need to set some env variables to run it with the nvidia gpu, like so
__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
i have no idea if NV_PRIME is even needed anymore but it's there for good measure :p
so the same should be for vulkan?
so in somebody's infinite wisdom (i can't tell if this is done by nvidia or vulkan-loader), the nvidia icd will get prioritized over anything else
any program that makes use of vulkan will use the nvidia gpu by default, be it a code editor or even your browser
awesome
but programs have the liberty to pick whatever they want to run on, for example both chromium (when enabling vulkan) and zed (the editor) will use your igpu, so what's the problem?
well, the nvidia driver has the tendency (as confirmed by nvidia people) to wake up the entire gpu when you as much as look at the vulkan icd
so now whenever you launch anything vulkan, it waits a few seconds for your gpu to wake up (which will also draw more power than its limit), not actually use the nvidia gpu because it's a light program and then the gpu goes back to sleep
so what now? more variables!!
thankfully, the nvidia loader is the most customizable thing for some reason, you can enable its logging to see its every single step and you can change it with env variables, it's seriously cool
this is what i have set for my user:
VK_LOADER_DRIVERS_DISABLE="nvidia_icd.json"
you can also force a specific icd file with
VK_ICD_FILENAMES
, but
just disabling the nvidia one works well enough
so now you can launch the zed editor without it waiting for your gpu, but when you launch vulkan chromium it still wakes up your gpu?? what gives??
so this next part is something from trial and error,
i can't find any reasoning nor can i explain how it
works, but if you unload
nvidia_drm
, it stops
doing that? the nvidia driver expects that it seems,
it shows up in dmesg saying its unloading the drm
driver
so just don't load
nvidia_drm
? wrong!! it
will hit your performance when using the gpu, so you
have to keep it unloaded and load it when you need
it
again i can't tell what this is doing, the gpu still works while its unloaded, but chromium stops waking it up, but it hits performance in games, so you can load it for it to go back to normal while using it
also if games like those on the kex engine (the one
used by nightdive for its remasters) doesn't use
your nvidia gpu, force it by setting
VK_LOADER_DRIVERS_DISABLE
to disable your igpu icd
pure awesome