[PATCH 2/4] amdgpu: improve amdgpu_vamgr_init

Jammy Zhou Jammy.Zhou at amd.com
Sun Aug 16 20:09:07 PDT 2015


Make it a generic function independent of the device info.

Signed-off-by: Jammy Zhou <Jammy.Zhou at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com>
---
 amdgpu/amdgpu_vamgr.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index cc4a1c4..71fd2b1 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -46,11 +46,12 @@ int amdgpu_va_range_query(amdgpu_device_handle dev,
 	return -EINVAL;
 }
 
-static void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, struct amdgpu_device *dev)
+static void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start,
+			      uint64_t max, uint64_t alignment)
 {
-	mgr->va_offset = dev->dev_info.virtual_address_offset;
-	mgr->va_max = dev->dev_info.virtual_address_max;
-	mgr->va_alignment = dev->dev_info.virtual_address_alignment;
+	mgr->va_offset = start;
+	mgr->va_max = max;
+	mgr->va_alignment = alignment;
 
 	list_inithead(&mgr->va_holes);
 	pthread_mutex_init(&mgr->bo_va_mutex, NULL);
@@ -72,7 +73,9 @@ drm_private struct amdgpu_bo_va_mgr * amdgpu_vamgr_get_global(struct amdgpu_devi
 	ref = atomic_inc_return(&vamgr.refcount);
 
 	if (ref == 1)
-		amdgpu_vamgr_init(&vamgr, dev);
+		amdgpu_vamgr_init(&vamgr, dev->dev_info.virtual_address_offset,
+				  dev->dev_info.virtual_address_max,
+				  dev->dev_info.virtual_address_alignment);
 	return &vamgr;
 }
 
-- 
1.9.1



More information about the dri-devel mailing list