diff options
author | Monk Liu <monk.liu@amd.com> | 2017-08-08 12:09:07 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-08 12:16:20 -0400 |
commit | 687d250797ff0028fee949cdd66c9f012f69992d (patch) | |
tree | a200b5b5a360d4a7a2a686206055fa8d539e0c80 /amdgpu/amdgpu_internal.h | |
parent | 2a89ae5d7a7d5845226ed85146140ff4c8788d59 (diff) | |
download | external_libdrm-687d250797ff0028fee949cdd66c9f012f69992d.tar.gz external_libdrm-687d250797ff0028fee949cdd66c9f012f69992d.tar.bz2 external_libdrm-687d250797ff0028fee949cdd66c9f012f69992d.zip |
amdgpu: merge and cleanup amdgpu_bo_free
since bo_reference and bo_internal_free are
all only used by bo_free, so we just merge them
together
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'amdgpu/amdgpu_internal.h')
-rw-r--r-- | amdgpu/amdgpu_internal.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h index 28d1f38f..56d15112 100644 --- a/amdgpu/amdgpu_internal.h +++ b/amdgpu/amdgpu_internal.h @@ -143,8 +143,6 @@ struct amdgpu_semaphore { * Functions. */ -drm_private void amdgpu_bo_free_internal(amdgpu_bo_handle bo); - drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, uint64_t max, uint64_t alignment); @@ -189,35 +187,4 @@ static inline bool update_references(atomic_t *dst, atomic_t *src) return false; } -/** - * Assignment between two amdgpu_bo pointers with reference counting. - * - * Usage: - * struct amdgpu_bo *dst = ... , *src = ...; - * - * dst = src; - * // No reference counting. Only use this when you need to move - * // a reference from one pointer to another. - * - * amdgpu_bo_reference(&dst, src); - * // Reference counters are updated. dst is decremented and src is - * // incremented. dst is freed if its reference counter is 0. - */ -static inline void amdgpu_bo_reference(struct amdgpu_bo **dst, - struct amdgpu_bo *src) -{ - pthread_mutex_t *mlock; - struct amdgpu_bo* bo = *dst; - - assert(bo != NULL); - mlock = &bo->dev->bo_table_mutex; - pthread_mutex_lock(mlock); - - if (update_references(&bo->refcount, src?&src->refcount:NULL)) - amdgpu_bo_free_internal(bo); - - pthread_mutex_unlock(mlock); - *dst = src; -} - #endif |