mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 09:10:12 +01:00
anv: Make a helper function for pinning a state pool's BOs
A bit less duplicated code, though with all the success checking, it doesn't actually save us a whole lot. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18208>
This commit is contained in:
parent
fde5c903c0
commit
02fed5bb32
1 changed files with 29 additions and 31 deletions
|
|
@ -1343,6 +1343,20 @@ chain_command_buffers(struct anv_cmd_buffer **cmd_buffers,
|
|||
anv_cmd_buffer_record_end_submit(cmd_buffers[num_cmd_buffers - 1]);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
pin_state_pool(struct anv_device *device,
|
||||
struct anv_execbuf *execbuf,
|
||||
struct anv_state_pool *pool)
|
||||
{
|
||||
anv_block_pool_foreach_bo(bo, &pool->block_pool) {
|
||||
VkResult result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
|
||||
struct anv_queue *queue,
|
||||
|
|
@ -1365,41 +1379,25 @@ setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
|
|||
}
|
||||
|
||||
/* Add all the global BOs to the object list for softpin case. */
|
||||
struct anv_block_pool *pool;
|
||||
pool = &device->surface_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
result = pin_state_pool(device, execbuf, &device->surface_state_pool);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
pool = &device->dynamic_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
result = pin_state_pool(device, execbuf, &device->dynamic_state_pool);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
pool = &device->general_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
result = pin_state_pool(device, execbuf, &device->general_state_pool);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
pool = &device->instruction_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
result = pin_state_pool(device, execbuf, &device->instruction_state_pool);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
pool = &device->binding_table_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(device, execbuf, bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
result = pin_state_pool(device, execbuf, &device->binding_table_pool);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
/* Add the BOs for all user allocated memory objects because we can't
|
||||
* track after binding updates of VK_EXT_descriptor_indexing.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue