anv: Drop anv_cmd_buffer::pool

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
This commit is contained in:
Jason Ekstrand
2022-02-07 15:22:54 -06:00
committed by Marge Bot
parent 2170ec2845
commit 5a15c3eff7
8 changed files with 39 additions and 36 deletions

View File

@@ -349,7 +349,7 @@ anv_batch_bo_create(struct anv_cmd_buffer *cmd_buffer,
{ {
VkResult result; VkResult result;
struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->pool->vk.alloc, sizeof(*bbo), struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->vk.pool->alloc, sizeof(*bbo),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (bbo == NULL) if (bbo == NULL)
return vk_error(cmd_buffer, VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(cmd_buffer, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -359,7 +359,7 @@ anv_batch_bo_create(struct anv_cmd_buffer *cmd_buffer,
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail_alloc; goto fail_alloc;
result = anv_reloc_list_init(&bbo->relocs, &cmd_buffer->pool->vk.alloc); result = anv_reloc_list_init(&bbo->relocs, &cmd_buffer->vk.pool->alloc);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail_bo_alloc; goto fail_bo_alloc;
@@ -370,7 +370,7 @@ anv_batch_bo_create(struct anv_cmd_buffer *cmd_buffer,
fail_bo_alloc: fail_bo_alloc:
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo); anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo);
fail_alloc: fail_alloc:
vk_free(&cmd_buffer->pool->vk.alloc, bbo); vk_free(&cmd_buffer->vk.pool->alloc, bbo);
return result; return result;
} }
@@ -382,7 +382,7 @@ anv_batch_bo_clone(struct anv_cmd_buffer *cmd_buffer,
{ {
VkResult result; VkResult result;
struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->pool->vk.alloc, sizeof(*bbo), struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->vk.pool->alloc, sizeof(*bbo),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (bbo == NULL) if (bbo == NULL)
return vk_error(cmd_buffer, VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(cmd_buffer, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -392,7 +392,7 @@ anv_batch_bo_clone(struct anv_cmd_buffer *cmd_buffer,
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail_alloc; goto fail_alloc;
result = anv_reloc_list_init_clone(&bbo->relocs, &cmd_buffer->pool->vk.alloc, result = anv_reloc_list_init_clone(&bbo->relocs, &cmd_buffer->vk.pool->alloc,
&other_bbo->relocs); &other_bbo->relocs);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail_bo_alloc; goto fail_bo_alloc;
@@ -406,7 +406,7 @@ anv_batch_bo_clone(struct anv_cmd_buffer *cmd_buffer,
fail_bo_alloc: fail_bo_alloc:
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo); anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo);
fail_alloc: fail_alloc:
vk_free(&cmd_buffer->pool->vk.alloc, bbo); vk_free(&cmd_buffer->vk.pool->alloc, bbo);
return result; return result;
} }
@@ -508,9 +508,9 @@ static void
anv_batch_bo_destroy(struct anv_batch_bo *bbo, anv_batch_bo_destroy(struct anv_batch_bo *bbo,
struct anv_cmd_buffer *cmd_buffer) struct anv_cmd_buffer *cmd_buffer)
{ {
anv_reloc_list_finish(&bbo->relocs, &cmd_buffer->pool->vk.alloc); anv_reloc_list_finish(&bbo->relocs, &cmd_buffer->vk.pool->alloc);
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo); anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, bbo->bo);
vk_free(&cmd_buffer->pool->vk.alloc, bbo); vk_free(&cmd_buffer->vk.pool->alloc, bbo);
} }
static VkResult static VkResult
@@ -639,7 +639,7 @@ anv_cmd_buffer_record_chain_submit(struct anv_cmd_buffer *cmd_buffer_from,
.start = last_bbo->bo->map, .start = last_bbo->bo->map,
.end = last_bbo->bo->map + last_bbo->bo->size, .end = last_bbo->bo->map + last_bbo->bo->size,
.relocs = &last_bbo->relocs, .relocs = &last_bbo->relocs,
.alloc = &cmd_buffer_from->pool->vk.alloc, .alloc = &cmd_buffer_from->vk.pool->alloc,
}; };
__anv_cmd_pack(GFX8_MI_BATCH_BUFFER_START)(&local_batch, bb_start, &gen_bb_start); __anv_cmd_pack(GFX8_MI_BATCH_BUFFER_START)(&local_batch, bb_start, &gen_bb_start);
@@ -852,7 +852,7 @@ anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer)
list_addtail(&batch_bo->link, &cmd_buffer->batch_bos); list_addtail(&batch_bo->link, &cmd_buffer->batch_bos);
cmd_buffer->batch.alloc = &cmd_buffer->pool->vk.alloc; cmd_buffer->batch.alloc = &cmd_buffer->vk.pool->alloc;
cmd_buffer->batch.user_data = cmd_buffer; cmd_buffer->batch.user_data = cmd_buffer;
if (cmd_buffer->device->can_chain_batches) { if (cmd_buffer->device->can_chain_batches) {
@@ -877,7 +877,7 @@ anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer)
goto fail_seen_bbos; goto fail_seen_bbos;
result = anv_reloc_list_init(&cmd_buffer->surface_relocs, result = anv_reloc_list_init(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc); &cmd_buffer->vk.pool->alloc);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail_bt_blocks; goto fail_bt_blocks;
cmd_buffer->last_ss_pool_center = 0; cmd_buffer->last_ss_pool_center = 0;
@@ -906,7 +906,7 @@ anv_cmd_buffer_fini_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer)
anv_binding_table_pool_free(cmd_buffer->device, *bt_block); anv_binding_table_pool_free(cmd_buffer->device, *bt_block);
u_vector_finish(&cmd_buffer->bt_block_states); u_vector_finish(&cmd_buffer->bt_block_states);
anv_reloc_list_finish(&cmd_buffer->surface_relocs, &cmd_buffer->pool->vk.alloc); anv_reloc_list_finish(&cmd_buffer->surface_relocs, &cmd_buffer->vk.pool->alloc);
u_vector_finish(&cmd_buffer->seen_bbos); u_vector_finish(&cmd_buffer->seen_bbos);
@@ -1167,7 +1167,7 @@ anv_cmd_buffer_add_secondary(struct anv_cmd_buffer *primary,
assert(!"Invalid execution mode"); assert(!"Invalid execution mode");
} }
anv_reloc_list_append(&primary->surface_relocs, &primary->pool->vk.alloc, anv_reloc_list_append(&primary->surface_relocs, &primary->vk.pool->alloc,
&secondary->surface_relocs, 0); &secondary->surface_relocs, 0);
} }

View File

@@ -137,8 +137,8 @@ static void
anv_blorp_batch_init(struct anv_cmd_buffer *cmd_buffer, anv_blorp_batch_init(struct anv_cmd_buffer *cmd_buffer,
struct blorp_batch *batch, enum blorp_batch_flags flags) struct blorp_batch *batch, enum blorp_batch_flags flags)
{ {
if (!(cmd_buffer->pool->queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT)) { if (!(cmd_buffer->queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT)) {
assert(cmd_buffer->pool->queue_family->queueFlags & VK_QUEUE_COMPUTE_BIT); assert(cmd_buffer->queue_family->queueFlags & VK_QUEUE_COMPUTE_BIT);
flags |= BLORP_BATCH_USE_COMPUTE; flags |= BLORP_BATCH_USE_COMPUTE;
} }

View File

@@ -238,7 +238,7 @@ anv_cmd_pipeline_state_finish(struct anv_cmd_buffer *cmd_buffer,
if (pipe_state->push_descriptors[i]) { if (pipe_state->push_descriptors[i]) {
anv_descriptor_set_layout_unref(cmd_buffer->device, anv_descriptor_set_layout_unref(cmd_buffer->device,
pipe_state->push_descriptors[i]->set.layout); pipe_state->push_descriptors[i]->set.layout);
vk_free(&cmd_buffer->pool->vk.alloc, pipe_state->push_descriptors[i]); vk_free(&cmd_buffer->vk.pool->alloc, pipe_state->push_descriptors[i]);
} }
} }
} }
@@ -251,7 +251,7 @@ anv_cmd_state_finish(struct anv_cmd_buffer *cmd_buffer)
anv_cmd_pipeline_state_finish(cmd_buffer, &state->gfx.base); anv_cmd_pipeline_state_finish(cmd_buffer, &state->gfx.base);
anv_cmd_pipeline_state_finish(cmd_buffer, &state->compute.base); anv_cmd_pipeline_state_finish(cmd_buffer, &state->compute.base);
vk_free(&cmd_buffer->pool->vk.alloc, state->attachments); vk_free(&cmd_buffer->vk.pool->alloc, state->attachments);
} }
static void static void
@@ -282,7 +282,10 @@ static VkResult anv_create_cmd_buffer(
cmd_buffer->batch.status = VK_SUCCESS; cmd_buffer->batch.status = VK_SUCCESS;
cmd_buffer->device = device; cmd_buffer->device = device;
cmd_buffer->pool = pool;
assert(pool->vk.queue_family_index < device->physical->queue.family_count);
cmd_buffer->queue_family =
&device->physical->queue.families[pool->vk.queue_family_index];
result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer); result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
@@ -362,10 +365,10 @@ anv_cmd_buffer_destroy(struct anv_cmd_buffer *cmd_buffer)
anv_cmd_state_finish(cmd_buffer); anv_cmd_state_finish(cmd_buffer);
vk_free(&cmd_buffer->pool->vk.alloc, cmd_buffer->self_mod_locations); vk_free(&cmd_buffer->vk.pool->alloc, cmd_buffer->self_mod_locations);
vk_command_buffer_finish(&cmd_buffer->vk); vk_command_buffer_finish(&cmd_buffer->vk);
vk_free(&cmd_buffer->pool->vk.alloc, cmd_buffer); vk_free(&cmd_buffer->vk.pool->alloc, cmd_buffer);
} }
void anv_FreeCommandBuffers( void anv_FreeCommandBuffers(
@@ -1527,7 +1530,7 @@ anv_cmd_buffer_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
&pipe_state->push_descriptors[_set]; &pipe_state->push_descriptors[_set];
if (*push_set == NULL) { if (*push_set == NULL) {
*push_set = vk_zalloc(&cmd_buffer->pool->vk.alloc, *push_set = vk_zalloc(&cmd_buffer->vk.pool->alloc,
sizeof(struct anv_push_descriptor_set), 8, sizeof(struct anv_push_descriptor_set), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (*push_set == NULL) { if (*push_set == NULL) {

View File

@@ -108,7 +108,7 @@ anv_measure_init(struct anv_cmd_buffer *cmd_buffer)
const size_t batch_bytes = sizeof(struct anv_measure_batch) + const size_t batch_bytes = sizeof(struct anv_measure_batch) +
config->batch_size * sizeof(struct intel_measure_snapshot); config->batch_size * sizeof(struct intel_measure_snapshot);
struct anv_measure_batch * measure = struct anv_measure_batch * measure =
vk_alloc(&cmd_buffer->pool->vk.alloc, vk_alloc(&cmd_buffer->vk.pool->alloc,
batch_bytes, 8, batch_bytes, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@@ -363,7 +363,7 @@ anv_measure_destroy(struct anv_cmd_buffer *cmd_buffer)
intel_measure_gather(&physical->measure_device, &physical->info); intel_measure_gather(&physical->measure_device, &physical->info);
anv_device_release_bo(device, measure->bo); anv_device_release_bo(device, measure->bo);
vk_free(&cmd_buffer->pool->vk.alloc, measure); vk_free(&cmd_buffer->vk.pool->alloc, measure);
cmd_buffer->measure = NULL; cmd_buffer->measure = NULL;
} }

View File

@@ -3154,7 +3154,7 @@ struct anv_cmd_buffer {
struct anv_device * device; struct anv_device * device;
struct anv_cmd_pool * pool; struct anv_queue_family * queue_family;
struct list_head pool_link; struct list_head pool_link;
struct anv_batch batch; struct anv_batch batch;

View File

@@ -86,7 +86,7 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
if (ANV_ALWAYS_SOFTPIN) { if (ANV_ALWAYS_SOFTPIN) {
result = anv_reloc_list_add_bo(&cmd_buffer->surface_relocs, result = anv_reloc_list_add_bo(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
address.buffer); address.buffer);
if (unlikely(result != VK_SUCCESS)) if (unlikely(result != VK_SUCCESS))
anv_batch_set_error(&cmd_buffer->batch, result); anv_batch_set_error(&cmd_buffer->batch, result);
@@ -95,7 +95,7 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
uint64_t address_u64 = 0; uint64_t address_u64 = 0;
result = anv_reloc_list_add(&cmd_buffer->surface_relocs, result = anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
ss_offset, address.buffer, ss_offset, address.buffer,
address.offset + delta, address.offset + delta,
&address_u64); &address_u64);
@@ -272,7 +272,7 @@ blorp_exec_on_render(struct blorp_batch *batch,
assert((batch->flags & BLORP_BATCH_USE_COMPUTE) == 0); assert((batch->flags & BLORP_BATCH_USE_COMPUTE) == 0);
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
assert(cmd_buffer->pool->queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT); assert(cmd_buffer->queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT);
const unsigned scale = params->fast_clear_op ? UINT_MAX : 1; const unsigned scale = params->fast_clear_op ? UINT_MAX : 1;
genX(cmd_buffer_emit_hashing_mode)(cmd_buffer, params->x1 - params->x0, genX(cmd_buffer_emit_hashing_mode)(cmd_buffer, params->x1 - params->x0,
@@ -356,7 +356,7 @@ blorp_exec_on_compute(struct blorp_batch *batch,
assert(batch->flags & BLORP_BATCH_USE_COMPUTE); assert(batch->flags & BLORP_BATCH_USE_COMPUTE);
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
assert(cmd_buffer->pool->queue_family->queueFlags & VK_QUEUE_COMPUTE_BIT); assert(cmd_buffer->queue_family->queueFlags & VK_QUEUE_COMPUTE_BIT);
genX(flush_pipeline_select_gpgpu)(cmd_buffer); genX(flush_pipeline_select_gpgpu)(cmd_buffer);

View File

@@ -87,7 +87,7 @@ convert_pc_to_bits(struct GENX(PIPE_CONTROL) *pc) {
static bool static bool
is_render_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer) is_render_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer)
{ {
struct anv_queue_family *queue_family = cmd_buffer->pool->queue_family; struct anv_queue_family *queue_family = cmd_buffer->queue_family;
return (queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0; return (queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0;
} }
@@ -295,12 +295,12 @@ add_surface_reloc(struct anv_cmd_buffer *cmd_buffer,
if (anv_use_relocations(cmd_buffer->device->physical)) { if (anv_use_relocations(cmd_buffer->device->physical)) {
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev; const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
result = anv_reloc_list_add(&cmd_buffer->surface_relocs, result = anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
state.offset + isl_dev->ss.addr_offset, state.offset + isl_dev->ss.addr_offset,
addr.bo, addr.offset, NULL); addr.bo, addr.offset, NULL);
} else { } else {
result = anv_reloc_list_add_bo(&cmd_buffer->surface_relocs, result = anv_reloc_list_add_bo(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
addr.bo); addr.bo);
} }
@@ -320,7 +320,7 @@ add_surface_state_relocs(struct anv_cmd_buffer *cmd_buffer,
if (!anv_address_is_null(state.aux_address)) { if (!anv_address_is_null(state.aux_address)) {
VkResult result = VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
state.state.offset + isl_dev->ss.aux_addr_offset, state.state.offset + isl_dev->ss.aux_addr_offset,
state.aux_address.bo, state.aux_address.bo,
state.aux_address.offset, state.aux_address.offset,
@@ -332,7 +332,7 @@ add_surface_state_relocs(struct anv_cmd_buffer *cmd_buffer,
if (!anv_address_is_null(state.clear_address)) { if (!anv_address_is_null(state.clear_address)) {
VkResult result = VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->vk.alloc, &cmd_buffer->vk.pool->alloc,
state.state.offset + state.state.offset +
isl_dev->ss.clear_color_state_offset, isl_dev->ss.clear_color_state_offset,
state.clear_address.bo, state.clear_address.bo,
@@ -1544,10 +1544,10 @@ cmd_buffer_alloc_state_attachments(struct anv_cmd_buffer *cmd_buffer,
{ {
struct anv_cmd_state *state = &cmd_buffer->state; struct anv_cmd_state *state = &cmd_buffer->state;
vk_free(&cmd_buffer->pool->vk.alloc, state->attachments); vk_free(&cmd_buffer->vk.pool->alloc, state->attachments);
if (attachment_count > 0) { if (attachment_count > 0) {
state->attachments = vk_zalloc(&cmd_buffer->pool->vk.alloc, state->attachments = vk_zalloc(&cmd_buffer->vk.pool->alloc,
attachment_count * attachment_count *
sizeof(state->attachments[0]), sizeof(state->attachments[0]),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);

View File

@@ -335,7 +335,7 @@ khr_perf_query_ensure_relocs(struct anv_cmd_buffer *cmd_buffer)
const struct anv_physical_device *pdevice = device->physical; const struct anv_physical_device *pdevice = device->physical;
cmd_buffer->self_mod_locations = cmd_buffer->self_mod_locations =
vk_alloc(&cmd_buffer->pool->vk.alloc, vk_alloc(&cmd_buffer->vk.pool->alloc,
pdevice->n_perf_query_commands * sizeof(*cmd_buffer->self_mod_locations), 8, pdevice->n_perf_query_commands * sizeof(*cmd_buffer->self_mod_locations), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);