pub struct Output { /* private fields */ }Expand description
The layers destined for one CRTC, in presentation order.
§Deviation: the composition layer is owned here
The C++ Output takes the composition layer by reference and owns only the
rest, keeping a std::vector<std::unique_ptr<Layer>> alongside a
std::vector<Layer*> view it can reorder independently.
Here every layer is owned by the Output and the composition layer is
identified by LayerId. Holding a &mut Layer in the struct would infect
every caller with a lifetime parameter for no benefit, and owning it removes
the second vector — and with it the C++’s since-removed rebuild_layer_ptrs, which
would have silently undone sort_layers_by_zpos
had anything called it (drm-cxx#237).
Implementations§
Source§impl Output
impl Output
Sourcepub fn add_layer(&mut self) -> LayerId
pub fn add_layer(&mut self) -> LayerId
Add an empty layer, returning its id.
Ids are never reused for the life of the output, which is what lets the allocator key its warm-start state on them safely.
Sourcepub fn remove_layer(&mut self, id: LayerId) -> bool
pub fn remove_layer(&mut self, id: LayerId) -> bool
Remove a layer. Returns whether it was there.
If it was the composition layer, the output is left with none.
Sourcepub fn layers(&self) -> impl Iterator<Item = LayerRef<'_>> + '_
pub fn layers(&self) -> impl Iterator<Item = LayerRef<'_>> + '_
Every layer with its id, in presentation order.
Sourcepub fn layer_refs(&self) -> Vec<LayerRef<'_>>
pub fn layer_refs(&self) -> Vec<LayerRef<'_>>
Every layer, as the slice the allocator takes.
Sourcepub fn set_composition_layer(&mut self, id: LayerId) -> bool
pub fn set_composition_layer(&mut self, id: LayerId) -> bool
Designate a layer as the composition pass’s output.
Clears the flag on any previous composition layer, so exactly one layer
carries it. Returns whether id names a layer of this output.
Sourcepub const fn composition_layer(&self) -> Option<LayerId>
pub const fn composition_layer(&self) -> Option<LayerId>
The composition layer’s id, if one is designated.
Sourcepub fn any_layer_dirty(&self) -> bool
pub fn any_layer_dirty(&self) -> bool
Whether any layer changed since the last
mark_clean.
Sourcepub fn changed_layers(&self) -> impl Iterator<Item = LayerRef<'_>> + '_
pub fn changed_layers(&self) -> impl Iterator<Item = LayerRef<'_>> + '_
The layers that changed, in presentation order.
Sourcepub fn mark_clean(&mut self)
pub fn mark_clean(&mut self)
Clear every layer’s dirty flag.
Sourcepub fn sort_layers_by_zpos(&mut self)
pub fn sort_layers_by_zpos(&mut self)
Reorder layers by ascending zpos, treating an unset zpos as 0.
Stable, so layers sharing a zpos keep the order they were added in.