GPU passthrough without external monitor

Is it possible to use vm with gpu passthrough in windowed screen, like Looking Glass in KVM setups?

This is possible to achieve with NVIDIA cards using nvidia PRIME (it’s just a few environment variable to set to use the GPU for discrete rendering), it’s also possible with virtualGL Seamless GPU passthrough on Qubes OS with VirtualGL (I didn’t test it)

Performance are impacted (~30% less) in this mode as the bandwidth is almost halved because the GPU has to send the picture back (it’s in the magnitude of order of Gb/s on pci express bus or thunderbolt)

2 Likes

Thanks. As I understood it requires linux guest and doesn’t work with windows hvms?

Discrete mode works fine in Windows in theory, but I never tried it as a VM guest with GPU passthrough :woman_shrugging:

1 Like

Nvidia Prime - is there any guide how to do it? I have no idea about it. Googling not helping either

Create a shell script with this content (let’s say you name it nvidia-offload)

export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"

and then you can use it as nvidia-offload some_program and it should run on the NVIDIA GPU.

This piece of code is from NixOS wiki Nvidia - NixOS Wiki I think it’s the best place to have this kind of information at the moment…

There are some information in NVIDIA’s hard-to-find documentation Chapter 35. PRIME Render Offload

2 Likes

You mean I create script in dom0 and then qvm-run vm via this script? And vm will be rendered via nvidia gpu?

Ah no, unfortunately it’s not as simple. You still need to configure the qube to have the GPU and configure the GPU there, and then you need to use this script within the qube itself.