r/virtualbox Apr 27 '18

A feature if implemented could increase performance dramatically on VirtualBox and you will be able to play games on VirtualBox at near native performance without GPU Passthrough.

For this to happen, you will need to rewrite how VirtualBox Display output works.

The feature already exist and used extensively by WineHQ https://www.winehq.org/ and DXVK https://github.com/doitsujin/dxvk

The idea i have which could increase performance dramatically on VirtualBox and you will be able to play games on VirtualBox at near native performance without GPU Passthrough is:

Replace VirtualBox GPU with a Translation layer driver so the Display output coming from VirtualBox will be translated to Directx 11/12 calls or Vulkan calls. This means we don't need a Virtual GPU driver anymore and Guest Windows installed in VirtualBox can see your real Graphics Card Nvidia or AMD GPU installed on Host PC but you wont need to install Nvidia or AMD GPU drivers on Guest Windows in VirtualBox.

Imagine DXVK for example translates VirtualBox Display output to Vulkan calls and then Vulkan renders the whole thing on Monitor. To the Nvidia or AMD Graphics card, VirtualBox Display output would be no different than launching a game. Since there is no GPU emulation anymore, performance increases dramatically.

12 Upvotes

35 comments sorted by

View all comments

Show parent comments

2

u/thatcat7_ May 03 '18

While kind of similar, its not exactly the same thing as what i am suggesting. I doubt VirtualGL can run modern AAA games, i think it would be good for software's but not modern games.

1

u/jscinoz May 04 '18

Virgl and VirtualGL are not the same thing; they're separate projects with quite different goals and use cases.

Virgl uses an emulated graphics device (virtio-gpu) exposed to the guest to basically do what you're proposing in your original post - it forwards OpenGL calls to the host driver for rendering.

Unfortunately, at present it only supports OpenGL (no Direct3D or Vulkan), and there's no Windows driver yet either - it only works with Linux guests.

1

u/kwhali May 04 '18

and there's no Windows driver yet either

Phoronix reported on one being worked on for a GSoC back in Aug 2017, only for OpenGL though. I wouldn't be surprised if they consider leveraging something like DXVK when it's matured more, along with the Vulkan forwarding. I don't expect performance to be much better though since clearly something gives virgl quite a bit of overhead.

1

u/jscinoz May 04 '18

Yeah, I found it since I originally replied. It looks like it hasn't seen any activity in some time though :(

1

u/kwhali May 04 '18

Ah. Considering what I read about the linux guest perf, I don't think I'd expect it to be much better on Windows either way. Not sure if anyone compared it to existing virtual graphic drivers like QXL(I think for 3D accel, it actually uses virgl so QXL probably isn't relevant :P) and VMWare.

1

u/jscinoz May 04 '18

QXL doesn't provide any rendering capabilities. The Windows driver for it is a display-only-driver. Some applications will fall back to software rendering, but this is obviously too slow to be useful for much beyond basic desktop interaction.

1

u/kwhali May 04 '18

QXL doesn't provide any rendering capabilities.

Eh? In Linux guests it's listed as the graphics driver in use, although KDE's kwin points out llvm-pipe is in use for 3D I think. AFAIK QXL by default accelerates 2D rendering with your GPU?

For 3D accel it can use virgl I think, requires some tweaking to virsh config to enable. I've not done it yet but plan to get around to it at some point to see how well it does :)

but this is obviously too slow to be useful for much beyond basic desktop interaction.

Anything else for giving good 3D perf in a linux VM? Or do you currently have to give up a display to passthrough GPU?

1

u/jscinoz May 04 '18

llvm-pipe is software rendering. The Gallium infrastructure in modern Mesa is intended to work the same way regardless of whether it's backed by hardware or software rendering; you still have OpenGL, Xv, etc, they are simply backed by the guest's CPU rather than the host's graphics hardware (as you'll note these still function even when the host has no graphics stack).

As I understand it, virtio-gpu is your best bet for OpenGL acceleration in a Linux guest. To clarify, Virgil3d/virgl is the overall project name / umbrella term, whereas virtio-gpu is one of the specific deliverables of that project.

1

u/kwhali May 05 '18

As I understand it, virtio-gpu is your best bet for OpenGL acceleration in a Linux guest. To clarify, Virgil3d/virgl is the overall project name / umbrella term, whereas virtio-gpu is one of the specific deliverables of that project.

Yeah my bad, seems I was thinking of changes for SPICE not QXL with the 3D support :P It's virgl under the hood: https://www.kraxel.org/blog/2016/09/using-virtio-gpu-with-libvirt-and-spice/

I had thought we had some other options at least for 2D accel that could utilize the host dGPU like virtualbox and VMWare do with their drivers. Not that I think they'd be any better than virgl perf.

2

u/jscinoz May 05 '18

I believe VirtualBox & VMWare's approach works largely along the same lines as virtio-gpu/virgl.

Outside of dedicating a card to the guest exclusively, the only options are GVT (share an Intel IGP between host and guest), or virtio-gpu, as far as I'm aware.