#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Tier {
Plane,
Composite,
Fb,
}
#[must_use]
pub const fn choose_presenter_tier(
reservable: usize,
desired: usize,
has_canvas_plane: bool,
) -> Option<Tier> {
if desired > 0 && reservable >= desired {
return Some(Tier::Plane);
}
if has_canvas_plane {
return Some(Tier::Composite);
}
None
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(
clippy::exhaustive_structs,
reason = "a value defined by its fields; there is nothing to add to it"
)]
pub struct PropertyWrite {
pub object_id: u32,
pub property_id: u32,
pub value: u64,
}
#[derive(Debug, Clone, Copy, Default)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers with `..Default::default()`, which a new field does not break"
)]
pub struct SurfaceRef {
pub fb_id: u32,
pub width: u32,
pub height: u32,
pub x: i32,
pub y: i32,
pub generation: u64,
}
impl SurfaceRef {
#[must_use]
pub const fn is_armed(self) -> bool {
self.fb_id != 0 && self.width != 0 && self.height != 0
}
}