pvr: finalize query_indices array after ending last sub_cmd

The last sub_cmd in the command buffer could be a graphics one, and when
ending a graphics sub_cmd, the query_indices array will be checked to
know whether a occlusion query starts during this graphics sub_cmd.

Finalize the query_indices array after ending the last sub_cmd,
otherwise the check for query initiation may have a false negative
result.

Fixes the `dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.
random.seed6` test case.

Fixes: 2b1992a000 ("pvr: Implement vkCmdBeginQuery API.")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
(cherry picked from commit 36f34a72c1)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
Icenowy Zheng 2026-04-08 23:48:07 +08:00 committed by Eric Engestrom
parent bc69f4192b
commit 01445cca55
3 changed files with 3 additions and 4 deletions

View file

@ -5704,7 +5704,7 @@
"description": "pvr: finalize query_indices array after ending last sub_cmd",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "2b1992a0005b2342afd53dc21eb01288dddee6b5",
"notes": null

View file

@ -147,7 +147,6 @@ dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed58,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed59_multiview,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed59,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed6_multiview,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed6,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed60_multiview,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed60,Fail
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed61_multiview,Fail

View file

@ -9806,11 +9806,11 @@ VkResult PVR_PER_ARCH(EndCommandBuffer)(VkCommandBuffer commandBuffer)
/* TODO: We should be freeing all the resources, allocated for recording,
* here.
*/
util_dynarray_fini(&state->query_indices);
result = pvr_arch_cmd_buffer_end_sub_cmd(cmd_buffer);
if (result != VK_SUCCESS)
pvr_cmd_buffer_set_error_unwarned(cmd_buffer, result);
util_dynarray_fini(&state->query_indices);
return vk_command_buffer_end(&cmd_buffer->vk);
}