static void amdgpu_device_free_internal(amdgpu_device_handle dev)
{
amdgpu_vamgr_deinit(&dev->vamgr_32);
- amdgpu_vamgr_deinit(dev->vamgr);
- free(dev->vamgr);
+ amdgpu_vamgr_deinit(&dev->vamgr);
util_hash_table_destroy(dev->bo_flink_names);
util_hash_table_destroy(dev->bo_handles);
pthread_mutex_destroy(&dev->bo_table_mutex);
if (r)
goto cleanup;
- dev->vamgr = calloc(1, sizeof(struct amdgpu_bo_va_mgr));
- if (dev->vamgr == NULL)
- goto cleanup;
-
- amdgpu_vamgr_init(dev->vamgr, dev->dev_info.virtual_address_offset,
+ amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset,
dev->dev_info.virtual_address_max,
dev->dev_info.virtual_address_alignment);
max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
- start = amdgpu_vamgr_find_va(dev->vamgr,
+ start = amdgpu_vamgr_find_va(&dev->vamgr,
max - dev->dev_info.virtual_address_offset,
dev->dev_info.virtual_address_alignment, 0);
if (start > 0xffffffff)
free_va:
r = -ENOMEM;
- amdgpu_vamgr_free_va(dev->vamgr, start,
+ amdgpu_vamgr_free_va(&dev->vamgr, start,
max - dev->dev_info.virtual_address_offset);
- amdgpu_vamgr_deinit(dev->vamgr);
- free(dev->vamgr);
+ amdgpu_vamgr_deinit(&dev->vamgr);
cleanup:
if (dev->fd >= 0)
struct drm_amdgpu_info_device dev_info;
struct amdgpu_gpu_info info;
/** The global VA manager for the whole virtual address space */
- struct amdgpu_bo_va_mgr *vamgr;
+ struct amdgpu_bo_va_mgr vamgr;
/** The VA manager for the 32bit address space */
struct amdgpu_bo_va_mgr vamgr_32;
};