summaryrefslogtreecommitdiff
path: root/amdgpu
diff options
context:
space:
mode:
authorJammy Zhou <Jammy.Zhou@amd.com>2015-08-17 11:09:07 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-08-17 16:21:38 -0400
commit102ab6f0049c2c85857fd19f098bc5b51e2a8a60 (patch)
tree16387ae7d9bcdaafa8b2a255461a09ef131bd8c1 /amdgpu
parent15ba8768f7002d220002d424790ff2e89310c07f (diff)
downloadlibdrm-102ab6f0049c2c85857fd19f098bc5b51e2a8a60.tar.gz
libdrm-102ab6f0049c2c85857fd19f098bc5b51e2a8a60.tar.bz2
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>
Diffstat (limited to 'amdgpu')
-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,
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);
@@ -73,7 +74,9 @@ amdgpu_vamgr_get_global(struct amdgpu_device *dev)
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;
}