From 908a6b2b0c287444af33900bc7d4d5ab5b107f37 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 10 Oct 2025 17:00:47 +0300 Subject: [PATCH] anv: fix query copy with shaders First this is only possible on RCS or CCS engines. Second if on CCS, we need to use a compute shader, 3D won't work. Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: Ivan Briano Part-of: (cherry picked from commit febac6d9bd239df31207c657f6396cf63a7d9bf4) --- .pick_status.json | 2 +- src/intel/vulkan/genX_query.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3d673f3b657..a5107fae276 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2284,7 +2284,7 @@ "description": "anv: fix query copy with shaders", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c index 4c059b00116..5d3324b9457 100644 --- a/src/intel/vulkan/genX_query.c +++ b/src/intel/vulkan/genX_query.c @@ -1860,8 +1860,12 @@ copy_query_results_with_shader(struct anv_cmd_buffer *cmd_buffer, /* If this is the first command in the batch buffer, make sure we have * consistent pipeline mode. */ - if (cmd_buffer->state.current_pipeline == UINT32_MAX) - genX(flush_pipeline_select_3d)(cmd_buffer); + if (cmd_buffer->state.current_pipeline == UINT32_MAX) { + if (anv_cmd_buffer_is_render_queue(cmd_buffer)) + genX(flush_pipeline_select_3d)(cmd_buffer); + else + genX(flush_pipeline_select_gpgpu)(cmd_buffer); + } if ((cmd_buffer->state.queries.buffer_write_bits | cmd_buffer->state.queries.clear_bits) & ANV_QUERY_WRITES_RT_FLUSH) @@ -2032,7 +2036,8 @@ void genX(CmdCopyQueryPoolResults)( struct anv_device *device = cmd_buffer->device; struct anv_physical_device *pdevice = device->physical; - if (queryCount > pdevice->instance->query_copy_with_shader_threshold) { + if (queryCount > pdevice->instance->query_copy_with_shader_threshold && + anv_cmd_buffer_is_render_or_compute_queue(cmd_buffer)) { copy_query_results_with_shader(cmd_buffer, pool, anv_address_add(buffer->address, destOffset),