mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
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 <jason@jlekstrand.net>
This commit is contained in:
parent
6a2d5ae305
commit
e8b6e0a5ba
4 changed files with 18 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue