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. Scythe Mugen MAX
  2. Intel Core i7 5960X Haswell-E On Linux
  3. Intel 80GB 530 Series M.2 SSD On Linux
  4. With A New Motherboard, The Core i7 5960X Haswell-E Lights Up
Latest Linux Articles
  1. MSAA RadeonSI Gallium3D Performance Preview
  2. Intel Core i7 5960X CPU Core Scaling Under Linux
  3. AMD RadeonSI Gallium3D Performance For 4K Linux Gaming
  4. 9-Way File-System Comparison With A SSD On The Linux 3.17 Kernel
Latest Linux News
  1. New Code Starts Lining Up For X.Org Server 1.17
  2. Rust Developers Planning For The Rust 1.0 Language
  3. RPM 4.12 Brings New Switches, New Rpm2Archive Utility
  4. Qt 5.3.2 & Qt Creator 3.2.1 Released
  5. Nouveau For Linux 3.18 Gains DP Audio, More Re-Clocking
  6. SUSE Gets Bought Out Again
  7. Enlightenment E19 Officially Released With Its Own Wayland Compositor
  8. OpenMediaVault 1.0 Released As New Linux NAS Alternative
  9. VESA Releases DisplayPort 1.3, Pushes 32.4 Gbits/sec
  10. Opera 25 Beta Has Bookmarks & Linux Support
Latest Forum Discussions
  1. support for first generation UVD blocks (RV6xx, RS780, RS880 and RV790)
  2. Nvidia joins the ranks of Apple and Microsoft
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. New Group Calls For Boycotting Systemd
  5. Hd 6850
  6. nv and xorg.conf under Debian PPC
  7. X.Org Is Looking For Some Female Help
  8. FSF Issues Their Rebuttal To Apple's New iPhone, Watch & Apple Pay