Virtio Gaming VM

HI

I’m trying to allow my kids to stream Steam games from my central PC. I’ve done this over sunshine and moonlight successfully; however ideally I wanted to use my machine at the same time

To achieve this, I have set up an arch VM, with 3d accelerated virtio-gpu and spice server with opengl

It is a bit of a pain as I have to connect via moonlight to even see the desktop; anyhow…I have set up Steam/Sunshine

The problem I am having is that games are incredibly laggy and it seems to be hammering CPU usage (I am counting single frames in portal2), so I am assuming it could be rendering on CPU alone

Am I missing a driver or something to allow steam games to utilize?

Is there a better way to do this?

Having done some more investigating, my GPU is not being utilized. I was able to see through NVIDIA settings

You are using a virtualized GPU, not an actual dedicated one. You need to have an actual physical GPU that can be passed through to the VM as a pcie device. This GPU will then be disconnected from the host OS, so if you want to use the pc at the same time you need at least 2 GPUs in the system.

Which hardware do you have?

I don’t have two GPU, to be able to pass one

Is it not possible to accelerate sunshine with virgl?

@burny02 if the CPU in your computer had an integrated GPU (IGPU) than you have two GPU.

Unfortunately not

1 Like

Is there a way to maybe have a second x session or something?

I have not used Arch nor VirtIO-GPU, but as far as I know, you’d probably need VirtIO’s Vulkan Mesa driver (aka Venus) for games to get GPU accelerated (otherwise only OpenGL is). On Arch, this seems to be the vulkan-virtio package. Maybe try installing it and see if vulkaninfo displays “venus” in the DRIVER_ID_MESA_VENUS section? (It’ll say llvmpipe in case of CPU rendering).

Though, even if you manage to make it use Venus, I doubt it’ll have a good enough performance to play games on. (At least not at the current state).

For your second question, you can open a dumb TTY (Ctrl-Alt-F1~F6), start X manually (e.g. with startx), and run Sunshine in that session. There have been some attempts in the past with varying degree of success:

IMO, buying a second GPU then uses that as a display output for non-gaming tasks may be easier.

Oh dear, lots of errors with both startx and vulkaninfo.

The vulkan info errors basically say I have an incompatible GPU and it still defaults to software rendering; I installed the drivers you mentioned, though. I thought virgl was opengl only ?

The Vulkan driver (Venus) was added sometimes back in 2021, but it’s still in a very early state AFAIK.

What are the errors you’re seeing with startx on a second TTY?

Alternatively, if you don’t use Nvidia, I wonder if doing a (nested?) Wayland + Sunshine may be easier (possibly even with Gamescope).

lots of ‘could resolve keysym’ errors…I actually modified it a little and have sunshine running now from terminal, but it is complaining of no encoders

Currently using startx cinnamon – :1, though it is staying in terminal

I am on nvidia, unfortunately…For now

Doesn’t passing a GPU come with it’s own problems of stubbing drivers and having to restart in between passes?

Presumably if I pass, I can’t use that GPU until rebooted at the least

Sorry–I really ran out of ideas here. To get GPU acceleration, it probably required to fiddling with Xorg config or possibly a dummy HDMI adapter. I think you may also need to setcap for X to access some devices.

On a GPU passthrough, Nvidia typically resets just fine (you can rebind it to the host relatively easily). AMD is a little bit finicky, though RX 6000 series seems to be more stable in this regard than RX 7000 series. Intel Arc has a pretty mixed result (it worked fine for me on A770 LE, ASRock A750, and ASRock A380, but I know a few people who couldn’t get it to work no matter what.)

I was experimenting with Xorg, today and configs etc

Seemed like I could get it working, but only switching between TTY. When I was on the non gaming TTY, The moonlight was just black (though sound)…Switching back the picture reappears.

I was using openbox. Messed around briefly with different xorg.conf for the different tty, but not sure if it works or not. It would just black my other monitor

I won’t mean to be an Arch critic here but maybe try running something that us presetup to see if it is a VM os issue? I run Pop OS for this kind of thing. If you want multisession remote access you can setup xrdp. (Side note: you will need to do some co fig for xrdp including permissions fixing and setting pop desktop)

Appologies if this is off topic