From 71a2d651c13bfeb982a810b729ec437b1ea53670 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Tue, 15 Aug 2023 12:20:14 +0300 Subject: [PATCH] anv: refactor batch_set_preemption to use batch_emit_pipe_control MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This makes it easier to hook workarounds for this pipe control. Signed-off-by: Tapani Pälli Reviewed-by: Rohan Garg Part-of: --- src/intel/vulkan/anv_genX.h | 4 +++- src/intel/vulkan/genX_cmd_buffer.c | 11 ++++++----- src/intel/vulkan/genX_gpu_memcpy.c | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h index 61b92ab..2779a85 100644 --- a/src/intel/vulkan/anv_genX.h +++ b/src/intel/vulkan/anv_genX.h @@ -209,7 +209,9 @@ genX(ray_tracing_pipeline_emit)(struct anv_ray_tracing_pipeline *pipeline); }) void -genX(batch_set_preemption)(struct anv_batch *batch, bool value); +genX(batch_set_preemption)(struct anv_batch *batch, + const struct intel_device_info *devinfo, + bool value); void genX(cmd_buffer_set_preemption)(struct anv_cmd_buffer *cmd_buffer, bool value); diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 916f5b8..91b9572 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3209,7 +3209,9 @@ genX(batch_emit_pipe_control_write)(struct anv_batch *batch, /* Set preemption on/off. */ void -genX(batch_set_preemption)(struct anv_batch *batch, bool value) +genX(batch_set_preemption)(struct anv_batch *batch, + const struct intel_device_info *devinfo, + bool value) { #if GFX_VERx10 >= 120 anv_batch_write_reg(batch, GENX(CS_CHICKEN1), cc1) { @@ -3218,9 +3220,7 @@ genX(batch_set_preemption)(struct anv_batch *batch, bool value) } /* Wa_16013994831 - we need to insert CS_STALL and 250 noops. */ - anv_batch_emit(batch, GENX(PIPE_CONTROL), pipe) { - pipe.CommandStreamerStallEnable = true; - } + genX(batch_emit_pipe_control)(batch, devinfo, ANV_PIPE_CS_STALL_BIT); for (unsigned i = 0; i < 250; i++) anv_batch_emit(batch, GENX(MI_NOOP), noop); @@ -3234,7 +3234,8 @@ genX(cmd_buffer_set_preemption)(struct anv_cmd_buffer *cmd_buffer, bool value) if (cmd_buffer->state.gfx.object_preemption == value) return; - genX(batch_set_preemption)(&cmd_buffer->batch, value); + genX(batch_set_preemption)(&cmd_buffer->batch, cmd_buffer->device->info, + value); cmd_buffer->state.gfx.object_preemption = value; #endif } diff --git a/src/intel/vulkan/genX_gpu_memcpy.c b/src/intel/vulkan/genX_gpu_memcpy.c index 46f97df..4d5310b 100644 --- a/src/intel/vulkan/genX_gpu_memcpy.c +++ b/src/intel/vulkan/genX_gpu_memcpy.c @@ -83,7 +83,7 @@ emit_common_so_memcpy(struct anv_batch *batch, struct anv_device *device, /* Wa_16013994831 - Disable preemption during streamout. */ if (intel_needs_workaround(device->info, 16013994831)) - genX(batch_set_preemption)(batch, false); + genX(batch_set_preemption)(batch, device->info, false); #endif anv_batch_emit(batch, GENX(3DSTATE_SBE), sbe) { @@ -273,7 +273,7 @@ void genX(emit_so_memcpy_end)(struct anv_memcpy_state *state) { if (intel_device_info_is_dg2(state->device->info)) - genX(batch_set_preemption)(state->batch, true); + genX(batch_set_preemption)(state->batch, state->device->info, true); anv_batch_emit(state->batch, GENX(MI_BATCH_BUFFER_END), end); -- 2.7.4