pub(crate) struct DmaBufIdentity {
dev: u64,
ino: u64,
size: i64,
modifier: u64,
width: u32,
height: u32,
}Expand description
The stable identity of a dmabuf, so a cache keyed by the raw fd number cannot hand back a stale import after that fd was closed and recycled onto a different buffer.
The fd integer alone is not an identity: the host’s slot renegotiation frees the backing buffer
objects and the kernel reissues the same small fd numbers for the new ones. Since Linux 5.3 each
dma-buf carries its own inode, so (st_dev, st_ino) distinguishes two buffers that reuse one fd
number, and size reports the true allocation; the DRM format modifier and the geometry round
out the identity for older kernels where the inode is shared. A cache hit requires every field to
match, so a recycled fd whose buffer differs in any of them is re-imported instead of reused.
Fields§
§dev: u64§ino: u64§size: i64§modifier: u64§width: u32§height: u32Implementations§
Source§impl DmaBufIdentity
impl DmaBufIdentity
Sourcepub(crate) fn probe(fd: i32, modifier: u64, width: u32, height: u32) -> Self
pub(crate) fn probe(fd: i32, modifier: u64, width: u32, height: u32) -> Self
Read the identity of the buffer behind fd: fstat supplies the inode and allocation
size, and the caller supplies the modifier and geometry from the dmabuf descriptor. A failed
fstat leaves the inode/size zero, which still combines with the modifier and geometry.
Trait Implementations§
Source§impl Clone for DmaBufIdentity
impl Clone for DmaBufIdentity
Source§fn clone(&self) -> DmaBufIdentity
fn clone(&self) -> DmaBufIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DmaBufIdentity
Source§impl Debug for DmaBufIdentity
impl Debug for DmaBufIdentity
impl Eq for DmaBufIdentity
Source§impl PartialEq for DmaBufIdentity
impl PartialEq for DmaBufIdentity
impl StructuralPartialEq for DmaBufIdentity
Auto Trait Implementations§
impl Freeze for DmaBufIdentity
impl RefUnwindSafe for DmaBufIdentity
impl Send for DmaBufIdentity
impl Sync for DmaBufIdentity
impl Unpin for DmaBufIdentity
impl UnsafeUnpin for DmaBufIdentity
impl UnwindSafe for DmaBufIdentity
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more