aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJammy Zhou2015-08-16 22:09:07 -0500
committerAlex Deucher2015-08-17 15:21:38 -0500
commit102ab6f0049c2c85857fd19f098bc5b51e2a8a60 (patch)
tree16387ae7d9bcdaafa8b2a255461a09ef131bd8c1
parent15ba8768f7002d220002d424790ff2e89310c07f (diff)
downloadexternal-libdrm-102ab6f0049c2c85857fd19f098bc5b51e2a8a60.tar.gz
external-libdrm-102ab6f0049c2c85857fd19f098bc5b51e2a8a60.tar.xz
external-libdrm-102ab6f0049c2c85857fd19f098bc5b51e2a8a60.zip
amdgpu: improve amdgpu_vamgr_init
Make it a generic function independent of the device info. Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Christian K├Ânig <christian.koenig@amd.com>
-rw-r--r--amdgpu/amdgpu_vamgr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index b5d330f6..eef8a71a 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -46,11 +46,12 @@ int amdgpu_va_range_query(amdgpu_device_handle dev,
46 return -EINVAL; 46 return -EINVAL;
47} 47}
48 48
49static void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, struct amdgpu_device *dev) 49static void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start,
50 uint64_t max, uint64_t alignment)
50{ 51{
51 mgr->va_offset = dev->dev_info.virtual_address_offset; 52 mgr->va_offset = start;
52 mgr->va_max = dev->dev_info.virtual_address_max; 53 mgr->va_max = max;
53 mgr->va_alignment = dev->dev_info.virtual_address_alignment; 54 mgr->va_alignment = alignment;
54 55
55 list_inithead(&mgr->va_holes); 56 list_inithead(&mgr->va_holes);
56 pthread_mutex_init(&mgr->bo_va_mutex, NULL); 57 pthread_mutex_init(&mgr->bo_va_mutex, NULL);
@@ -73,7 +74,9 @@ amdgpu_vamgr_get_global(struct amdgpu_device *dev)
73 ref = atomic_inc_return(&vamgr.refcount); 74 ref = atomic_inc_return(&vamgr.refcount);
74 75
75 if (ref == 1) 76 if (ref == 1)
76 amdgpu_vamgr_init(&vamgr, dev); 77 amdgpu_vamgr_init(&vamgr, dev->dev_info.virtual_address_offset,
78 dev->dev_info.virtual_address_max,
79 dev->dev_info.virtual_address_alignment);
77 return &vamgr; 80 return &vamgr;
78} 81}
79 82