Virgil 3D GPU project

View the Project on GitHub virgil3d

Virgil 3d project

What is Virgil?

Virgil is a research project to investigate the possibility of creating a virtual 3D GPU for use inside qemu virtual machines, that allows the guest operating system to use the capabilities of the host GPU to accelerate 3D rendering. The plan is to have a guest GPU that is fully independent of the host GPU.

What exactly does it entail?

The project entails creating a virtual 3D capable graphics card for virtual machines running inside qemu. The design of this card is based around the concepts of Gallium3D to make writing Mesa and (eventually) Direct3D drivers for it easy. The card natively uses the Gallium TGSI intermediate representation for its shaders. The implementation of rendering for the card is done in the host system as part of qemu and is implemented purely on OpenGL so you can accelerated rendering on any sufficiently capable card/driver combination.

The project also consists of a complete Linux guest stack, composed of a Linux kernel KMS driver, X.org 2D DDX driver and Mesa 3D driver.

Current status

So what can it do now?

Can render some 3D applications, gnome-shell and openarena being the primary ones, passes some piglit tests but a lot left to fix. I'll put up another page with more info on what else needs to happen.

Initial architecture

The initial architecture is based around using virtio as a transport mechanism to transport resources and state objects based on the Gallium3D API from Mesa. Shaders are currently based on the Gallium3D TGSI representation. The internal guest driver model is the Linux DRM/KMS model.

I've got a work in progress Google document with a lot more technical information in it: https://docs.google.com/document/d/1cL2sEi5DAd-qY_OzyNiUyIbcU2ZvcI8lhv3PWzFoH_w/pub

QEMU device

The virgl device is a VGA device inside QEMU that exposes a single virtio ring to the guest. The qemu process has a new thread running that processes the ring and calls the renderer library to process the commands and have the host GL implementation render them. The renderer library is currently provided by the Mesa codebase.

Scope

The project is currently investigating the desktop virtualisation use case only. This use case is where the viewer, host and guest are all running on the same machine (i.e. workstation or laptop). Some areas are in scope for future investigation but not being looked at, at this time.

Future scope

Out of scope

Repos

All repos are currently in Dave's freedesktop git trees. Four upstream projects are involved: qemu, mesa, Linux kernel and X.org DDX driver. The code is all MIT licensed so far, except the qemu bits which are under the GPL. There are no guarantees this code will build or work on any given day at any given time, the project isn't ready for that yet.

QEMU: contains the basic virgl virtio VGA device, and basic GL setup http://cgit.freedesktop.org/~airlied/qemu/log/?h=virgl

Mesa: the GL renderer and the guest 3D driver http://cgit.freedesktop.org/~airlied/mesa/log/?h=renderer-1

Linux kernel: the guest DRM/KMS driver http://cgit.freedesktop.org/~airlied/linux/log/?h=virgl

X.org DDX driver: http://cgit.freedesktop.org/~airlied/xf86-video-virgl

Demos

Virgil booting Fedora 19 and running gnome-shell: https://www.youtube.com/watch?v=ZuuF092RDDc

Virgil running openarena inside the VM. https://www.youtube.com/watch?v=ONFGnUaln-4

Questions

Here are some Q/A I've thought up so far: http://virgil3d.github.io/questions.html

Building

here are some hopeful build instructions: https://docs.google.com/document/d/1CNiN0rHdfh7cp9tQ3coebNEJtHJzm4OCWvF3qL4nucc/pub

Authors and Contributors

Virgil is a research project undertaken by Dave Airlie at Red Hat. It builds on lots of open source work in a number of projects, primarily the Gallium 3D code from the Mesa project.

Support or Contact

No mailing list yet, you can find me on irc generally, and at my normal email addresses.