Skip to main content

PlanePropertyMap

Struct PlanePropertyMap 

Source
pub struct PlanePropertyMap { /* private fields */ }
Expand description

Resolves a layer’s PropTags to the DRM property ids of a given plane.

Property ids are per-object and stable for a device’s lifetime, so they are resolved once per plane and cached. Doing it per frame would be an ioctl per property per layer.

Implementations§

Source§

impl PlanePropertyMap

Source

pub fn new() -> Self

An empty map.

Source

pub fn learn_plane( &mut self, device: &Device, plane_id: u32, ) -> Result<(), CoreError>

Resolve and cache every tag this crate writes for plane_id.

Tags the plane does not expose are simply absent: a plane without rotation or alpha is normal, and asking for one is not an error.

§Errors

CoreError if the plane’s properties cannot be read at all.

Source

pub fn learn_all( &mut self, device: &Device, registry: &PlaneRegistry, ) -> Result<(), CoreError>

Learn every plane the registry knows about.

§Errors

CoreError if a plane’s properties cannot be read.

Source

pub fn note_color_committed(&mut self, plane_id: u32, color: Option<Ycbcr>)

Record that a real commit carried a plan entry’s colorimetry.

Call for every entry of a frame the kernel accepted. A TEST_ONLY applies nothing, so noting one would suppress the write on the commit that actually matters and leave the plane on the previous client’s settings. An entry that asks for nothing – the composition canvas – leaves the record as it was.

Source

pub fn property_id(&self, plane_id: u32, tag: PropTag) -> Option<u32>

The DRM property id for a tag on a plane, if it is writable there.

Source

pub fn is_immutable(&self, plane_id: u32, tag: PropTag) -> bool

Whether the plane marks this property immutable.

Source

pub fn len(&self) -> usize

How many planes have been learned.

Source

pub fn is_empty(&self) -> bool

Whether nothing has been learned yet.

Source§

impl PlanePropertyMap

Source

pub fn rescale_alpha(&self, plane_id: u32, value: u64) -> u64

A layer’s 16-bit alpha, on the scale this plane advertises.

Every write of a layer’s properties goes through emit_layer, so this one call covers the allocator’s tests, the real commit and a pinned layer alike – upstream needed two fixes to reach all three.

Source

pub fn clamp_zpos(&self, plane_id: u32, value: u64) -> u64

Bring a derived zpos inside what the plane will actually take.

Only zpos is clamped, and only against an unsigned range. Every other plane property carries a value the caller measured or was handed – a rectangle, a framebuffer id – where a value outside the range is a real error that silently moving would hide. zpos alone is computed, so it alone is worth bending to fit; a canvas one slot lower than asked is still above every layer, whereas the alternative is no frame at all.

Trait Implementations§

Source§

impl Debug for PlanePropertyMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PlanePropertyMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.