1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

Finally It Comes: A KMS Driver For QEMU-KVM

Virtualization

Published on 18 April 2011 04:41 PM EDT
Written by Michael Larabel in Virtualization
8 Comments

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.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. Intel Launches The Core i7 5960X, Mighty Powerful Haswell-E CPUs
  2. AMD Radeon R9 290: Gallium3D vs. Catalyst Drivers
  3. AMD Radeon R9 290 Open-Source Driver Works, But Has A Ways To Go
  4. Trying The Configurable 45 Watt TDP With AMD's A10-7800 / A6-7400K
Latest Linux Articles
  1. The Fastest NVIDIA GPUs For Open-Source Nouveau With Steam Linux Gaming
  2. Testing For The Latest Linux Kernel Power Regression
  3. The Most Energy Efficient Radeon GPU For AMD Linux Gaming
  4. 20-Way Radeon Comparison With Open-Source Graphics For Steam On Linux Gaming
Latest Linux News
  1. AMD Steppe Eagle Flys To Coreboot
  2. Intel Beignet Is Working Out Surprisingly Well For OpenCL On Linux
  3. Coreboot Adds Lenovo X220 With Native Sandy Bridge Support
  4. Canonical Has Yet To Land X.Org Server 1.16 For Ubuntu 14.10
  5. Imagination Launches A MIPS Development Board
  6. Getting Involved With The New Raspberry Pi Graphics Driver
  7. A New AMD Catalyst Linux Driver Unofficially Surfaces
  8. LibreOffice Ported To 64-bit ARM (AArch64)
  9. Enlightenment E19 RC3 Shows Off The New Wayland Compositor
  10. Metro Redux Is Going To Require OpenGL 4.x On Linux
Latest Forum Discussions
  1. Btrfs Gets Talked Up, Googler Encourages You To Try Btrfs
  2. Updated graphics drivers for Ubuntu 12.04 Precise LTS
  3. Catalyst 14.201.1008
  4. It's Now Possible To Play Netflix Natively On Linux Without Wine Plug-Ins
  5. Users defect to Linux as OpenBSD removes Lynx from base system
  6. Updated and Optimized Ubuntu Free Graphics Drivers
  7. Canonical Joined The Khronos Group To Help Mir/Wayland Drivers
  8. Radeon HD5670 and Ubuntu 14.04