[PATCH v2 11/20] drm/cirrus: implement mmap access managament

David Herrmann dh.herrmann at gmail.com
Sun Jul 7 10:17:27 PDT 2013


Correctly allow and revoke buffer access on each open/close via the new
VMA offset manager.

Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
---
 drivers/gpu/drm/cirrus/cirrus_drv.h  |  4 ++++
 drivers/gpu/drm/cirrus/cirrus_main.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h b/drivers/gpu/drm/cirrus/cirrus_drv.h
index bae5560..6af655a 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.h
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
@@ -193,6 +193,10 @@ int cirrus_device_init(struct cirrus_device *cdev,
 void cirrus_device_fini(struct cirrus_device *cdev);
 int cirrus_gem_init_object(struct drm_gem_object *obj);
 void cirrus_gem_free_object(struct drm_gem_object *obj);
+int cirrus_gem_open_object(struct drm_gem_object *obj,
+			   struct drm_file *file_priv);
+void cirrus_gem_close_object(struct drm_gem_object *obj,
+			     struct drm_file *file_priv);
 int cirrus_dumb_mmap_offset(struct drm_file *file,
 			    struct drm_device *dev,
 			    uint32_t handle,
diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c
index 3a7a0ef..345e77b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -291,6 +291,21 @@ void cirrus_gem_free_object(struct drm_gem_object *obj)
 	cirrus_bo_unref(&cirrus_bo);
 }
 
+int cirrus_gem_open_object(struct drm_gem_object *obj,
+			   struct drm_file *file_priv)
+{
+	struct cirrus_bo *bo = gem_to_cirrus_bo(obj);
+
+	return drm_vma_node_allow(&bo->bo.vma_node, file_priv->filp);
+}
+
+void cirrus_gem_close_object(struct drm_gem_object *obj,
+			     struct drm_file *file_priv)
+{
+	struct cirrus_bo *bo = gem_to_cirrus_bo(obj);
+
+	drm_vma_node_revoke(&bo->bo.vma_node, file_priv->filp);
+}
 
 static inline u64 cirrus_bo_mmap_offset(struct cirrus_bo *bo)
 {
-- 
1.8.3.2



More information about the dri-devel mailing list