diff options
author | Nicolai Hähnle <[email protected]> | 2017-02-07 17:58:39 +0100 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-04-05 10:37:18 +0200 |
commit | 0baee15596d51df5fe0f0edd4b48bd500c26e2cd (patch) | |
tree | 6e43b0082c18e466636b4a51e8c8ea1546655656 /src/gallium/winsys/amdgpu | |
parent | 79dae12b416d3544da6d7b3eb8d43d4a934f93ce (diff) |
winsys/amdgpu: take fences when freeing a backing buffer
We never add fences to backing buffers during submit. When we free a
backing buffer, it must inherit the sparse buffer's fences, so that it
doesn't get re-used prematurely via the cache.
v2:
- remove pipe_mutex_*
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys/amdgpu')
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 517bf532618..dd0603ad3ae 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -667,10 +667,17 @@ sparse_backing_alloc(struct amdgpu_winsys_bo *bo, uint32_t *pstart_page, uint32_ } static void -sparse_free_backing_buffer(struct amdgpu_sparse_backing *backing) +sparse_free_backing_buffer(struct amdgpu_winsys_bo *bo, + struct amdgpu_sparse_backing *backing) { + struct amdgpu_winsys *ws = backing->bo->ws; + bo->u.sparse.num_backing_pages -= backing->bo->base.size / RADEON_SPARSE_PAGE_SIZE; + mtx_lock(&ws->bo_fence_lock); + amdgpu_add_fences(backing->bo, bo->num_fences, bo->fences); + mtx_unlock(&ws->bo_fence_lock); + list_del(&backing->list); amdgpu_winsys_bo_reference(&backing->bo, NULL); FREE(backing->chunks); @@ -737,7 +744,7 @@ sparse_backing_free(struct amdgpu_winsys_bo *bo, if (backing->num_chunks == 1 && backing->chunks[0].begin == 0 && backing->chunks[0].end == backing->bo->base.size / RADEON_SPARSE_PAGE_SIZE) - sparse_free_backing_buffer(backing); + sparse_free_backing_buffer(bo, backing); return true; } @@ -758,7 +765,8 @@ static void amdgpu_bo_sparse_destroy(struct pb_buffer *_buf) while (!list_empty(&bo->u.sparse.backing)) { struct amdgpu_sparse_backing *dummy = NULL; - sparse_free_backing_buffer(container_of(bo->u.sparse.backing.next, + sparse_free_backing_buffer(bo, + container_of(bo->u.sparse.backing.next, dummy, list)); } |