[Mesa-stable] [PATCH] anv/allocator: Correctly set the number of buckets

Jason Ekstrand jason at jlekstrand.net
Sat Aug 27 02:34:16 UTC 2016


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..

Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Cc: Kristian Høgsberg <krh at bitplanet.net>
---
 src/intel/vulkan/anv_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 491d695..16f20ac 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -402,7 +402,7 @@ struct anv_fixed_size_state_pool {
 #define ANV_MIN_STATE_SIZE_LOG2 6
 #define ANV_MAX_STATE_SIZE_LOG2 16
 
-#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;
-- 
2.5.0.400.gff86faf



More information about the mesa-stable mailing list