panvk: Merge identical BO entries before submitting a job

This should ideally be filtered when BOs are attached to a batch, but
let's do it in the submit path until then.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12095>
This commit is contained in:
Boris Brezillon 2021-09-03 15:26:53 +02:00
parent 165c26b9e1
commit b0eaaf90f3
1 changed files with 10 additions and 0 deletions

View File

@ -262,6 +262,16 @@ panvk_per_arch(QueueSubmit)(VkQueue _queue,
bos[bo_idx++] = pdev->sample_positions->gem_handle;
assert(bo_idx == nr_bos);
/* Merge identical BO entries. */
for (unsigned x = 0; x < nr_bos; x++) {
for (unsigned y = x + 1; y < nr_bos; ) {
if (bos[x] == bos[y])
bos[y] = bos[--nr_bos];
else
y++;
}
}
unsigned nr_in_fences = 0;
unsigned max_wait_event_syncobjs =
util_dynarray_num_elements(&batch->event_ops,