From 18516294072ec9021b6b81722402e425e75d2f1c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 6 Jun 2024 00:39:57 +0300 Subject: [PATCH] anv: limit aux invalidations to primary command buffers This AUX-TT is only updated on the CPU since ee6e2bc4a3 ("anv: Place images into the aux-map when safe to do so"). So the only really important invalidation that needs to happens is on the beginning of a primary command buffer. We are required to idle the pipes prior invalidation the AUX-TT. This might not be happening when the invalidation is put at the beginning of the secondary command buffers. Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: Rohan Garg Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 0d315ff0faf..af288f4a791 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2806,11 +2806,11 @@ genX(cmd_buffer_begin_companion)(struct anv_cmd_buffer *cmd_buffer, 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. + /* Invalidate the aux table in every primary command buffer. This ensures + * the command buffer see the last updates made by the host. */ - if (cmd_buffer->device->info->has_aux_map) { + if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY && + 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"); @@ -2904,11 +2904,11 @@ genX(BeginCommandBuffer)( if (anv_cmd_buffer_is_video_queue(cmd_buffer) || anv_cmd_buffer_is_blitter_queue(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. + /* Invalidate the aux table in every primary command buffer. This + * ensures the command buffer see the last updates made by the host. */ - if (cmd_buffer->device->info->has_aux_map) { + if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY && + 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"); @@ -2946,11 +2946,11 @@ genX(BeginCommandBuffer)( ANV_PIPE_VF_CACHE_INVALIDATE_BIT, "new 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. + /* Invalidate the aux table in every primary command buffer. This ensures + * the command buffer see the last updates made by the host. */ - if (cmd_buffer->device->info->has_aux_map) { + if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY && + 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");