Skip to main content

DmaBufImportDesc

Struct DmaBufImportDesc 

Source
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],
}
Available on Android or Linux only.
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: u32

DRM FOURCC of the surface (DRM_FORMAT_NV12, DRM_FORMAT_ABGR8888, …). libva layers[].drm_format.

§modifier: u64

DRM 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: u32

Surface width in pixels. Rejected when zero.

§height: u32

Surface height in pixels. Rejected when zero.

§num_planes: u8

Number 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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DmaBufImportDesc

Source§

impl Debug for DmaBufImportDesc

Source§

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

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

impl Eq for DmaBufImportDesc

Source§

impl Hash for DmaBufImportDesc

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DmaBufImportDesc

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DmaBufImportDesc

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,