Lines Matching +full:reference +full:- +full:sync

1 // SPDX-License-Identifier: GPL-2.0 OR MIT
18 sync::aref::{
45 unsafe impl $( <$( $tparam_id ),+> )? $crate::sync::aref::AlwaysRefCounted for $type
51 // SAFETY: The existence of a shared reference guarantees that the refcount is
52 // non-zero.
60 // SAFETY: The safety requirements guarantee that the refcount is non-zero.
77 pub trait DriverObject: Sync + Send + Sized {
89 ) -> impl PinInit<Self, Error>; in new()
92 fn open(_obj: &<Self::Driver as drm::Driver>::Object, _file: &DriverFile<Self>) -> Result { in open()
102 /// Returns a reference to the raw `drm_gem_object` structure, which must be valid as long as
104 fn as_raw(&self) -> *mut bindings::drm_gem_object; in as_raw()
106 /// Converts a pointer to a `struct drm_gem_object` into a reference to `Self`.
110 /// - `self_ptr` must be a valid pointer to `Self`.
111 /// - The caller promises that holding the immutable reference returned by this function does
113 unsafe fn from_raw<'a>(self_ptr: *mut bindings::drm_gem_object) -> &'a Self; in from_raw()
119 ) -> core::ffi::c_int { in open_callback()
148 fn as_raw(&self) -> *mut bindings::drm_gem_object { in as_raw()
152 unsafe fn from_raw<'a>(self_ptr: *mut bindings::drm_gem_object) -> &'a Self { in from_raw()
162 fn size(&self) -> usize { in size()
169 fn create_handle<D, F>(&self, file: &drm::File<F>) -> Result<u32> in create_handle()
184 fn lookup_handle<D, F>(file: &drm::File<F>, handle: u32) -> Result<ARef<Self>> in lookup_handle()
197 // - A `drm::Driver` can only have a single `File` implementation. in lookup_handle()
198 // - `file` uses the same `drm::Driver` as `Self`. in lookup_handle()
199 // - Therefore, we're guaranteed that `ptr` must be a gem object embedded within `Self`. in lookup_handle()
200 // - And we check if the pointer is null befoe calling from_raw(), ensuring that `ptr` is a in lookup_handle()
205 // - We take ownership of the reference of `drm_gem_object_lookup()`. in lookup_handle()
206 // - Our `NonNull` comes from an immutable reference, thus ensuring it is a valid pointer to in lookup_handle()
212 fn create_mmap_offset(&self) -> Result<u64> { in create_mmap_offset()
223 /// Crate-private base operations shared by all GEM object classes.
227 fn raw_dma_resv(&self) -> *mut bindings::dma_resv { in raw_dma_resv()
239 /// - `self.obj` is a valid instance of a `struct drm_gem_object`.
242 pub struct Object<T: DriverObject + Send + Sync> {
268 pub fn new(dev: &drm::Device<T::Driver>, size: usize, args: T::Args) -> Result<ARef<Self>> { in new()
272 data <- T::new(dev, size, args), in new()
298 // SAFETY: We take over the initial reference count from `drm_gem_object_init()`. in new()
303 pub fn dev(&self) -> &drm::Device<T::Driver> { in dev()
305 // - `struct drm_gem_object.dev` is initialized and valid for as long as the GEM in dev()
307 // - The device we used for creating the gem object is passed as &drm::Device<T::Driver> to in dev()
313 fn as_raw(&self) -> *mut bindings::drm_gem_object { in as_raw()
341 fn deref(&self) -> &Self::Target { in deref()
360 pub(super) const fn create_fops() -> bindings::file_operations { in create_fops()