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 <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37818>
(cherry picked from commit febac6d9bd)
This commit is contained in:
Lionel Landwerlin 2025-10-10 17:00:47 +03:00 committed by Eric Engestrom
parent c673bf8284
commit 908a6b2b0c
2 changed files with 9 additions and 4 deletions

View file

@ -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

View file

@ -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),