Skip to main content

Crate drmkit_present

Crate drmkit_present 

Source
Expand description

The present spine: getting rendered frames onto a display, repeatedly.

Port of src/present/ from drm-cxx @ 4a0b64a, less the GL and Vulkan producers.

Where drmkit_scene answers “what goes on which plane this frame”, this crate answers the questions around it: which buffer to draw into, how much of it needs redrawing, and whether the frame is worth submitting at all.

§Why it is a separate crate

A producer that renders on the GPU needs EGL or Vulkan; one that writes pixels with the CPU needs neither. Keeping the spine core-only means a GPU-less build — a kiosk, a test rig, an instrument panel — links no graphics stack at all. The device-facing half sits behind the device feature, and the GBM producer behind gbm, which opens libgbm.

§Not here yet

The GL and Vulkan producers. They will live in their own crates and load their libraries at runtime, plugging into ScanoutBackend through the ScanoutProducer trait the way the GBM producer does.

Structs§

BackendConfig
How to build a scanout backend.
BufferRing
A producer-agnostic pool of scanout slots with buffer age and damage accumulation.
Config
How a sink is configured.
DumbRingSource
A ring of CPU-mapped dumb buffers, presented as a scene layer’s source.
DumbScanoutSink
A software present path: hand it a finished CPU frame, it puts it on screen.
FrameEconomy
The per-frame present decision, and what it has decided so far.
GbmScanoutProducer
Allocates scanout buffers straight from the DRM node’s GBM device.
Lease
A slot handed to the producer for the next frame.
Rect
A damage rectangle, in buffer pixels.
ScanoutBackend
One output, one layer, and everything between a producer and the screen.

Enums§

FrameAction
What the present loop should do with this frame.
PaintError
What went wrong painting a frame.
PresentError
What went wrong presenting a frame.
ProducerError
Why a producer could not hand over a buffer.
Repaint
What a reused slot must repaint before its contents are a correct frame.
RestorePolicy
What to leave on screen when the backend goes away.
VrrPolicy
When to ask for variable refresh.

Constants§

DEFAULT_PREFERENCE
The default preference order: most color depth first, 16-bit last.

Traits§

ScanoutProducer
Something that allocates the buffers a scanout path presents.

Functions§

negotiate
Intersect what a producer can export with what a plane can scan out, and rank the survivors.
negotiate_for_format
As negotiate, taking the plane’s modifiers from a FormatTable for one fourcc.
negotiate_scanout_format
The first format in preferred that a plane on crtc_id can scan out.