summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-04-26 03:28:52 -0700
committerJason Ekstrand <[email protected]>2017-05-04 19:07:54 -0700
commit45e1829274f9d23d58c9b73188d9413f9e36a751 (patch)
tree58c51b2177922d4d4fb629410a22367ebb3d6b95
parenta096d8d3f7a8c6dffc91b2ac1794fdd215c054d3 (diff)
anv/allocator: Add no-valgrind versions of state_pool_alloc/free
Reviewed-by: Juan A. Suarez Romero <[email protected]>
-rw-r--r--src/intel/vulkan/anv_allocator.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 6ab2da5d64a..4cd80590c70 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -689,8 +689,9 @@ anv_state_pool_finish(struct anv_state_pool *pool)
VG(VALGRIND_DESTROY_MEMPOOL(pool));
}
-struct anv_state
-anv_state_pool_alloc(struct anv_state_pool *pool, size_t size, size_t align)
+static struct anv_state
+anv_state_pool_alloc_no_vg(struct anv_state_pool *pool,
+ size_t size, size_t align)
{
unsigned size_log2 = ilog2_round_up(size < align ? align : size);
assert(size_log2 <= ANV_MAX_STATE_SIZE_LOG2);
@@ -703,12 +704,19 @@ anv_state_pool_alloc(struct anv_state_pool *pool, size_t size, size_t align)
state.offset = anv_fixed_size_state_pool_alloc(&pool->buckets[bucket],
pool->block_pool);
state.map = pool->block_pool->map + state.offset;
+ return state;
+}
+
+struct anv_state
+anv_state_pool_alloc(struct anv_state_pool *pool, size_t size, size_t align)
+{
+ struct anv_state state = anv_state_pool_alloc_no_vg(pool, size, align);
VG(VALGRIND_MEMPOOL_ALLOC(pool, state.map, size));
return state;
}
-void
-anv_state_pool_free(struct anv_state_pool *pool, struct anv_state state)
+static void
+anv_state_pool_free_no_vg(struct anv_state_pool *pool, struct anv_state state)
{
assert(util_is_power_of_two(state.alloc_size));
unsigned size_log2 = ilog2_round_up(state.alloc_size);
@@ -716,11 +724,17 @@ anv_state_pool_free(struct anv_state_pool *pool, struct anv_state state)
size_log2 <= ANV_MAX_STATE_SIZE_LOG2);
unsigned bucket = size_log2 - ANV_MIN_STATE_SIZE_LOG2;
- VG(VALGRIND_MEMPOOL_FREE(pool, state.map));
anv_fixed_size_state_pool_free(&pool->buckets[bucket],
pool->block_pool, state.offset);
}
+void
+anv_state_pool_free(struct anv_state_pool *pool, struct anv_state state)
+{
+ VG(VALGRIND_MEMPOOL_FREE(pool, state.map));
+ anv_state_pool_free_no_vg(pool, state);
+}
+
#define NULL_BLOCK 1
struct anv_state_stream_block {
/* The next block */