diff options
Diffstat (limited to 'lib/libdrm/amdgpu/amdgpu_vamgr.c')
-rw-r--r-- | lib/libdrm/amdgpu/amdgpu_vamgr.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/libdrm/amdgpu/amdgpu_vamgr.c b/lib/libdrm/amdgpu/amdgpu_vamgr.c index 2b1388edc..ab425ef7c 100644 --- a/lib/libdrm/amdgpu/amdgpu_vamgr.c +++ b/lib/libdrm/amdgpu/amdgpu_vamgr.c @@ -34,18 +34,19 @@ #include "util_math.h" int amdgpu_va_range_query(amdgpu_device_handle dev, - enum amdgpu_gpu_va_range type, uint64_t *start, uint64_t *end) + enum amdgpu_gpu_va_range type, + uint64_t *start, uint64_t *end) { - if (type == amdgpu_gpu_va_range_general) { - *start = dev->dev_info.virtual_address_offset; - *end = dev->dev_info.virtual_address_max; - return 0; - } - return -EINVAL; + if (type != amdgpu_gpu_va_range_general) + return -EINVAL; + + *start = dev->dev_info.virtual_address_offset; + *end = dev->dev_info.virtual_address_max; + return 0; } drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, - uint64_t max, uint64_t alignment) + uint64_t max, uint64_t alignment) { mgr->va_offset = start; mgr->va_max = max; @@ -65,7 +66,7 @@ drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr) pthread_mutex_destroy(&mgr->bo_va_mutex); } -drm_private uint64_t +static drm_private uint64_t amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, uint64_t alignment, uint64_t base_required) { @@ -83,8 +84,8 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, /* first look for a hole */ LIST_FOR_EACH_ENTRY_SAFE(hole, n, &mgr->va_holes, list) { if (base_required) { - if(hole->offset > base_required || - (hole->offset + hole->size) < (base_required + size)) + if (hole->offset > base_required || + (hole->offset + hole->size) < (base_required + size)) continue; waste = base_required - hole->offset; offset = base_required; @@ -154,7 +155,7 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, return offset; } -drm_private void +static drm_private void amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size) { struct amdgpu_bo_va_hole *hole; @@ -192,9 +193,9 @@ amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size) hole->offset = va; hole->size += size; /* Merge lower hole if it's adjacent */ - if (next != hole - && &next->list != &mgr->va_holes - && (next->offset + next->size) == va) { + if (next != hole && + &next->list != &mgr->va_holes && + (next->offset + next->size) == va) { next->size += hole->size; list_del(&hole->list); free(hole); |