[PATCH v2 14/20] drm/radeon: implement mmap access managament

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


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

Cc: Alex Deucher <alexander.deucher at amd.com>
Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
---
 drivers/gpu/drm/radeon/radeon_gem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index aa79603..365819a 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -147,12 +147,17 @@ int radeon_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_pri
 	struct radeon_bo_va *bo_va;
 	int r;
 
+	r = drm_vma_node_allow(&rbo->tbo.vma_node, file_priv->filp);
+	if (r)
+		return r;
+
 	if (rdev->family < CHIP_CAYMAN) {
 		return 0;
 	}
 
 	r = radeon_bo_reserve(rbo, false);
 	if (r) {
+		drm_vma_node_revoke(&rbo->tbo.vma_node, file_priv->filp);
 		return r;
 	}
 
@@ -177,6 +182,8 @@ void radeon_gem_object_close(struct drm_gem_object *obj,
 	struct radeon_bo_va *bo_va;
 	int r;
 
+	drm_vma_node_revoke(&rbo->tbo.vma_node, file_priv->filp);
+
 	if (rdev->family < CHIP_CAYMAN) {
 		return;
 	}
-- 
1.8.3.2



More information about the dri-devel mailing list