The current (and probably permanent) state of the art in OpenGL support under Linux (and other UNIXen in general) is the Direct Rendering Infrastructure from Precision Insight. It is not one single program, package, or piece of code. Instead, it is a pervasive collection of libraries and interfaces implemented in all of the important pieces of the puzzle. Specifically, it is an interface between the X server, the kernel, and the OpenGL libraries.

First off, there is a kernel module, called the DRM, which handles low-level hardware access, such as memory buffer management and memory-mapping virtual memory segments to DMA buffers for AGP hardware, and the inter-process security and locking.

Next, there is the driver for the X server. Because XFree86 was being rewritten from the ground up for version 4.0, it was possible to add in hooks for OpenGL calls into the 2D driver which would handle OpenGL context management. This driver does not directly handle any 3D operations, however; this is offloads to the DRI driver.

The DRI driver (not to be confused with the DRM, as described above) has the task of converting OpenGL commands into hardware-level commands. It is also the DRI driver which communicates with the DRM to have the commands actually sent to the hardware. Additionally, the client program can dynamically link in the DRI driver directly - so commands don't have to be transmitted through the slow GLX mechanism. For added speed, the DRI driver can communicate with the hardware through memory-mapped I/O (MMIO), as is the normal case for AGP-based graphics cards.

As far as the client program is concerned, all of this is coordinated through the OpenGL library, libGL. libGL determines whether it is doing indirect or direct rendering (indirect being where it is displaying on another system). In the case of indirect, it simply opens up a GLX connection to the remote display and begins to shove the OpenGL commands it receives down this pipe, whereas in the case of direct, it queries the X server for the DRI driver and whatever connections to the DRM module that it requires, and proceeds to work its magic.

Detailed information:

  • Introduction to the DRI
  • DRI low-level description (preliminary)
  • DRI dataflow diagram