panvk: Avoid division by zero for vkCmdCopyQueryPoolResults
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Stride can be zero if there are less than two queries to copy.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 7755c41b3e ("panvk/csf: Rework the occlusion query logic to avoid draw flushes")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34020>
This commit is contained in:
John Anthony 2025-03-12 10:21:21 +01:00 committed by Marge Bot
parent 43c99d3928
commit 8a47ae456c

View file

@ -258,9 +258,11 @@ panvk_copy_occlusion_query_results(struct panvk_cmd_buffer *cmd,
struct cs_index scratch_regs = cs_scratch_reg_tuple(b, 0, 11);
uint32_t queries_per_batch = scratch_regs.size / regs_per_copy;
/* Store offset is a 16-bit signed integer, so we might be limited by the
* stride here. */
queries_per_batch = MIN2(((1u << 15) / stride) + 1, queries_per_batch);
if (stride > 0) {
/* Store offset is a 16-bit signed integer, so we might be limited by the
* stride here. */
queries_per_batch = MIN2(((1u << 15) / stride) + 1, queries_per_batch);
}
/* Stop unrolling the loop when it takes more than 2 steps to copy the
* queries. */