aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'amdgpu/amdgpu_device.c')
-rw-r--r--amdgpu/amdgpu_device.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 11714e47..f473d2da 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -132,8 +132,7 @@ static int amdgpu_get_auth(int fd, int *auth)
132static void amdgpu_device_free_internal(amdgpu_device_handle dev) 132static void amdgpu_device_free_internal(amdgpu_device_handle dev)
133{ 133{
134 amdgpu_vamgr_deinit(&dev->vamgr_32); 134 amdgpu_vamgr_deinit(&dev->vamgr_32);
135 amdgpu_vamgr_deinit(dev->vamgr); 135 amdgpu_vamgr_deinit(&dev->vamgr);
136 free(dev->vamgr);
137 util_hash_table_destroy(dev->bo_flink_names); 136 util_hash_table_destroy(dev->bo_flink_names);
138 util_hash_table_destroy(dev->bo_handles); 137 util_hash_table_destroy(dev->bo_handles);
139 pthread_mutex_destroy(&dev->bo_table_mutex); 138 pthread_mutex_destroy(&dev->bo_table_mutex);
@@ -254,16 +253,12 @@ int amdgpu_device_initialize(int fd,
254 if (r) 253 if (r)
255 goto cleanup; 254 goto cleanup;
256 255
257 dev->vamgr = calloc(1, sizeof(struct amdgpu_bo_va_mgr)); 256 amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset,
258 if (dev->vamgr == NULL)
259 goto cleanup;
260
261 amdgpu_vamgr_init(dev->vamgr, dev->dev_info.virtual_address_offset,
262 dev->dev_info.virtual_address_max, 257 dev->dev_info.virtual_address_max,
263 dev->dev_info.virtual_address_alignment); 258 dev->dev_info.virtual_address_alignment);
264 259
265 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); 260 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
266 start = amdgpu_vamgr_find_va(dev->vamgr, 261 start = amdgpu_vamgr_find_va(&dev->vamgr,
267 max - dev->dev_info.virtual_address_offset, 262 max - dev->dev_info.virtual_address_offset,
268 dev->dev_info.virtual_address_alignment, 0); 263 dev->dev_info.virtual_address_alignment, 0);
269 if (start > 0xffffffff) 264 if (start > 0xffffffff)
@@ -282,10 +277,9 @@ int amdgpu_device_initialize(int fd,
282 277
283free_va: 278free_va:
284 r = -ENOMEM; 279 r = -ENOMEM;
285 amdgpu_vamgr_free_va(dev->vamgr, start, 280 amdgpu_vamgr_free_va(&dev->vamgr, start,
286 max - dev->dev_info.virtual_address_offset); 281 max - dev->dev_info.virtual_address_offset);
287 amdgpu_vamgr_deinit(dev->vamgr); 282 amdgpu_vamgr_deinit(&dev->vamgr);
288 free(dev->vamgr);
289 283
290cleanup: 284cleanup:
291 if (dev->fd >= 0) 285 if (dev->fd >= 0)