How DRM/KMS Drivers Are Structured: CRTCs, Planes, Encoders and Connectors
How a Linux 6.12 DRM/KMS display driver is organized into framebuffers, planes, CRTCs, encoders and connectors, and how atomic commits move through them.

A display on Linux is not one object. It is a pipeline of stages, each modeled by a kernel object, and every display driver, from a laptop's integrated graphics to a small SPI panel on a board, is a set of implementations of those stages registered with the Direct Rendering Manager (DRM). The part that deals with showing pixels is kernel mode setting, KMS. Knowing the objects, what each stands for in hardware and how a configuration change flows through them is the prerequisite to reading any display driver, and to understanding the tools that report the state. This post describes the model as it stands in Linux 6.12: the five object types, the way they connect, atomic commits, and where buffers come from.
The authoritative text is the kernel's KMS documentation and the driver-facing DRM internals.
The display pipeline
Scanout is the process of reading pixels from memory and delivering them to a screen. KMS splits it into stages that mirror real display hardware:
| Object | Hardware it stands for | Kernel structure |
|---|---|---|
| Framebuffer | A buffer of pixels in memory with a format and stride | struct drm_framebuffer |
| Plane | A hardware layer that reads a framebuffer and positions it | struct drm_plane |
| CRTC | The display controller's timing and blending engine | struct drm_crtc |
| Encoder | The block that converts the pixel stream to a signal format | struct drm_encoder |
| Connector | The physical output: a port, a panel, a cable | struct drm_connector |
Data moves left to right through that table. A plane reads a framebuffer, one or more planes feed a CRTC, which blends them and generates timing, and the CRTC output goes to an encoder, such as an HDMI transmitter or a MIPI DSI block, which drives a connector. The names come from older graphics hardware. "CRTC" is a cathode ray tube controller by origin, and nowadays it means the generator of the display timing and the compositor of the planes.
A connector represents what is plugged in: its status (connected or not), its supported modes read from the display's EDID data, and its properties. An encoder and a connector together form an output path. The set of CRTCs an encoder can attach to is fixed by hardware, which is why each encoder carries a possible_crtcs bitmask, and the same holds for planes.
Planes in detail
Planes are the part of the model that changed most over the years. Early KMS had a CRTC scanning out one framebuffer. Modern hardware has several layers that the display controller composites on the fly, with scaling, rotation and alpha blending in hardware, which saves memory bandwidth and power compared with composing in software.
Each plane has a type:
Primary is the main layer, covering the screen. Every CRTC needs one.
Cursor is a small layer for the mouse pointer, with a dedicated hardware path on most controllers.
Overlay is any additional layer, used for video, a second window or the status bar.
A plane's state carries the source rectangle in the framebuffer, the destination rectangle on the CRTC, the pixel format, the rotation and the blend settings. A driver announces which formats and modifiers each plane can scan out, and user space (a compositor) queries them and decides which window goes on which plane.
The device and its mode configuration
Everything hangs off a struct drm_device, created by the driver at probe, with a struct drm_driver that names the driver and its features. The mode configuration holds the global limits and the lists of objects:
dev = drm_dev_alloc(&sample_drm_driver, parent);
drmm_mode_config_init(dev);
dev->mode_config.min_width = 0;
dev->mode_config.max_width = 4096;
dev->mode_config.min_height = 0;
dev->mode_config.max_height = 4096;
dev->mode_config.funcs = &sample_mode_config_funcs;The driver creates its planes, CRTCs, encoders and connectors and links them. Each object has an init function, such as drm_crtc_init_with_planes(), taking a table of function pointers the driver implements. Those tables are the driver. A typical small display driver provides a CRTC with atomic_enable, atomic_disable and atomic_flush, a plane with atomic_update, a connector with get_modes, and an encoder or bridge for the output stage. After the objects are registered, drm_dev_register() exposes the device to user space as /dev/dri/card0.
For displays that need almost nothing, the kernel offers helper layers that cut the code to a handful of callbacks, such as the simple display pipe helpers for one plane feeding one CRTC with one output, and the panel and bridge frameworks for the encoder side. A driver for a small SPI panel is mostly an enable function and a function that sends pixels.
Atomic commits
A configuration change in modern KMS is atomic: user space proposes a complete new state for every object it touches, the kernel checks it as a whole, and either everything is applied or nothing is. This prevents a display from flashing through half-configured intermediate states.
The flow of one commit has these steps:
User space builds a request with new property values for planes, CRTCs and connectors, and submits it with the atomic ioctl, optionally asking for a test-only check.
The core duplicates the current state into a new
struct drm_atomic_stateand applies the requested changes to the copy.Check phase. The core calls each object's
atomic_checkto validate the new state: is the format supported, does the plane fit, is the clock achievable. A failure returns an error and the hardware is untouched.Commit phase. The core calls the
atomic_disableoperations for objects being turned off, then theatomic_updateof planes and theatomic_enableandatomic_flushof CRTCs, in an order that respects dependencies. Hardware registers are programmed here.The new state replaces the old, and the core sends completion events.
The separation of check and commit is the design's central idea. Check may be called many times by a compositor trying configurations, and it must have no side effects. Commit runs only after a check succeeded, so it should not fail: it is the point of no return. A driver that discovers an unsupported combination during commit has a bug in its check.
Updates to the hardware are timed to vertical blanking, the interval between frames, so a change takes effect cleanly between frames and not in the middle of one. The CRTC's flush callback arms the update, and the page-flip event reports when the swap happened, which is the signal a compositor uses to know when to render the next frame.
Where buffers come from
The memory manager for framebuffer contents is GEM, the Graphics Execution Manager. A GEM object is a handle to a buffer owned by the driver, and drivers with simple needs use the generic implementations such as the DMA-contiguous GEM helper, drm_gem_dma_object, for hardware that scans out from physically contiguous memory.
The simplest way to get a framebuffer onto a display is a dumb buffer: a plain buffer with a linear layout created with a driver-independent ioctl, which a program can map into its address space and fill with pixels, with no GPU involved. The modetest and early console programs use this path. A GPU driver adds buffers rendered by the GPU, shared with other devices through dma-buf, and the display driver scans them out if the format and layout are acceptable.
Inspecting a running system
modetest from libdrm lists the objects and their connections, and it is the quickest way to see the model as the kernel exposes it:
sudo modetest -M sample-drm -cConnectors:
id encoder status name size (mm) modes encoders
33 32 connected HDMI-A-1 600x340 12 32
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driverThe columns are the object IDs from the pipeline: connector 33 uses encoder 32, which is connected to a CRTC. The mode line is the timing in pixels, the horizontal and vertical porches and the pixel clock of 148.5 MHz in kilohertz, the numbers that the CRTC programs into its timing generator. With -p, modetest lists planes and shows which CRTC each can attach to.
The kernel keeps the current atomic state in debugfs, and printing it is the reference when a display misbehaves:
sudo cat /sys/kernel/debug/dri/0/state | head -n 8plane[31]: plane-0
crtc=crtc-0
fb=45
allocated by = Xorg
refcount=2
format=XR24 little-endian (0x34325258)
modifier=0x0
size=1920x1080The state shows which framebuffer each plane is scanning out, its format and who created it. It is the answer to "what is the hardware actually showing" when the compositor and the screen disagree.


