Expand description
Umbrella crate for drmkit, a layered Linux DRM/KMS display framework — modesetting, plane allocation, scene composition, and scanout.
drmkit is a behavioral-parity Rust port of drm-cxx.
§Using it
Every member crate is a module here, behind a feature of the same name:
drmkit::scene is drmkit-scene, drmkit::core is drmkit-core. The
default features are the path from a card to a committed scene —
core, modeset, dumb, fmt, planes and scene — and full adds
every other crate.
[dependencies]
drmkit = { version = "0.1", features = ["cursor", "capture"] }None of those links a system library. The parts that do are features of their own, so a build machine is never asked for one nobody wanted:
| Feature | Turns on | Links |
|---|---|---|
edid | EDID parsing in display | libdisplay-info |
hotplug | the hotplug watch in display | libudev |
libinput | input devices in input | libinput, libudev |
xkb | keymaps and key resolution in input | xkbcommon |
libseat | the seat backend in session | libseat |
A member crate’s other features — JPEG in drmkit-capture, the tracing
sink in drmkit-log, the device half of drmkit-present — are turned on
by naming that crate alongside this one; Cargo unifies the two.
§Status
Phases 0–4 of the porting plan are met. Of phase 5, the v0.1.0-minimal
ship gate, what remains is the smoke run on RK3588 and VisionFive 2
boards; the 0.1 releases ship ahead of it. A scene can bring up a display,
allocate planes for a layer stack, commit a frame, composite what it
cannot place, and release buffers on the right vblank; EDID, color
management, cursor and capture are in. So are the present spine,
cross-output orchestration, GBM surface sources and client-side
decorations.
Not yet here: the GL compositor, the GL and Vulkan scanout producers, EGL
streams, the V4L2, GStreamer and nvbufsurface sources, and the Vulkan
display surface.
Of the 108 test files drm-cxx v5.0.0 has, 75 are ported, 14 partial and 3
not applicable; the 16 still pending each wait on hardware or a library
this tree does not have — a GPU render node, the vgem, vivid or
vicodec modules, or NVIDIA silicon. TEST_PARITY.md records which, per
file.
§The crates
Roughly bottom-up. A consumer driving a display needs -core, -modeset
and one of the buffer crates; everything above that is optional.
| Crate | What it is for |
|---|---|
drmkit-core | Device handles, cached properties, atomic requests. Everything else sits on this. |
drmkit-modeset | Choosing a mode, and dispatching page-flip events. |
drmkit-dumb | GPU-free CPU-mappable scanout buffers. |
drmkit-gbm | GBM allocation, for when the GPU renders. |
drmkit-fmt | Formats and modifiers: what a plane will actually scan out. |
drmkit-planes | The plane registry and the allocator that assigns layers to planes. |
drmkit-scene | A layer stack, lowered to a frame and committed; composition for what will not fit. |
drmkit-scene-sources | Where a layer’s pixels come from: dumb buffers, imported DMA-BUFs. |
drmkit-scene-gbm | A layer fed by a GBM surface — the swap chain a GL or Vulkan producer renders into. |
drmkit-scene-set | Mirrored layers across several scenes, and how many commits a frame across them costs. |
drmkit-present | The scanout spine: buffer rings, modifier negotiation, frame pacing, and a backend that drives them. |
drmkit-csd | Client-side decorations: title bars, shadows, and getting them onto a plane. |
drmkit-display | EDID, driver capabilities, color pipelines and tone mapping. |
drmkit-cursor | Cursor themes, and getting one onto a plane. |
drmkit-capture | Reading back what a CRTC is scanning out. |
drmkit-sync | sync_file fences, for explicit synchronization. |
drmkit-session | Holding devices across a VT switch. |
drmkit-input | libinput devices and xkb key resolution. |
drmkit-log | Diagnostics: a process-wide level and an installable sink. |
drmkit-time | A swappable presentation clock, so pacing is testable. |
§The contracts
Six timing and lifetime rules are load-bearing across the crates, and each
is stated once in INVARIANTS.md and cross-referenced from the items that
carry it. They are the parts a caller can get wrong without any type
complaining — releasing a buffer a commit ago, tearing down while a flip is
outstanding — so the doc comment on the item that owns each one is worth
reading before using it.
Follow https://github.com/jwinarske/drmkit for the porting plan, the per-phase scope, and what each divergence from the reference turned out to be.
Modules§
- capture
capture - Read back what a CRTC is scanning out, and write it to a file.
- core
core - Core DRM/KMS device access for drmkit.
- csd
csd - Client-side window decorations.
- cursor
cursor - Cursor themes, and the cursors in them.
- display
display - Display characterization and color handling.
- dumb
dumb - DRM dumb buffers: GPU-free, CPU-mappable scanout surfaces.
- fmt
fmt - Format-modifier and hardware-compression support for drmkit’s plane allocator.
- gbm
gbm - GBM buffer allocation.
- input
input - Keyboard, pointer and touch input.
- log
log - drmkit’s library-wide diagnostic surface.
- modeset
modeset - Mode selection and page-flip dispatch for drmkit.
- planes
planes - Display-plane capabilities, the layer model, and the plane allocator.
- present
present - The present spine: getting rendered frames onto a display, repeatedly.
- scene
scene - Scene composition for drmkit.
- scene_
gbm scene-gbm - A scene source backed by a GBM surface.
- scene_
set scene-set - Several scenes, one frame.
- scene_
sources scene-sources - Tier-1 buffer sources for drmkit scenes.
- session
session - Holding devices across a VT switch.
- sync
sync sync_filefences for explicit synchronization.- time
time - drmkit’s library-wide monotonic clock abstraction.
Constants§
- UPSTREAM_
BASELINE - The upstream drm-cxx revision this port targets.