Skip to main content

Crate drmkit_capture

Crate drmkit_capture 

Source
Expand description

Read back what a CRTC is scanning out, and write it to a file.

snapshot() composites the planes bound to a CRTC into an Image the size of its active mode, reading each plane’s buffer back through a dma-buf. write_png puts one on disk.

This is a readback path, not a rendering one: it reads buffers that already exist and blends them on the CPU as the display controller would, for planes that are neither cropped nor scaled. What it cannot read – tiled buffers, YUV, anything not host-mappable – it skips with a warning rather than failing the capture, because a screenshot missing its video overlay is more use than no screenshot.

Structs§

Image
A premultiplied ARGB8888 image, one u32 per pixel, rows contiguous.
Nv12Frame
One NV12 frame, as a camera or decoder hands it over.

Enums§

CaptureError
What can go wrong capturing or writing a frame.

Functions§

snapshot
Read back the current plane composition of crtc_id into an image sized to its active mode.
src_over
Premultiplied SRC_OVER: dst = src + dst * (1 - src_alpha).
unpremultiply
Recover straight-alpha channels from a premultiplied pixel.
write_jpg
Write image as a baseline JPEG.
write_jpg_nv12
Write an NV12 frame as a baseline JPEG, without converting to RGB first.
write_png
Encode image as an 8-bit RGBA PNG at path, creating or truncating it.