anv: fix companion command buffer initialization

Currently the command buffer is completely empty, which is not good.
There are a few of things that should be programmed, but we've
probably been okay due to the default engine initialization.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: edcde0679c ("anv: Add helper to create companion RCS command buffer")
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27979>
This commit is contained in:
Lionel Landwerlin
2024-03-05 02:45:07 -08:00
committed by Marge Bot
parent 67c9f94b05
commit 0de856ecef
3 changed files with 45 additions and 2 deletions

View File

@@ -104,8 +104,8 @@ anv_cmd_buffer_ensure_rcs_companion(struct anv_cmd_buffer *cmd_buffer)
cmd_buffer->companion_rcs_cmd_buffer =
container_of(tmp_cmd_buffer, struct anv_cmd_buffer, vk);
cmd_buffer->companion_rcs_cmd_buffer->vk.level = cmd_buffer->vk.level;
cmd_buffer->companion_rcs_cmd_buffer->is_companion_rcs_cmd_buffer = true;
anv_genX(cmd_buffer->device->info, cmd_buffer_begin_companion)(
cmd_buffer->companion_rcs_cmd_buffer, cmd_buffer->vk.level);
unlock_and_return:
pthread_mutex_unlock(&cmd_buffer->device->mutex);

View File

@@ -302,6 +302,10 @@ genX(emit_breakpoint)(struct anv_batch *batch,
genX(batch_emit_breakpoint)(batch, device, emit_before_draw);
}
void
genX(cmd_buffer_begin_companion)(struct anv_cmd_buffer *buffer,
VkCommandBufferLevel level);
struct anv_state
genX(cmd_buffer_begin_companion_rcs_syncpoint)(struct anv_cmd_buffer *cmd_buffer);

View File

@@ -2735,6 +2735,45 @@ genX(flush_descriptor_buffers)(struct anv_cmd_buffer *cmd_buffer,
cmd_buffer->state.descriptor_buffers.dirty = false;
}
void
genX(cmd_buffer_begin_companion)(struct anv_cmd_buffer *cmd_buffer,
VkCommandBufferLevel level)
{
cmd_buffer->vk.level = level;
cmd_buffer->is_companion_rcs_cmd_buffer = true;
trace_intel_begin_cmd_buffer(&cmd_buffer->trace);
#if GFX_VER >= 12
/* Reenable prefetching at the beginning of secondary command buffers. We
* do this so that the return instruction edition is not prefetched before
* completion.
*/
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) {
anv_batch_emit(&cmd_buffer->batch, GENX(MI_ARB_CHECK), arb) {
arb.PreParserDisableMask = true;
arb.PreParserDisable = false;
}
}
#endif
/* A companion command buffer is only used for blorp commands atm, so
* default to the legacy mode.
*/
cmd_buffer->state.current_db_mode = ANV_CMD_DESCRIPTOR_BUFFER_MODE_LEGACY;
genX(cmd_buffer_emit_bt_pool_base_address)(cmd_buffer);
/* Re-emit the aux table register in every command buffer. This way we're
* ensured that we have the table even if this command buffer doesn't
* initialize any images.
*/
if (cmd_buffer->device->info->has_aux_map) {
anv_add_pending_pipe_bits(cmd_buffer,
ANV_PIPE_AUX_TABLE_INVALIDATE_BIT,
"new cmd buffer with aux-tt");
}
}
VkResult
genX(BeginCommandBuffer)(
VkCommandBuffer commandBuffer,