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. NVIDIA GeForce GTX 970 Offers Great Linux Performance
  2. CompuLab Intense-PC2: An Excellent, Fanless, Mini PC Powered By Intel's i7 Haswell
  3. From The Atom 330 To Haswell ULT: Intel Linux Performance Benchmarks
  4. AMD Radeon R9 285 Tonga Performance On Linux
Latest Linux Articles
  1. AMD Moves Forward With Unified Linux Driver Strategy, New Kernel Driver
  2. MSI: Update Your BIOS From The Linux Desktop
  3. NVIDIA vs. AMD 2D Linux Drivers: Catalyst Is Getting Quite Good At 2D
  4. 15-Way GPU Comparison With Mesa 10.3 + Linux 3.17
Latest Linux News
  1. Linux 3.19 To Have Skylake Graphics, PPGTT Enablement
  2. Ubuntu 16.04 Might Be The Distribution's Last 32-Bit Release
  3. Imagination Releases Full ISA Documentation For PowerVR Rogue GPUs
  4. Features GNOME Developers Want In The Linux Kernel
  5. GTK+ Gains Experimental Overlay Scrollbars
  6. Phoronix Test Suite 5.4 M3 Is Another Hearty Update
  7. GParted 0.20 Improves Btrfs Support
  8. EXT4 In Linux 3.18 Has Clean-ups, Bug Fixes
  9. Emacs 24.4 Has Built-In Web Browser, Improved Multi-Monitor Support
  10. NVIDIA's NVPTX Support For GCC Is Close To Being Merged
Latest Forum Discussions
  1. Users/Developers Threatening Fork Of Debian GNU/Linux
  2. HOPE: The Ease Of Python With The Speed Of C++
  3. Proof that strlcpy is un-needed
  4. Bye bye BSD, Hello Linux: A Sys Admin's Story
  5. Updated and Optimized Ubuntu Free Graphics Drivers
  6. NVIDIA Presents Its Driver Plans To Support Mir/Wayland & KMS On Linux
  7. AMD Is Restructuring Again, Losing 7% Of Employees
  8. Open-Source AMD Fusion E-350 Support Takes A Dive