diff options
author | Jason Ekstrand <[email protected]> | 2016-03-07 14:56:58 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-03-07 22:23:44 -0800 |
commit | 8c2b9d152941f49d956bb2775a48158d1d10253b (patch) | |
tree | 89bf895d41236ad91303dfa78af7340b8167cefb /src/intel/vulkan | |
parent | 181b142fbd176f24a73cabf209000a9187f275e8 (diff) |
anv/bo_pool: Allow freeing BOs where the anv_bo is in the BO itself
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 3b62bda3e93..d7c09103344 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -853,11 +853,13 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo) } void -anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo) +anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo_in) { - struct bo_pool_bo_link *link = bo->map; - link->bo = *bo; + /* Make a copy in case the anv_bo happens to be storred in the BO */ + struct anv_bo bo = *bo_in; + struct bo_pool_bo_link *link = bo.map; + link->bo = bo; - VG(VALGRIND_MEMPOOL_FREE(pool, bo->map)); + VG(VALGRIND_MEMPOOL_FREE(pool, bo.map)); anv_ptr_free_list_push(&pool->free_list, link); } |