[ black text - white links ]

VMGL (formerly Xen-GL)

H. Andrés Lagar-Cavilla, andres <at> lagarcavilla <dot> org

OpenGL Hardware 3D Acceleration for Virtual Machines

!NEWER syweb project site. See the buzz and the user community.
!NEW Sourceforge site
Subversion repository hosted by sourceforge
svn co https://vmgl.svn.sourceforge.net/svnroot/vmgl
Tarballs (repository snapshot): 
Distribution agnostic RPMs: 
Now a VEE 2007 accepted paper.
Slides for VEE 2007, San Diego, CA (Open Document).
Slides for Xen Summit 2007, NY (Open Document, PDF).
Shameless YouTube promo.

What is this:

OpenGL apps running inside a Virtual Machine (VM) can use VMGL to take advantage of graphics hardware acceleration. VMGL can be used on VMware guests, Xen HVM domains (depending on hardware virtualization extensions) and Xen paravirtual domains, using XVnc or the virtual framebuffer. Although we haven't tested it, VMGL should work for qemu, KVM, and VIrtualBox. VMGL is available for X11-based guest OS's: Linux, FreeBSD and OpenSolaris. VMGL is GPU-independent: we support ATI, Nvidia and Intel GPUs.

How to build:

If you cloned the repository or downloaded the tarball:

  • Copy the source into your guest (VM or domain) and host (dom0, kernel hosting VMware, etc..)
  • Type "make"
  • In the guest, type "make install-guest"
  • In the host, type "make install-host"

RPMs "should just work".


How to Use:

There are two broad types of guests
  • Guest without a framebuffer using Xvnc: restart vncserver after installation.
  • Guest with a framebuffer using Xorg: modify Xorg configuration in the guest to include the vmglext module, i.e.
in /etc/X11/xorg.conf:
     Section "Module"
         Load "vmglext"
and restart Xorg.
Then, for all types of guests, connect from the host to the domain using a viewer:
  • Vncviewer for guest with Xvnc, Xen paravirtual guest with vncfb, or Xen HVM guest with vnc qemu-dm output.
  • We provide a patch to enable sdlfb for Xen paravirtual guests, and qemu-dm with sdl output for Xen HVM guests.
After authentication the viewer will output:
    "Set GLSTUB var in the guest to point to port <something>"
Usually <something> is 7001. In the guest set the environment variable
    GLSTUB = <host_hostname>:<port_viewer_told_you>
and things should work.
You can also use VMGL with X forwarding, regardless of the type of guest. Start stub-daemon in the host, enable X forwarding from guest to host, and set GLSTUB in the guest to <host_hostname>:7000. Try your GL apps now.
CAUTION: In all cases, ports in the range of the 7000's have to remain open between guest and host.
NEW, VMware: Is not easy to compose the 3D output on VMware's closed source GUI. Your best bet is to "guess" the XID of the GUI window and pass it to stub-daemon with the -v switch. This link will provide you with a tiny library I use to interpose bteween VMware's GUI and X and find out the XID's used. I recommend you use vnc or X forwarding to bypass this problem altogether. 

How to get Xen dom0 GPU kernel modules:

A separate prerequisite for Xen is to enable direct rendering on your dom0. You can check this by looking into the output of glxinfo.
This depends on your graphics card:

Intel cards such as i915: Kernel modules are already part of the dom0 kernel tree. You should already have direct rendering enabled in dom0.

ATI: In the tarball/repository source tree, cd into fglrx and follow the instructions there. Or install this rpm in dom0. What is provided in this page has only beent tested to work for an ATI Radeon X600 (PCI express) and a handful of applications. Remember to modprobe fglrx, modify /etc/X11/xorg.conf to use the fglrx driver, and restart X.

NVIDIA: Patch here. Also, livna provides rpm's for this (kmod-nvidia-xen0). Remember to modprobe nvidia, modify /etc/X11/xorg.conf to use the nvidia driver, and restart X.


Roughly speaking, OpenGL up to version 1.5 is supported (sorry, no 2.0 shading languages,) with the following exceptions:

  • OpenGL 1.2 imaging functions related to histogram, min/max, convolution and colortables (like you really needed them...) 
  • Display lists aren't fully conformant: GL_COMPILE_AND_EXECUTE mode may not work reliably, specifically if there is a glGet* call between glNewList and glEndList which gets state that was set by a previous command compiled/executed inside the display list.

Roughly speaking (deja vu) GLX version 1.3 is supported, with the following exceptions: 

  • glXCopyContext
  • glXCreateGLXPixmap
  • glXDestroyGLXPixmap
  • glXWaitGL
  • glXWaitX
  • None of the GLX 1.3 functions related to Pbuffers or visual configs are implemented.

For more in-depth info, look into cr/doc/conformance.html and cr/glapi_parser/APIspec.txt in the source tree, or /usr/share/doc/xen-gl/cr/conformance.html if you've used an rpm. 

Other stuff

This project has been graciously sponsored by Google through their Summer of Code 2006 program, with mentoring by Dave Scott and Anil Madhavapeddy from Xensource. Here is the original project proposal.

The code is distributed under the Modified BSD licence (listed in the "General" section of the hyperlink.) Other Free Software licences apply as specified by the authors of code reused in the context of this project.


Last Updated September 20th, 2008