Graphics
Screen-based displays (primarily LEDs and CRTs) underpin most users' interactions with their desktops and mobile devices. Modern desktops regularly drive one or more large, colorful, high-resolution LEDs via one or sometimes multiple video cards. Graphics processing units commonly contain more transistors than the CPUs which control them.
Despite this, the basic process interface exposed by ANSI C and the UNIX kernel consists of two character streams. Don't blame me; I didn't do it.
FIXME Still to explain: Gallium, DRM, DRI, KMS, OpenGLES, OpenVG, widgetsets, VESA. VBE, DDC, EDID, TMDS... FIXME Explain how printing integrates with all this...
Displays
Standard Resolutions
Note that these terms are largely meaningless, and have been since SuperVGA.
Physical Connectors
Character Output
Serial consoles
GRUB on VGA
Linux system console on VGA
Graphical Output
Graphical output will require some kernel module(s) driving the video device(s). Framebuffer drivers are independent of userspace programs; they create a /dev entry, and can support the system console and the X framebuffer server. Direct Rendering Manager (DRM) drivers are used as part of X11's Direct Rendering Infrastructure (DRI), and require their own X servers. Framebuffer drivers generally accelerate only 2D operations (blitting, rectangular tiling, etc), or none at all. DRM drivers expose a much richer API, and can be used with fully hardware-accelerated X servers. In addition, closed source drivers -- usually paired with their own X servers, and not typically supporting a framebuffer device -- can be used. Use of both the DRI and framebuffer drivers with a device can lead to errors, although sometimes it works fine.
Framebuffer
An abstraction of hardware, mapping memory to displayed pixels. If a framebuffer driver is active, /dev/fbX devices will exist, and the fbset tool can be used to display their statuses. It is generally not advised to use a framebuffer driver at the same time as X-based hardware control, though this sometimes works in practice. When a framebuffer is present and supported at kernel boot time, Linux will display a Tux logo (see right) for each processor in the machine.
Framebuffer devices are typically named /dev/fbX. The fbset command can be used to access and control framebuffer devices. The framebuffer mode is generally configured via the kernel command line or arguments to modprobe(1)/init_module(2).
Xorg
Xorg's code base combines the DDX (Device-Dependent X) and the DIX (Device-Independent X).
Extensions
- Damage -- Notification that a portion of a window needs to be redrawn.
- Render -- Porter-Duff image compositioning. It wraps the Pixmap and Window datatypes with a new type, Picture. Picture provides an alpha channel.
- Shape -- Support for non-rectangular windows.
- RandR -- The X Resize, Rotate and Reflect Extension allows manipulation of root screens. Used for hotplugging devices, multidisplay, and changing devices.
- Xv (X Video) -- Scaling and YUV->RGB conversion offloading.
- XvMC -- X Video Motion Compensation. Offloads mocomp and iDCT for MPEG2.
- GLX -- The OpenGL extension, providing support for use of OpenGL within an X window. It is superseded by EGL.
Pixman
An archive of low-level rasterizing code used by Xorg and Cairo.
Memory Managers
- GEM - Graphics Execution Manager. Intel's solution for region and context management.
- TTM - Transition Table Maps.
Accelerators
- XAA - The XFree86 Acceleration Architecture. Added in XFree86 3.3, rewritten entirely for 4.0, and removed in X.org 1.13.
- KAA - KDrive Acceleration Architecture.
- EXA - A 3D version of XAA.
- UXA - Intel's EXA rewrite atop GEM.
- AIGLX - Accelerated Indirect GLX
- SNA - Sandy Bridge New Acceleration. Intel's new accelerator, which supports more than Sandy Bridge, but does not support non-Intel chipsets.
Wayland
Wayland is an experimental new compositing X server.
APIs
Xorg
XCB
The X protocol C language Bindings are a low-level API driving the minimalist XCB X wire protocol.
X11
The original wire protocol for X11. It is now implemented atop XCB.
Xlib
The original, archaic, extraordinarily ugly X widget set, plus window control routines and other primitives used by higher-level toolkits.
OpenGL
OpenGL (the Open Graphics Library) is an API specification geared towards hardware-accelerated 3D primitives. On desktop Linux, there are three major implementations of OpenGL:
- NVIDIA's proprietary implementation, which supports most NVIDIA cards
- AMD's proprietary implementation, which supports most AMD cards
- Mesa, an open implementation mixing hardware acceleration with software fallback. It includes:
- Gallium, an infrastructure designed to facilitate development of hardware-accelerated drivers
- Nouveau, an open implementation for NVIDIA cards, using Gallium
- Radeon, an open implementation for AMD cards, using Gallium
- An open implementation for Intel cards
- llvmpipe, a software rasterizer
Generally, the proprietary drivers tend to support newer OpenGL features and provide better performance, while the Mesa drivers are more smoothly integrated with the rest of the graphics stack (Kernel Mode Switching, Direct Rendering Infrastructure, XRandr, etc). Standard Linux tools might fail to work with the proprietary drivers, forcing use of proprietary tools to control the device.
EGL
EGL provides window manager-specific functionality for an OpenGL stack.
OpenGL ES
OpenGL for Embedded Systems. Mesa targets this with drivers for:
- OMAP (Texas Instruments)
- SGX (PowerVR)
OpenVG
Vector graphics acceleration targeting embedded systems (ie, often used in conjunction with OpenGL ES).
Cairo
Cairo is a vector drawing library used by applications either directly or through the GTK+ widget set. It's used heavily throughout the GNOME Project. Cairo has multiple backends, including:
SDL
The Simple DirectMedia Layer is a cross-platform, high-level multimedia library. It supports backends including:
DirectFB
A thin layer providing hardware acceleration and graphics primitives atop Linux framebuffer devices.
VAAPI
The Video Acceleration API. A cross-platform, open video offloading library.
VDPAU
NVIDIA's Video Decode and Presentation API for Unix. It is a superset of VAAPI, and suitable for use as a VAAPI backend.
Tools
xrandr
xrandr controls and accesses the RandR extension:
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 16384 x 16384 DVI-I-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 disconnected (normal left inverted right x axis y axis) DVI-I-2 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 641mm x 401mm 2560x1600 60.0*+ 1920x1440 60.0 1920x1200 59.9 1600x1200 60.0 1280x1024 75.0 60.0 1280x800 59.8 1152x864 75.0 1024x768 75.0 60.0 800x600 75.0 60.3 640x480 75.0 59.9 HDMI-0 disconnected (normal left inverted right x axis y axis) DVI-I-3 disconnected (normal left inverted right x axis y axis)
Xorg
xwininfo dumps information about an X window:
xwininfo: Window id: 0x3c00080 "xorg data rtypes - Google Search - Iceweasel" Absolute upper-left X: 6 Absolute upper-left Y: 21 Relative upper-left X: 6 Relative upper-left Y: 21 Width: 2548 Height: 1573 Depth: 24 Visual: 0x21 Visual Class: TrueColor Border width: 0 Class: InputOutput Colormap: 0x20 (installed) Bit Gravity State: NorthWestGravity Window Gravity State: NorthWestGravity Backing Store State: NotUseful Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +6+21 -6+21 -6-6 +6-6 -geometry 2548x1573+6-6
See Also
- VGA compatible text mode on Wikipedia
- "The Linux Graphics Stack"
- cairo-ickle
- carl's boring blog (Carl Worth)
- keithp.com/blog (Keith Packard)
- X Window System Technical Glossary