The Puzzle of 3-D Graphics on Linux

New opportunities for game developers are provided by several tools.
DRI: Security, Stability, Speed

The Direct Rendering Infrastructure (DRI) is a technology developed by Precision Insight to add a direct rendering ability to an X server. In more common terms, DRI allows applications to safely and efficiently access the hardware directly while cooperating with the X server. Unlike Utah-GLX, it doesn't require privileged users or privileged programs. Furthermore, the work takes place in the application instead of in the X server.

More technically, one can think of DRI as three parts: a special X server, a direct rendering client and a kernel-level device driver. The special X server for Linux is XFree86 4.0, whose code contains special DRI modifications. The direct rendering client consists of several smaller components. The most important of these are an OpenGL implementation (in most cases Mesa), GLX as developed by PI from SGI's code, and driver libraries from PI that are Linux-specific (but hardware-independent). The kernel-level device driver is a module that abstracts direct memory access for hardware. It is designed in such a way that only the minimum of kernel modification should be needed in the future.

In short, DRI is hardware acceleration “done right”. Since it doesn't require special programs or privileges, there is an inherent level of security which current hardware-acceleration implementations may not have. Also, it is part of the XFree86 server and has undergone a significant amount of testing. With such a development system, the hope is that users can count on the usual stability associated with XFree86. Finally, the direct access to hardware gives Linux and XFree86 the chance to act as a solid, fast platform for professional graphics applications and demanding 3-D games.

Loose Odds and Ends

In addition to DRI, OpenGL, Mesa and the other terms, there are some smaller parts of the picture that you, faithful reader, are likely to have come across. Let's take a minute to go over each of them briefly.

  • GLUT began as a library called aux developed by Mark Kilgard (formerly of SGI, now at NVIDIA) to make programming examples easier in his book OpenGL Programming for the X Window System. This library was eventually improved and has matured into GLUT.

  • DGA is the direct graphics architecture. It is a very simple extension to the X server that allows applications to have direct access to the frame buffer. Users and applications need to have privileges to use DGA. With those permissions, they can get access to the frame buffer memory and draw, unaccelerated, on the screen. With the release of XFree86 4.0, DGA 2.0 will be included, bringing some hardware acceleration to basic 2-D drawing functions. In addition to the graphics abilities, DGA allows an application to read peripherals like the mouse and keyboard more directly. Normally, signals from those input devices pass through the X server before they can be used by an application.

  • VidMode—the vidmode extension allows an application to query the X server for the resolutions it supports and tell the X server to change to a specific resolution. This is often used in games that want to run at a specific size when your desktop is set to a different resolution.

  • Glide is the 3-D API developed by 3dfx for their Voodoo line of cards to provide fast, full-screen hardware acceleration. Its functionality was designed to match that of the Voodoo hardware 3dfx had created. Many early 3-D accelerated games, like Tomb Raider, used Glide. With the widespread acceptance of OpenGL for both productivity and entertainment applications, the importance of Glide has diminished. Consequently, 3dfx opted to release the source code and specifications to the public, a move which allowed its spread to other platforms.

Putting it All Together

Let's review: OpenGL is a library that facilitates the creation of 3-D graphics. Under Linux, there is an open-source library called Mesa which provides OpenGL compatibility. We have GLX to provide a standard way for OpenGL applications to work with X. For people still using XFree86 3.3.x and certain video cards, Utah-GLX provides some OpenGL functionality similar to the type that XFree86 4.0 and DRI provide. With XFree86 4.0, however, users get maximized 2-D and 3-D performance, better integration and more secure operation.

So there you have it. We can see how all the parts fit together and their dependencies upon one another.


Matt Matthews, a PhD student in Applied Mathematics at NCSU, became a Linux user in the summer of 1999 when he and his advisor bought new machines for their research. In addition to his computational work, he enjoys playing games and testing out the newest 3D video cards under Linux. When time allows, he writes up those experiences for his favorite website, If not deep in his research or writing, you can find him out with his wife, Mandy, or tending to his ever-growing collection of video games.

Daryll Strauss has been working Unix systems of one variety or another for the last 15 years. Linux became he preferred choice in 1995. During that time he has done image processing for the aerospace industry, special effects for the film business (including work on two films that won the academy award for visual effects), and on supporting open source 3D software for Linux. He is currently employed by VA Linux Systems, formerly Precision Insight, as a Visual Mason and Evangelist. In those rare moments when he isn't working you might find him playing beach volleyball, watching films, playing golf badly, or learning to play the harmonica.


Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

Upcoming Webinar
8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
11am CDT, April 29th
Moderated by Linux Journal Contributor Mike Diehl

Sign up now

Sponsored by Skybot