pub struct AcquiredBuffer {
pub fb_id: u32,
pub token: u64,
pub acquire_fence: Option<SyncFence>,
pub damage: Vec<DamageRect>,
}Expand description
A buffer handed over by LayerBufferSource::acquire, valid until the
matching release.
Move-only, because it carries an owned fence. That is load-bearing: it means the two-deep release queue cannot hand a buffer back early by accident — doing so is a move, and using it afterwards does not compile. Invariant 1’s ownership half is enforced by the type; only its timing half needs a test.
Releasing a buffer and then using it is a compile error, which is the whole point:
fn release(_buffer: AcquiredBuffer) {}
let buffer = AcquiredBuffer { fb_id: 1, ..AcquiredBuffer::default() };
release(buffer);
// The buffer is back with its source now; the display engine may already
// have stopped scanning it out. Reading it here would be exactly the
// use-after-release invariant 1 exists to prevent.
assert_eq!(buffer.fb_id, 1);Ordinary moves are of course fine:
let buffer = AcquiredBuffer { fb_id: 1, ..AcquiredBuffer::default() };
let moved = buffer;
assert_eq!(moved.fb_id, 1);Fields§
§fb_id: u32The DRM framebuffer the scene will write to the plane’s FB_ID.
Non-zero for a BindingModel::SceneSubmitsFbId source. Zero for
BindingModel::DriverOwnsBinding, where the scene skips the write.
token: u64A source-private token echoed back verbatim to release — typically a
slot index in a ring.
The C++ carries a void* here. A u64 covers every in-tree use (all of
them store an index) without inviting a raw pointer into a type that
crosses the source boundary.
acquire_fence: Option<SyncFence>An optional render-done fence: the pixels are valid only once it signals.
Set it when the producer renders asynchronously rather than CPU-blocking
before returning. The scene takes ownership: where the assigned plane
advertises IN_FENCE_FD it hands the descriptor to KMS so the kernel
waits before scanout; otherwise it waits on the CPU before committing.
Either way the fence rides this buffer’s lifecycle and closes on release
or drop — the kernel does not take ownership of IN_FENCE_FD.
Sources that produce ready buffers synchronously leave this None.
damage: Vec<DamageRect>Per-frame dirty regions.
Empty means full-frame — the scene emits no FB_DAMAGE_CLIPS and
assumes everything changed, which is correct but not power-optimal. A
non-empty list names the changed regions; the scene falls back to
full-frame above 16 rectangles, clips each to the buffer and drops any
left empty, and omits the blob entirely on planes or drivers without the
property.