pub struct DmaBufImportDesc {
pub fourcc: u32,
pub modifier: u64,
pub width: u32,
pub height: u32,
pub num_planes: u8,
pub plane_object_index: [u8; 4],
pub plane_strides: [u32; 4],
pub plane_offsets: [u32; 4],
}Expand description
Everything about a DMA-BUF surface except the object fds themselves —
the layout half of DmaBufHandle.
One field per attribute a DMA-BUF importer reads, so a construction
site reads as the API it feeds: the
EGL_EXT_image_dma_buf_import(_modifiers) attribute list, libva’s
VADRMPRIMESurfaceDescriptor, or
VkImageDrmFormatModifierExplicitCreateInfoEXT +
VkSubresourceLayout[]. Every field’s object/plane model, and why
one modifier covers a whole surface, is documented on
DmaBufHandle itself.
§Why plain pub fields
The descriptor is inert layout data — vkImportMemoryFdKHR and
EGL_EXT_image_dma_buf_import take it at face value, and getting it
wrong yields wrong pixels or a driver-side import error, never
undefined behaviour (see DmaBufHandle::new’s Correctness, not
safety note). The invariants that are checkable in-process — extent
non-degenerate, 1..=4 planes, every active plane naming a real
object — are checked by DmaBufHandle::from_objects, the single
funnel every carrier is built through, against the fds it is paired
with. The carrier then stores the descriptor privately, so a
validated handle cannot be edited back into an invalid one.
Fields§
§fourcc: u32DRM FOURCC of the surface (DRM_FORMAT_NV12, DRM_FORMAT_ABGR8888,
…). libva layers[].drm_format.
modifier: u64DRM format modifier describing the tiling / compression of the
whole surface (DRM_FORMAT_MOD_LINEAR for the untiled case).
One value per surface, not per object — see DmaBufHandle.
width: u32Surface width in pixels. Rejected when zero.
height: u32Surface height in pixels. Rejected when zero.
num_planes: u8Number of meaningful planes, 1..=4. Bounds how far
Self::plane_object_index / Self::plane_strides /
Self::plane_offsets are read. Rejected outside 1..=4.
plane_object_index: [u8; 4]Object each plane lives in — index into DmaBufHandle::fds.
libva layers[].object_index[]. Only the first
Self::num_planes entries are meaningful; each must name a real
object or construction is rejected. [0; 4] for the
single-object (COMPOSED_LAYERS) case that
DmaBufHandle::new serves.
plane_strides: [u32; 4]Per-plane row stride in bytes (libva layers[].pitch[]). Only the
first Self::num_planes entries are meaningful.
plane_offsets: [u32; 4]Per-plane byte offset within its object (libva
layers[].offset[]). Only the first Self::num_planes entries
are meaningful.
Trait Implementations§
Source§impl Clone for DmaBufImportDesc
impl Clone for DmaBufImportDesc
impl Copy for DmaBufImportDesc
Source§impl Debug for DmaBufImportDesc
impl Debug for DmaBufImportDesc
impl Eq for DmaBufImportDesc
Source§impl Hash for DmaBufImportDesc
impl Hash for DmaBufImportDesc
Source§impl PartialEq for DmaBufImportDesc
impl PartialEq for DmaBufImportDesc
impl StructuralPartialEq for DmaBufImportDesc
Auto Trait Implementations§
impl Freeze for DmaBufImportDesc
impl RefUnwindSafe for DmaBufImportDesc
impl Send for DmaBufImportDesc
impl Sync for DmaBufImportDesc
impl Unpin for DmaBufImportDesc
impl UnsafeUnpin for DmaBufImportDesc
impl UnwindSafe for DmaBufImportDesc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.