diff mbox

[02/16] drm/ast: implement mmap access managament

Message ID 1376422717-12229-3-git-send-email-dh.herrmann@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Herrmann Aug. 13, 2013, 7:38 p.m. UTC
Correctly allow and revoke buffer access on each open/close via the new
VMA offset manager.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/gpu/drm/ast/ast_drv.c  |  2 ++
 drivers/gpu/drm/ast/ast_drv.h  |  4 ++++
 drivers/gpu/drm/ast/ast_main.c | 15 +++++++++++++++
 3 files changed, 21 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index a144fb0..bc6f2c5 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -214,6 +214,8 @@  static struct drm_driver driver = {
 
 	.gem_init_object = ast_gem_init_object,
 	.gem_free_object = ast_gem_free_object,
+	.gem_open_object = ast_gem_open_object,
+	.gem_close_object = ast_gem_close_object,
 	.dumb_create = ast_dumb_create,
 	.dumb_map_offset = ast_dumb_mmap_offset,
 	.dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 796dbb2..e6ab966 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -325,6 +325,10 @@  extern int ast_dumb_create(struct drm_file *file,
 
 extern int ast_gem_init_object(struct drm_gem_object *obj);
 extern void ast_gem_free_object(struct drm_gem_object *obj);
+extern int ast_gem_open_object(struct drm_gem_object *obj,
+			       struct drm_file *file_priv);
+extern void ast_gem_close_object(struct drm_gem_object *obj,
+				 struct drm_file *file_priv);
 extern int ast_dumb_mmap_offset(struct drm_file *file,
 				struct drm_device *dev,
 				uint32_t handle,
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 7f6152d..b7b4b16 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -477,6 +477,21 @@  void ast_gem_free_object(struct drm_gem_object *obj)
 	ast_bo_unref(&ast_bo);
 }
 
+int ast_gem_open_object(struct drm_gem_object *obj,
+			struct drm_file *file_priv)
+{
+	struct ast_bo *ast_bo = gem_to_ast_bo(obj);
+
+	return drm_vma_node_allow(&ast_bo->bo.vma_node, file_priv->filp);
+}
+
+void ast_gem_close_object(struct drm_gem_object *obj,
+			  struct drm_file *file_priv)
+{
+	struct ast_bo *ast_bo = gem_to_ast_bo(obj);
+
+	drm_vma_node_revoke(&ast_bo->bo.vma_node, file_priv->filp);
+}
 
 static inline u64 ast_bo_mmap_offset(struct ast_bo *bo)
 {