aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonk Liu2017-08-08 11:09:07 -0500
committerAlex Deucher2017-08-08 11:16:20 -0500
commit687d250797ff0028fee949cdd66c9f012f69992d (patch)
treea200b5b5a360d4a7a2a686206055fa8d539e0c80 /amdgpu/amdgpu_internal.h
parent2a89ae5d7a7d5845226ed85146140ff4c8788d59 (diff)
downloadexternal-libdrm-687d250797ff0028fee949cdd66c9f012f69992d.tar.gz
external-libdrm-687d250797ff0028fee949cdd66c9f012f69992d.tar.xz
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.h33
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 {
143 * Functions. 143 * Functions.
144 */ 144 */
145 145
146drm_private void amdgpu_bo_free_internal(amdgpu_bo_handle bo);
147
148drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, 146drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start,
149 uint64_t max, uint64_t alignment); 147 uint64_t max, uint64_t alignment);
150 148
@@ -189,35 +187,4 @@ static inline bool update_references(atomic_t *dst, atomic_t *src)
189 return false; 187 return false;
190} 188}
191 189
192/**
193 * Assignment between two amdgpu_bo pointers with reference counting.
194 *
195 * Usage:
196 * struct amdgpu_bo *dst = ... , *src = ...;
197 *
198 * dst = src;
199 * // No reference counting. Only use this when you need to move
200 * // a reference from one pointer to another.
201 *
202 * amdgpu_bo_reference(&dst, src);
203 * // Reference counters are updated. dst is decremented and src is
204 * // incremented. dst is freed if its reference counter is 0.
205 */
206static inline void amdgpu_bo_reference(struct amdgpu_bo **dst,
207 struct amdgpu_bo *src)
208{
209 pthread_mutex_t *mlock;
210 struct amdgpu_bo* bo = *dst;
211
212 assert(bo != NULL);
213 mlock = &bo->dev->bo_table_mutex;
214 pthread_mutex_lock(mlock);
215
216 if (update_references(&bo->refcount, src?&src->refcount:NULL))
217 amdgpu_bo_free_internal(bo);
218
219 pthread_mutex_unlock(mlock);
220 *dst = src;
221}
222
223#endif 190#endif