summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2018-11-21 11:24:59 -0800
committerRafael Antognolli <[email protected]>2019-01-17 15:07:43 -0800
commite8b6e0a5ba888d2b5d188cf06d962b6d8bc35332 (patch)
tree5ef31b4bb1813bbb4891a4013607a444bbef8a7a /src/intel
parent6a2d5ae305ad34bd26d033b7b564d21004147666 (diff)
anv/allocator: Add getter for anv_block_pool.
We will need the anv_block_pool_map to find the map relative to some BO that is not at the start of the block pool. v2: just return a pointer instead of a struct (Jason) v4: Update comment (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_allocator.c14
-rw-r--r--src/intel/vulkan/anv_batch_chain.c4
-rw-r--r--src/intel/vulkan/anv_private.h1
-rw-r--r--src/intel/vulkan/genX_blorp_exec.c4
4 files changed, 18 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 04ef05f5fae..e4b8dd56811 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -652,6 +652,18 @@ anv_block_pool_expand_range(struct anv_block_pool *pool,
return VK_SUCCESS;
}
+/** Returns current memory map of the block pool.
+ *
+ * The returned pointer points to the map for the memory at the specified
+ * offset. The offset parameter is relative to the "center" of the block pool
+ * rather than the start of the block pool BO map.
+ */
+void*
+anv_block_pool_map(struct anv_block_pool *pool, int32_t offset)
+{
+ return pool->map + offset;
+}
+
/** Grows and re-centers the block pool.
*
* We grow the block pool in one or both directions in such a way that the
@@ -1021,7 +1033,7 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool,
pool->block_size);
done:
- state.map = pool->block_pool.map + state.offset;
+ state.map = anv_block_pool_map(&pool->block_pool, state.offset);
return state;
}
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index a41305bc6d1..c5f05e5a256 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -678,8 +678,8 @@ anv_cmd_buffer_alloc_binding_table(struct anv_cmd_buffer *cmd_buffer,
return (struct anv_state) { 0 };
state.offset = cmd_buffer->bt_next;
- state.map = anv_binding_table_pool(device)->block_pool.map +
- bt_block->offset + state.offset;
+ state.map = anv_block_pool_map(&anv_binding_table_pool(device)->block_pool,
+ bt_block->offset + state.offset);
cmd_buffer->bt_next += state.alloc_size;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index d88cb54aaf7..129dd141d61 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -771,6 +771,7 @@ int32_t anv_block_pool_alloc(struct anv_block_pool *pool,
uint32_t block_size);
int32_t anv_block_pool_alloc_back(struct anv_block_pool *pool,
uint32_t block_size);
+void* anv_block_pool_map(struct anv_block_pool *pool, int32_t offset);
VkResult anv_state_pool_init(struct anv_state_pool *pool,
struct anv_device *device,
diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c
index f5e9e424eb9..1782125ab5d 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -63,8 +63,8 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
- void *dest = cmd_buffer->device->surface_state_pool.block_pool.map +
- ss_offset;
+ void *dest = anv_block_pool_map(
+ &cmd_buffer->device->surface_state_pool.block_pool, ss_offset);
uint64_t val = ((struct anv_bo*)address.buffer)->offset + address.offset +
delta;
write_reloc(cmd_buffer->device, dest, val, false);