aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_allocator.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-10-25 14:51:19 -0500
committerJason Ekstrand <[email protected]>2019-10-31 13:46:08 +0000
commit5534358ef6189fe1169ad181ac4578d41bec6835 (patch)
tree0b5d5d73b168767d10c07efde1fd1fb2c167bf71 /src/intel/vulkan/anv_allocator.c
parentc0a4722f292dd437e8a6fa21ef9befb6281bec00 (diff)
anv: Inline anv_block_pool_get_bo
It has exactly one caller and we're about to change some of the dynamics which would make this confusing as a separate function. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_allocator.c')
-rw-r--r--src/intel/vulkan/anv_allocator.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index aedc5543a6b..53f4c446cb6 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -636,31 +636,6 @@ anv_block_pool_expand_range(struct anv_block_pool *pool,
return VK_SUCCESS;
}
-static struct anv_bo *
-anv_block_pool_get_bo(struct anv_block_pool *pool, int32_t *offset)
-{
- struct anv_bo *bo_found = NULL;
- int32_t cur_offset = 0;
-
- assert(offset);
-
- if (!(pool->bo_flags & EXEC_OBJECT_PINNED))
- return pool->bo;
-
- anv_block_pool_foreach_bo(bo, pool) {
- if (*offset < cur_offset + bo->size) {
- bo_found = bo;
- break;
- }
- cur_offset += bo->size;
- }
-
- assert(bo_found != NULL);
- *offset -= cur_offset;
-
- return bo_found;
-}
-
/** Returns current memory map of the block pool.
*
* The returned pointer points to the map for the memory at the specified
@@ -671,8 +646,19 @@ void*
anv_block_pool_map(struct anv_block_pool *pool, int32_t offset)
{
if (pool->bo_flags & EXEC_OBJECT_PINNED) {
- struct anv_bo *bo = anv_block_pool_get_bo(pool, &offset);
- return bo->map + offset;
+ struct anv_bo *bo = NULL;
+ int32_t bo_offset = 0;
+ anv_block_pool_foreach_bo(iter_bo, pool) {
+ if (offset < bo_offset + iter_bo->size) {
+ bo = iter_bo;
+ break;
+ }
+ bo_offset += iter_bo->size;
+ }
+ assert(bo != NULL);
+ assert(offset >= bo_offset);
+
+ return bo->map + (offset - bo_offset);
} else {
return pool->map + offset;
}