pub struct Object<T: DriverObject> { /* private fields */ }Expand description
A shmem-backed GEM object.
§Invariants
objcontains a valid initializedstruct drm_gem_shmem_objectfor the lifetime of this object.
Implementations§
Source§impl<T: DriverObject> Object<T>
impl<T: DriverObject> Object<T>
Sourcepub fn project<'__this>(
self: Pin<&'__this mut Self>,
) -> __Projection<'__this, T>
pub fn project<'__this>( self: Pin<&'__this mut Self>, ) -> __Projection<'__this, T>
Pin-projects all fields of Self.
These fields are structurally pinned:
objsgt_lockinner
These fields are not structurally pinned:
parent_resv_objsgt_res
Sourcepub fn with_project<'__this, R>(
self: Pin<&'__this mut Self>,
f: impl FnOnce(__ProjectionLt<'__this, T>) -> R,
) -> R
pub fn with_project<'__this, R>( self: Pin<&'__this mut Self>, f: impl FnOnce(__ProjectionLt<'__this, T>) -> R, ) -> R
Pin-projects all fields of Self with proper lifetime.
These fields are structurally pinned:
objsgt_lockinner
These fields are not structurally pinned:
parent_resv_objsgt_res
Sourcepub fn with_project_ref<'__this, R>(
self: Pin<&'__this Self>,
f: impl FnOnce(__ProjectionRef<'__this, T>) -> R,
) -> R
pub fn with_project_ref<'__this, R>( self: Pin<&'__this Self>, f: impl FnOnce(__ProjectionRef<'__this, T>) -> R, ) -> R
Pin-projects all fields of Self from a shared reference with proper lifetime.
These fields are structurally pinned:
objsgt_lockinner
These fields are not structurally pinned:
parent_resv_objsgt_res
Source§impl<T: DriverObject> Object<T>
impl<T: DriverObject> Object<T>
Sourcepub fn vmap<const SIZE: usize>(&self) -> Result<VMapRef<'_, T, SIZE>>
pub fn vmap<const SIZE: usize>(&self) -> Result<VMapRef<'_, T, SIZE>>
Creates and returns a virtual kernel memory mapping for this object.
Sourcepub fn sg_table<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a SGTable>
pub fn sg_table<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a SGTable>
Creates (if necessary) and returns an immutable reference to a scatter-gather table of DMA pages for this object.
This will pin the object in memory. It is expected that dev should be a pointer to the
same device::Device which self belongs to, otherwise this function will return
Err(EINVAL).
Sourcepub fn new(
dev: &Device<T::Driver>,
size: usize,
config: ObjectConfig<'_, T>,
args: T::Args,
) -> Result<ARef<Self>>
pub fn new( dev: &Device<T::Driver>, size: usize, config: ObjectConfig<'_, T>, args: T::Args, ) -> Result<ARef<Self>>
Create a new shmem-backed DRM object of the given size.
Additional config options can be specified using config.
Sourcepub fn owned_vmap<const SIZE: usize>(&self) -> Result<VMapOwned<T, SIZE>>
pub fn owned_vmap<const SIZE: usize>(&self) -> Result<VMapOwned<T, SIZE>>
Creates and returns an owned reference to a virtual kernel memory mapping for this object.
Trait Implementations§
Source§impl<T: DriverObject> AllocImpl for Object<T>
impl<T: DriverObject> AllocImpl for Object<T>
Source§impl<T> AlwaysRefCounted for Object<T>where
Self: IntoGEMObject,
T: DriverObject,
impl<T> AlwaysRefCounted for Object<T>where
Self: IntoGEMObject,
T: DriverObject,
Source§impl<T: DriverObject> Deref for Object<T>
impl<T: DriverObject> Deref for Object<T>
Source§impl<T: DriverObject> DerefMut for Object<T>
impl<T: DriverObject> DerefMut for Object<T>
Source§impl<T: DriverObject> HasPinData for Object<T>
impl<T: DriverObject> HasPinData for Object<T>
Source§impl<T: DriverObject> IntoGEMObject for Object<T>
impl<T: DriverObject> IntoGEMObject for Object<T>
impl<T: DriverObject> Send for Object<T>
impl<T: DriverObject> Sync for Object<T>
Auto Trait Implementations§
impl<T> !Freeze for Object<T>
impl<T> !RefUnwindSafe for Object<T>
impl<T> !UnsafeUnpin for Object<T>
impl<T> !UnwindSafe for Object<T>
Blanket Implementations§
Source§impl<T> BaseObject for Twhere
T: IntoGEMObject,
impl<T> BaseObject for Twhere
T: IntoGEMObject,
Source§fn create_handle<D, F>(&self, file: &File<F>) -> Result<u32>
fn create_handle<D, F>(&self, file: &File<F>) -> Result<u32>
File
(or returns an existing one).Source§fn lookup_handle<D, F>(file: &File<F>, handle: u32) -> Result<ARef<Self>>where
Self: AllocImpl<Driver = D> + AlwaysRefCounted,
D: Driver<Object = Self, File = F>,
F: DriverFile<Driver = D>,
fn lookup_handle<D, F>(file: &File<F>, handle: u32) -> Result<ARef<Self>>where
Self: AllocImpl<Driver = D> + AlwaysRefCounted,
D: Driver<Object = Self, File = F>,
F: DriverFile<Driver = D>,
File.Source§fn create_mmap_offset(&self) -> Result<u64>
fn create_mmap_offset(&self) -> Result<u64>
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<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
self into a T. This operation is guaranteed to be lossless.