Skip to main content

Module ring

Module ring 

Source
Expand description

Shared-memory frame ring consumed by the Selkies V4L2 interposer.

The ring is an anonymous memfd mapped once by this writer and once, read-only, by every interposer client (it receives the fd over the control socket). Page 0 holds the header and the per-slot control blocks; frame bytes start at DATA_OFFSET. Every constant and offset below is mirrored by addons/v4l2-interposer/v4l2_interposer.c; the interposer refuses a connection whose version differs.

Publishing is a single-writer seqlock per slot: the slot’s seq is bumped to odd, the frame is written, seq is bumped to even, and only then does the header advertise the slot as the latest. Readers copy the newest slot and retry if seq changed or was odd, so no cross-process lock exists and a stalled reader never blocks the writer.

Structs§

Ring
Writer side of the ring. Not Sync: one thread publishes.
RingFormat
Geometry of the advertised device: a fixed-function camera with one format.

Constants§

CONFIG_SIZE
Byte size of the on-connect configuration struct (webcam_config_t).
CTRL_OFFSET
CTRL_STRIDE
DATA_OFFSET
MAX_SLOTS
MIN_SLOTS
SHM_MAGIC
SHM_VERSION
V4L2_PIX_FMT_MJPEG
V4L2_PIX_FMT_NV12
V4L2_PIX_FMT_YUV420
V4L2 fourcc codes the ring can advertise.
V4L2_PIX_FMT_YUYV

Functions§

fourcc
page_align