diff options
author | Jason Ekstrand <[email protected]> | 2017-04-23 18:25:17 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-04 19:07:54 -0700 |
commit | 367031a5c82b62ec3359dab862387e679093c9b7 (patch) | |
tree | 170eb0651d62cd4784aa2b26392673f53f5c9623 /src/intel/vulkan/anv_allocator.c | |
parent | e86aeecb6aa3cf5992bb87792c2219f49c905e05 (diff) |
anv: Get rid of a bunch of uses of size_t
We should only use size_t when referring to sizes of bits of CPU memory.
Anything on the GPU or just a regular array length should be a type that
has the same size on both 32 and 64-bit architectures. For state
objects, we use a uint32_t because we'll never allocate a piece of
driver-internal GPU state larger than 2GB (more like 16KB).
Reviewed-by: Juan A. Suarez Romero <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_allocator.c')
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index d332e895695..592ab1caa15 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -344,7 +344,7 @@ anv_block_pool_finish(struct anv_block_pool *pool) static uint32_t anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state) { - size_t size; + uint32_t size; void *map; uint32_t gem_handle; struct anv_mmap_cleanup *cleanup; @@ -369,7 +369,7 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state) assert(state == &pool->state || back_used > 0); - size_t old_size = pool->bo.size; + uint32_t old_size = pool->bo.size; if (old_size != 0 && back_used * 2 <= pool->center_bo_offset && @@ -618,7 +618,7 @@ anv_block_pool_free(struct anv_block_pool *pool, int32_t offset) static void anv_fixed_size_state_pool_init(struct anv_fixed_size_state_pool *pool, - size_t state_size) + uint32_t state_size) { /* At least a cache line and must divide the block size. */ assert(state_size >= 64 && util_is_power_of_two(state_size)); @@ -677,7 +677,7 @@ anv_state_pool_init(struct anv_state_pool *pool, { pool->block_pool = block_pool; for (unsigned i = 0; i < ANV_STATE_BUCKETS; i++) { - size_t size = 1 << (ANV_MIN_STATE_SIZE_LOG2 + i); + uint32_t size = 1 << (ANV_MIN_STATE_SIZE_LOG2 + i); anv_fixed_size_state_pool_init(&pool->buckets[i], size); } VG(VALGRIND_CREATE_MEMPOOL(pool, 0, false)); @@ -691,7 +691,7 @@ anv_state_pool_finish(struct anv_state_pool *pool) static struct anv_state anv_state_pool_alloc_no_vg(struct anv_state_pool *pool, - size_t size, size_t align) + uint32_t size, uint32_t align) { unsigned size_log2 = ilog2_round_up(size < align ? align : size); assert(size_log2 <= ANV_MAX_STATE_SIZE_LOG2); @@ -708,7 +708,7 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool, } struct anv_state -anv_state_pool_alloc(struct anv_state_pool *pool, size_t size, size_t align) +anv_state_pool_alloc(struct anv_state_pool *pool, uint32_t size, uint32_t align) { if (size == 0) return ANV_STATE_NULL; |