[PATCH 03/16] drm/cirrus: implement mmap access managament

David Herrmann dh.herrmann at gmail.com
Tue Aug 13 12:38:24 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 9b0bb91..2fec34b 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 f130a53..7046c4b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -284,6 +284,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.4



More information about the dri-devel mailing list