diff mbox series

[RFC,5/9] rust: drm: gem: shmem: set map_wc on gem_create_object callback

Message ID 20230317121213.93991-6-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series Rust version of the VGEM driver | expand

Commit Message

Maíra Canal March 17, 2023, 12:12 p.m. UTC
Some drivers use the gem_create_object callback to define the mapping of
the object write-combined (map_wc). Currently, the DRM Rust abstractions
doesn't allow such operation. So, add a constant to the DriverObject trait
to allow drivers to set map_wc on the gem_create_object callback. By
default, the constant returns false, which is the shmem default value.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 rust/kernel/drm/gem/shmem.rs | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
index 8f17eba0be99..d6c56b3cfa71 100644
--- a/rust/kernel/drm/gem/shmem.rs
+++ b/rust/kernel/drm/gem/shmem.rs
@@ -24,6 +24,9 @@  use gem::BaseObject;
 pub trait DriverObject: gem::BaseDriverObject<Object<Self>> {
     /// Parent `Driver` for this object.
     type Driver: drv::Driver;
+
+    /// Define the map object write-combined
+    const MAP_WC: bool = false;
 }
 
 // FIXME: This is terrible and I don't know how to avoid it
@@ -110,6 +113,8 @@  unsafe extern "C" fn gem_create_object<T: DriverObject>(
     let new: &mut Object<T> = unsafe { &mut *(p as *mut _) };
 
     new.obj.base.funcs = &Object::<T>::VTABLE;
+    new.obj.map_wc = <T>::MAP_WC;
+
     &mut new.obj.base
 }