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>
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>
Creates a new handle for the object associated with a given
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>,
Looks up an object by its handle for a given
File.Source§fn create_mmap_offset(&self) -> Result<u64>
fn create_mmap_offset(&self) -> Result<u64>
Creates an mmap offset to map the object from userspace.
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> KnownSize for T
impl<T> KnownSize for T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot. Read more