anv/allocator: Correctly set the number of buckets
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 27 Aug 2016 02:31:05 +0000 (19:31 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 30 Aug 2016 22:08:23 +0000 (15:08 -0700)
The range from ANV_MIN_STATE_SIZE_LOG2 to ANV_MAX_STATE_SIZE_LOG2 should
be inclusive and we have asserts that ensure that you never try to allocate
a state larger than (1 << ANV_MAX_STATE_SIZE_LOG2).  However, without
adding 1 to the difference, we allocate 1 too few bucckts and so, even
though we have an assert, anything landing in the last bucket will fail to
allocate properly..

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_private.h

index f03dba04a2afa29ef80079bd6ec176540980f11c..f7f1ff23b61a4d252dcd2b32984508377f5f8cd3 100644 (file)
@@ -402,7 +402,7 @@ struct anv_fixed_size_state_pool {
 #define ANV_MIN_STATE_SIZE_LOG2 6
 #define ANV_MAX_STATE_SIZE_LOG2 10
 
-#define ANV_STATE_BUCKETS (ANV_MAX_STATE_SIZE_LOG2 - ANV_MIN_STATE_SIZE_LOG2)
+#define ANV_STATE_BUCKETS (ANV_MAX_STATE_SIZE_LOG2 - ANV_MIN_STATE_SIZE_LOG2 + 1)
 
 struct anv_state_pool {
    struct anv_block_pool *block_pool;