diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-03-07 21:22:46 -0800 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-03-07 22:23:44 -0800 |
commit | 3d4f2b0927acaac05e87ed07ae492e39b4c82ff7 (patch) | |
tree | 2ee10aee2824443127ba4319fa838772a6f87748 /src/intel/vulkan/anv_allocator.c | |
parent | 8c2b9d152941f49d956bb2775a48158d1d10253b (diff) | |
download | external_mesa3d-3d4f2b0927acaac05e87ed07ae492e39b4c82ff7.zip external_mesa3d-3d4f2b0927acaac05e87ed07ae492e39b4c82ff7.tar.gz external_mesa3d-3d4f2b0927acaac05e87ed07ae492e39b4c82ff7.tar.bz2 |
anv/allocator: Move the alignment assert for the pointer free list
Previously we asserted every time you tried to pack a pointer and a counter
together. However, this wasn't really correct. In the case where you try
to grab the last element of the list, the "next elemnet" value you get may
be bogus if someonoe else got there first. This was leading to assertion
failures even though the allocator would safely fall through to the failure
case below.
Diffstat (limited to 'src/intel/vulkan/anv_allocator.c')
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index d7c0910..385c63f 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -200,7 +200,6 @@ anv_free_list_push(union anv_free_list *list, void *map, int32_t offset) #define PFL_COUNT(x) ((uintptr_t)(x) & 0xfff) #define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~0xfff)) #define PFL_PACK(ptr, count) ({ \ - assert(((uintptr_t)(ptr) & 0xfff) == 0); \ (void *)((uintptr_t)(ptr) | (uintptr_t)((count) & 0xfff)); \ }) @@ -230,6 +229,12 @@ anv_ptr_free_list_push(void **list, void *elem) void *old, *current; void **next_ptr = elem; + /* The pointer-based free list requires that the pointer be + * page-aligned. This is because we use the bottom 12 bits of the + * pointer to store a counter to solve the ABA concurrency problem. + */ + assert(((uintptr_t)elem & 0xfff) == 0); + old = *list; do { current = old; |