diff options
author | Jason Ekstrand <[email protected]> | 2015-08-03 01:19:34 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-03 01:19:34 -0700 |
commit | facf587deac3375e42338aa304d77b34a527b26e (patch) | |
tree | 38c27a4ddd2493c14cfbad5c2443c6c1cd0848aa /src/vulkan/anv_private.h | |
parent | 5e5a783530aba5c65e9d08683c905fb4cfd329c5 (diff) |
vk/allocator: Solve a data race in anv_block_pool
The anv_block_pool data structure suffered from the exact same race as the
state pool. Namely, that the uniqueness of the blocks handed out depends
on the next_block value increasing monotonically. However, this invariant
did not hold thanks to our block "return" concept.
Diffstat (limited to 'src/vulkan/anv_private.h')
-rw-r--r-- | src/vulkan/anv_private.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index b30dd7d51ad..f14a6ca858f 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -233,13 +233,22 @@ union anv_free_list { #define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { 1, 0 } }) +struct anv_block_state { + union { + struct { + uint32_t next; + uint32_t end; + }; + uint64_t u64; + }; +}; + struct anv_block_pool { struct anv_device *device; struct anv_bo bo; void *map; int fd; - uint32_t size; /** * Array of mmaps and gem handles owned by the block pool, reclaimed when @@ -249,26 +258,16 @@ struct anv_block_pool { uint32_t block_size; - uint32_t next_block; union anv_free_list free_list; + struct anv_block_state state; }; static inline uint32_t anv_block_pool_size(struct anv_block_pool *pool) { - return pool->size; + return pool->state.end; } -struct anv_block_state { - union { - struct { - uint32_t next; - uint32_t end; - }; - uint64_t u64; - }; -}; - struct anv_state { uint32_t offset; uint32_t alloc_size; |