Skip to main content

DmaBufFrame

Struct DmaBufFrame 

Source
pub struct DmaBufFrame {
    pub width: u32,
    pub height: u32,
    pub format: DmaBufFormat,
    pub modifier: u64,
    pub planes: Vec<DmaBufPlane>,
    pub rendering_fence: Option<OwnedFd>,
    /* private fields */
}
Expand description

A DMA-BUF frame, its planes, and the producer’s lease on the buffer.

Fields§

§width: u32

Pixel width of the allocation.

§height: u32

Pixel height of the allocation.

§format: DmaBufFormat

Pixel format.

§modifier: u64

DRM format modifier describing the plane layout.

§planes: Vec<DmaBufPlane>

Owned planes.

§rendering_fence: Option<OwnedFd>

Rendering completion fence supplied by the producer.

Implementations§

Source§

impl DmaBufFrame

Source

pub fn new( width: u32, height: u32, format: DmaBufFormat, modifier: u64, planes: Vec<DmaBufPlane>, rendering_fence: Option<OwnedFd>, ) -> Self

Creates a frame whose descriptors this side owns outright.

Attach a producer’s buffer lease with Self::with_lease.

§Panics

Panics when the dimensions are zero or the frame is not a single packed 32-bit plane.

Source

pub fn with_lease(self, lease: Box<dyn DmaBufLease>) -> Self

Attaches the producer’s lease on the buffer this frame borrows.

§Panics

Panics when the frame already carries a lease, since only one producer can own the buffer.

Source

pub fn with_visible_size(self, width: u32, height: u32) -> Self

Narrows the frame to the region that actually holds the image.

Presenting a padded buffer edge to edge stretches the picture and draws the padding gutter, which is what happens whenever a producer’s coded size exceeds its visible rect.

§Panics

Panics when the visible size is zero or exceeds the buffer, since such a region cannot describe any part of the image this frame holds.

Source

pub fn visible_size(&self) -> (u32, u32)

The extent that should be presented: the visible region when the buffer is padded, the whole buffer otherwise.

Source

pub fn is_render_ready(&self) -> bool

Returns whether the explicit rendering fence has signalled.

A frame with no fence is ready as soon as it arrives.

§Panics

Panics when polling the rendering fence fails.

Source

pub fn presented(&mut self)

Tells the producer the frame has been imported or copied.

Does nothing for a frame with no lease.

§Panics

Panics when the producer rejects the transition, typically because the frame was presented twice.

Source

pub fn release(self, release_fence: Option<OwnedFd>)

Returns the buffer to the producer and drops the frame’s descriptors.

§Panics

Panics when a frame with no lease is given a release fence: there is no producer to hand it to, so accepting it would silently discard it.

Trait Implementations§

Source§

impl Debug for DmaBufFrame

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,