Finally It Comes: A KMS Driver For QEMU-KVM
While Linux KVM virtualization works well for many, one of the areas where the Kernel-based Virtual Machine and its QEMU integration have lagged behind other virtualization solutions like VirtualBox and VMware is in terms of its 2D/3D support within guests. The KVM-QEMU situation is slightly more positive today though with the introduction of a basic KMS (kernel mode-setting) driver for KVM-QEMU riding in the Linux kernel.
VirtualBox and VMware virtualization products both are capable of passing 2D/3D/video calls from the guest operating systems -- regardless of whether it's Linux or Windows or even Solaris -- to the host system for execution on the GPU itself. Both Direct3D and OpenGL are fair game to the guests. It makes even gaming within a virtual machine somewhat possible or even to at least have a composited desktop. There is some performance overhead obviously, but it's much better than the KVM-QEMU accelerated display option: basically nothing.
The VMware solution even has an in-kernel DRM driver and its own Mesa Gallium3D driver. Though that isn't exactly surprising since VMware had acquired Tungsten Graphics, which was the entity behind Mesa. Due to leveraging Gallium3D, in theory the VMware guests also have exposure to OpenVG and OpenGL ES acceleration along with any future Gallium3D state trackers like OpenCL. There's also the Xorg Gallium3D state tracker for EXA and X-Video. A VA-API WebM/VP8 state tracker is also expected to come this summer. VirtualBox relies upon its own solution rather than integrating with the Linux graphics stack.
Xen virtualization users have a Gallium3D driver too for acceleration within guests, but few people actually know about the driver. This Gallium3D Xen driver was developed by an engineer working on the Open Trusted Computing project, but the work isn't maintained any longer.
Linux KVM-QEMU virtualization users meanwhile really haven't had any useful accelerated display support within guests. There is the QEMU QXL driver developed by Red Hat for the QXL Virtual GPU used by the SPICE Red Hat Enterprise Virtualization System. The QXL driver does provide UXA 2D acceleration support, but not much more, and it's still not widely used and dependent upon Red Hat's SPICE.
In late 2009, Red Hat's David Airlie experimented with KMS on QEMU. David modified the VMware KMS driver to work with QEMU just as VMware SVGA adapter works, but the work never went much beyond that.
By default, KVM-QEMU users just have an emulated Cirrus GPU, complete with its acceleration engine. There is, of course, a Cirrus X driver that can sit atop the guest operating system and pegs this emulated GPU in system memory. It's not particularly useful though it works, but without any actual GPU acceleration.
What's new today is Red Hat's Matthew Garret announcing a new DRM/KMS Linux driver for KVM-QEMU. It though is an un-accelerated KMS driver and basically just has a shadow frame-buffer. This should reduce the virtualization overhead slightly.
From his mailing list announcement, "qemu-kvm emulates a Cirrus GPU, including its acceleration engine. We typically then run a Cirrus-specific X driver on top of this, which turns requests into commands and sends them to the emulated accelerator. This all seems to be unnecessary overhead given that we're just going to end up writing to memory from the host instead, and performance is almost certainly going to be better using an unaccelerated framebuffer and a guest-side shadow."
So it's just a basic KMS driver for KVM-QEMU, that's all at this point. It's also a sample of a "simple" KMS driver. The code is actually derived from the KMS Glint driver that was developed last year as part of the Google Summer of Code as an easier way to understand Linux kernel mode-setting by programming KMS for an ancient, less-complex GPU compared to the modern Radeon / Intel / Nouveau drivers. The Glint driver has yet to be merged into the mainline Linux kernel, but at least the work has now proved to be useful.
This new kernel mode-setting driver by Matthew still takes advantage of the Cirrus GPU emulation, which at least means the host operating system and its KVM virtualization stack don't need to be upgraded to benefit from the new kernel driver. The driver itself comes in at just over 1,300 lines of code. For what it's worth, it does put running the Wayland Display Server in a virtualized environment being one (small) step closer.
It appears that it's part of official Red Hat work as opposed to being just a side project of Matthew's, so hopefully it will be merged into the Linux 2.6.40 kernel. Now if only we can be surprised by a Gallium3D KVM-QEMU driver providing acceleration to guests, but that would require much more work.
Latest Linux News
Latest Articles & Reviews
Most Viewed News This Week