[UPDATE 2011-09-05]I received some questions (or saw them), which I
tried to answer with a
follow-up entry.[/UPDATE]
As I tried to explain this a few times in the past to others and had trouble
myself, when I started using Linux, I thought I take some time today and write
down what parts comprise the Linux graphics stack and how they interact. I'll
ignore some parts which aren't too interesting to an average user at the moment,
to keep this post as consise as possible. Apart from that, I hope I'm able to
put all the relevant data into one spot.
Let us start our little journey in the kernel. There, in a directory named gpu you'll find the drm
directory, which contains all DRM drivers. In this post, we'll
focus on those. The drivers in that directory are the kernel side of the
Direct Rendering Infrastructure (DRI) and are responsible for managing
concurrent access to the graphics hardware. They also provide interfaces to pass
commands and data to the GPU. The DRI wiki explains the three main purposes of the DRM
modules.
The DRM module is also the part that decides whether KMS or UMS is used. Other acronyms you might hear
with regard to graphics acceleration on Linux and are referring to the Kernel
part are:
- GEM: an
Intel-developed memory management system for GPUs.
- TTM: refers to the
memory management system used by almost all non-Intel drivers (e.g. AMD's
Radeon drivers). The TTM interface is "GEM-ified", meaning it
offers the same API as GEM.
Apart from that, every driver has its hardware-specific parts like utilizing
power-saving functions of the respective GPUs, loading firmware, if required,
etc.
Now we move from Kernel space to user land. We'll ignore any non-X and
non-Mesa parts (like acceleration for TTYs). That means, that our next
GPU specific part is most likely the DDX. (Please note, that the classic DDX
might be replaced by a Gallium3D state tracker, currently that would be the
xorg state tracker, but xorg will be replaced by XA.
This is only an option if the Gallium driver for your GPU supports one of those
state trackers, see the Gallium status page for further
details.) The DDX for your GPU offers plain (2D) X acceleration on your
hardware. The respective DDX' are generally named xf86-video-[NAME],
where [NAME] is replaced by e.g. ati or intel. The
DDX decides which X acceleration paths are available. Acronyms you might hear,
referring to the DDX part of the graphics stack, are:
- EXA: even though it looks like an acronym, the X.Org wiki Glossary defines it as:
acceleration architecture with no well-defined acronym
EXA superseded the older XAA and offers 2D
acceleration, often in conjunction with XRender.
- UXA: more or less EXA for Intel GPUs.
- GLX: actually not a part of the DDX, but an extension for X. It provides
a way to draw with OpenGL into an window managed by X.
- XRandR: An extension for
X which needs to be supported by the DDX to work. It offers a standardized
way to set up (multiple) heads (e.g. resolution, position, rotation,
etc.).
We're almost through: the last important part is the 3D acceleration offered
by a Mesa driver. Mesa drivers come in two flavours: classic (e.g. all Intel
drivers which are supported by Intel) and Gallium3D-based (like the drivers for
Radeon chips from the R300 onwards). The difference here is, that the Gallium3D
drivers try to share as much code as possible (and thus simplify writing a new
driver supporting many platforms, systems and technologies), while the classic
drivers are specific to certain platforms, chips, and technologies. They share
much less code among each other. All parts of Mesa need direct access to the
graphics hardware (DRI)
The Mesa drivers use the 3D pipeline of the GPUs for accelerated drawing,
even for non-3D applications like video acceleration (recently VDPAU, XvMC and VA support were added to Gallium3D, driver
support followed quickly). Otherwise the Mesa drivers are mainly used for
OpenGL acceleration. Users of OpenGL include scientific programs, CAD and – of course – games.
This concludes our little journey through the various parts of the Linux
graphics stack. I hope it helps in understanding the building blocks.