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
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;
}
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;
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,
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);