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: u32Pixel width of the allocation.
height: u32Pixel height of the allocation.
format: DmaBufFormatPixel format.
modifier: u64DRM 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
impl DmaBufFrame
Sourcepub fn new(
width: u32,
height: u32,
format: DmaBufFormat,
modifier: u64,
planes: Vec<DmaBufPlane>,
rendering_fence: Option<OwnedFd>,
) -> Self
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.
Sourcepub fn with_lease(self, lease: Box<dyn DmaBufLease>) -> Self
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.
Sourcepub fn with_visible_size(self, width: u32, height: u32) -> Self
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.
Sourcepub fn visible_size(&self) -> (u32, u32)
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.
Sourcepub fn is_render_ready(&self) -> bool
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.