LLVMpipe: OpenGL With Gallium3D on Your CPU

Written by Michael Larabel in Display Drivers on 30 April 2010 at 01:00 AM EDT. Page 1 of 3. 29 Comments.

The software rasterizer used in Mesa that allows for software acceleration of OpenGL on the CPU without any assistance from the graphics processor has largely been useless. Even with a modern-day, multi-core processor, the performance of Mesa's software rasterizer has been abysmal. The performance of Mesa classic DRI drivers have traditionally been poor anyways compared to the high-performance, proprietary NVIDIA/ATI graphics drivers, but when dealing with just the software rasterizer there really aren't any games or applications that run well. Fortunately, software acceleration on Gallium3D is very much a different story thanks to LLVM.

Most often when we are talking about Gallium3D drivers we are usually talking about one of the upcoming or current state trackers (like OpenGL, OpenCL, OpenGL ES, OpenVG, DirectX, etc) or one of the drivers. The Gallium3D hardware drivers include CELL, i915, i965, Nouveau (NV50/NVFX), R300, and SVGA. Unfortunately the only ones that have been really maturing are Nouveau for NVIDIA graphics cards, R300 for ATI Radeon R300-R500 (up through the Radeon X100 series), and SVGA, which is a virtual Gallium3D driver created by VMware for use within their virtualization stack by guest operating systems. If you have not had a graphics card that runs well with Gallium3D, you really have not been able to experience its implemented state tracker features or its improved performance over classic Mesa, but now using the software driver is becoming a more viable option.

The original solution for running Gallium3D in the software / on the CPU rather than with a real GPU driver was a driver called softpipe. Gallium3D's Softpipe driver has been to serve as a reference implementation of a Gallium3D driver and to use in fallback scenarios where there is no graphics hardware support available. Softpipe is still a better option than the software rasterizer found in classic Mesa, but VMware (former Tungsten Graphics employees) have taken the performance to the next level with LLVMpipe.

LLVMpipe is a fork of the Softpipe driver that uses LLVM for code generation. Yes, LLVM as in the Low-Level Virtual Machine compiler infrastructure. LLVM is unique for its modular design and advanced capabilities, which open-source GPU developers have been long wanting to tap into after Apple began using LLVM to compile some GPU shaders in unique cases on their Mac OS X operating system. LLVM could be used similarly within GPU drivers for optimizing shaders and IR as was talked about at FOSDEM 2009 or in the case of LLVMpipe it is being used entirely to generate optimized code that targets the CPU.

The LLVMpipe Gallium3D driver currently implements the entire fragment pipeline in a single function and supports input interpolation, depth testing, texture sampling, fragment shader TGSI translation, alpha testing, blend in SoA and AoS layouts, and provides generic code output, among other implemented features (these are just the completed items that are documented). With the texture sampling what is support are 1D/2D/3D/cube maps, texture wrap modes, texture-filtering modes, and most texture formats. There still is some work to do in this driver to fully take advantage of the latest Gallium3D and LLVM advancements, but last month it gained some speed as Zack Rusin and José Fonseca has been working to implement the vertex pipeline and other features. Last week LLVMpipe began running two to six times faster in some tests thanks to the new geometry processing pipeline that the driver implements. With the recent activity in LLVMpipe, we found it time to benchmark this Gallium3D driver.

The Gallium3D LLVMpipe driver does not touch the GPU, so it can be run with any graphics card. However, for efficient performance, you will want to be running a 64-bit operating system and a CPU that supports SSE2.0 or better. LLVM can take advantage of SSE3 and SSE4 extensions too, which will result in even greater performance. To no surprise, the better the CPU you have, the better LLVMpipe will perform. The more cores that the CPU has, the better the performance will be too, as the rasterizer supports threading and tiling. If you are running a high-end Intel Core 2 Duo/Quad, an Intel Core i3/i5/i7, Intel Xeon, AMD Athlon II X4, AMD Phenom II, or AMD Opteron your CPU should be adequate.


Related Articles