aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'amdgpu/amdgpu_device.c')
-rw-r--r--amdgpu/amdgpu_device.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index e16cd24b..75b12e25 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -130,7 +130,8 @@ static int amdgpu_get_auth(int fd, int *auth)
130 130
131static void amdgpu_device_free_internal(amdgpu_device_handle dev) 131static void amdgpu_device_free_internal(amdgpu_device_handle dev)
132{ 132{
133 amdgpu_vamgr_reference(&dev->vamgr, NULL); 133 amdgpu_vamgr_deinit(dev->vamgr);
134 free(dev->vamgr);
134 util_hash_table_destroy(dev->bo_flink_names); 135 util_hash_table_destroy(dev->bo_flink_names);
135 util_hash_table_destroy(dev->bo_handles); 136 util_hash_table_destroy(dev->bo_handles);
136 pthread_mutex_destroy(&dev->bo_table_mutex); 137 pthread_mutex_destroy(&dev->bo_table_mutex);
@@ -251,7 +252,13 @@ int amdgpu_device_initialize(int fd,
251 if (r) 252 if (r)
252 goto cleanup; 253 goto cleanup;
253 254
254 dev->vamgr = amdgpu_vamgr_get_global(dev); 255 dev->vamgr = calloc(1, sizeof(struct amdgpu_bo_va_mgr));
256 if (dev->vamgr == NULL)
257 goto cleanup;
258
259 amdgpu_vamgr_init(dev->vamgr, dev->dev_info.virtual_address_offset,
260 dev->dev_info.virtual_address_max,
261 dev->dev_info.virtual_address_alignment);
255 262
256 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); 263 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
257 start = amdgpu_vamgr_find_va(dev->vamgr, 264 start = amdgpu_vamgr_find_va(dev->vamgr,
@@ -278,6 +285,8 @@ free_va:
278 r = -ENOMEM; 285 r = -ENOMEM;
279 amdgpu_vamgr_free_va(dev->vamgr, start, 286 amdgpu_vamgr_free_va(dev->vamgr, start,
280 max - dev->dev_info.virtual_address_offset); 287 max - dev->dev_info.virtual_address_offset);
288 amdgpu_vamgr_deinit(dev->vamgr);
289 free(dev->vamgr);
281 290
282cleanup: 291cleanup:
283 if (dev->fd >= 0) 292 if (dev->fd >= 0)