Windows over SPICE with GPU passtrough

Hi,
I have a Ubuntu 19.04 server with one Windows 10 VM. I want to use dedicated GPU for the VM so I set up passthrough. Win sees the GPU, I have drivers installed. So far good, BUT I basically now have 2 GPUs and 2 screens. One screen is SPICE which is operated by virtual GPU and the other Windows presume to be connected to the passthrough GPU. I do not have a monitor connected to the GPU, therefore, I cannot even access Nvidia Control Panel. The whole thing now behaves as if I had 2 GPUs with their own outputs in regular PC. I want to use SPICE to connect and use passthrough GPU to render stuff, e.g. Premiere Pro. Is this possible?

2 Options:

  1. Your PC now is, in a GPU sense, Two PCs. One Monitor to each and you run Linux on one and Windows on the other.
  2. You want dual Screen Linux: Look into Looking Glass. Haven’t set it up myself, but it’s basically made for your Usecase. It’s like Spice or VNC or RDP, but directly accesses the Framebuffer of the VM’s GPU, which makes it vastly supperior in terms of performance:
    Looking Glass - Triage

I think he means he doesn’t want to use the GPU for display at all and just wants to use it for it’s CUDA cores. I was in the middle of setting up a Win 10 VM and happened to have just passed thru my GPU while having spice attached still. I’m having some performance issues I’m trying to deal with but even then I was able to go into the default Windows display control panel and switch it from extended display to only the screen I choose under multiple displays. Verified that the monitor on the GPU lost video. So I don’t see why you couldn’t get it to work.

Just be careful that you choose the right number or you’d have no video at all. But it asks you to confirm the changes so you should be ok if you let it failback if you don’t confirm it.

Yes I do not want to use GPU for physical display. I want to use SPICE (or anything else if it is better) to see the screen on remote PC. That Looking-Glass is probably for cases when you want to see screen of Windows WM on your Linux Desktop. I started messing with it and then realized it. I am able to mess with displays in Windows but I do not want the VM to use the virtual GPU at all, I want it to use the pass-trough GPU for everything and then sent this over network.

Oh, ok. In theory I think it should still work even without a display attached, but I’m not sure spice would work in this case. You’d probably have to use RDP (remote desktop). As long as you confirmed that worked you should be able to remove the qemu display card. Not sure how to go about that off the top of my head as I’m new to this as well.

Iirc there is an opensource RDP client… dunno how well it works or if it’s still maintained…

edit It occurs to me that I saw an adapter that you can plug into a video port of a GPU to fake windows into thinking there was a display attached. You might have to do that. It might have even been in one of Wendell’s videos that I saw it. I didn’t mind it too much because it wasn’t really my use case to do a headless setup.

Well I tried to use RDP but it is not very fluent. It is better if I use X over SSH. I will try to remove the virtual GPU, but I know that without it I will not get any image in X over SSH. Now I can see that other issue will be sound. For RDP on Linux you can use Remmina, that is quite nice piece of software. I think best solution would be if the VM would use GPU for encoding of H.264/5 stream through SPICE which I could then receive on remote PC, but I don’t know hot to do that. Does anybody know how to do responsive open source VDI?

RDP creates its own display adapter. It is useless. X over SSH and SPICE are not optimal too but basically same. Problem is that in MPC-HC it just sees the MS virtual adapter, so video cannot be accelerated. I guess I want something which does not exist.

Just to share the solution I am using now. I connected GPU to real monitor, turned off MS virtual adapter in guest and enabled Nvidia Gamestream and added mstsc app there. I compiled Moonlight Embedded on Raspberry Pi Zero, turned off desktop, now it is just CLI (only 60 MB in RAM after boot - Linux is AMAZING) and added alias to .bashrc for the command I use:

Blockquote
alias [name of your command]=‘moonlight stream -app mstsc -1080 -fps 60 -codec h264 -bitrate 20000 -quitappafter -audio default [IP address of guest]’

Now I have 1080p, 60Hz remote desktop with sound, accelerated video playback and 3D graphics. I also used this to turn on automatic log-in because the streaming service won’t turn on until you sign in. It is not the most elegant, but it works. It would be really great if this would be possible with SPICE as it supports video streaming, now only software MJPEG. Hope it will support NVENC H264/5 soon on the host side. This would allow us to have 1 GPU just for the encoding of streams and other for VM passthrough.

1 Like