Expand description
Linux DRM/KMS backend for Denise.
Opens the display directly, sets a mode, and page-flips CPU-rendered dumb buffers straight to the scanout engine. No compositor, no window server, no GPU driver stack, no X.
§What this is not doing, and why
No gbm. GBM exists to allocate buffers a GPU renders into. Denise
renders with the CPU, so DRM dumb buffers are exactly the right allocation:
scanout-capable, CPU-mappable, and free of any C library. Adding GBM would drag
in libgbm and Mesa, which would end both the single-static-binary goal and easy
cross-compilation.
No atomic modesetting, yet. Atomic buys three things: FB_DAMAGE_CLIPS,
plane composition, and tear-free guarantees. The first is worth little here —
a page flip swaps whole buffers, so damage saves rasterisation, not bandwidth,
and most drivers ignore the property anyway. The second has a legacy equivalent
for the one plane that matters, the hardware cursor. So the legacy path gets
this milestone working on real hardware at a third of the code, behind a seam
that atomic can take over when planes actually earn their keep.
§Becoming DRM master
Setting a mode requires being DRM master, and only one process can be. If a
compositor or another Denise process holds it, Card::become_master fails
with EBUSY or EACCES — that is the single most common reason a first run on
a Pi does nothing. Three ways to have the right:
- Run on a bare VT with no display server. The usual kiosk deployment.
- Be handed a file descriptor by
libseator a systemd unit, viaCard::from_fd. Preferred for anything that has to coexist. - Run as root. Works, and is a poor way to ship a product.
§Testing
mode and swapchain are platform-independent on purpose and are unit
tested everywhere, including on machines with no DRM device. They hold the
decisions that are hard to debug in the field and easy to check on a laptop.
Everything else is a thin wrapper over ioctls and can only be proven on real
hardware.
Re-exports§
pub use mode::ConnectorInfo;pub use mode::ConnectorKind;pub use mode::ModeInfo;pub use mode::ModePreference;pub use mode::OutputPreference;pub use mode::Selection;pub use mode::SelectionError;pub use swapchain::Swapchain;
Modules§
- mode
- Choosing which output to drive and at what mode.
- swapchain
- Buffer rotation and buffer-age bookkeeping.
Structs§
- Card
- An open DRM device.
- DrmSurface
- A display brought up under our control, scanning out CPU-rendered buffers.
- Surface
Config - How to bring the display up.
Enums§
- DrmError
- Something went wrong talking to the display.
- Present
Mode - When a queued flip actually reaches the panel.