v3dv: grow meta descriptor pool dynamically
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 26 Oct 2020 09:39:29 +0000 (10:39 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 27 Oct 2020 10:15:28 +0000 (10:15 +0000)
commit666817ce846948afb6a01b29aea45d6c58477045
treeb5f7d69c875176190ddc400656bad55ac56e9d56
parent6b874eb42c80acefa4d94be2490dcce47e19a06a
v3dv: grow meta descriptor pool dynamically

Our blit shader path allocates a descriptor pool to create
combined image sampler descriptors for blit source images. So
far, we had sized this pool statically and the driver would
fail if we ever need to allocate more descriptors than that.

With this change, we switch to using a dynamic allocation
mechanism instead where we allocate as many pools as we need to
meet descriptor set allocation requirements for the command buffer.

Also, every time a new pool needs to be created, we double its
size (up to a limit), so we can start small and avoid wasting
memory for command buffers that only have a small number of blits,
while trying to keep allocation overhead low for command buffers
that record a lot of blits.

v2: use existing framework for automatic destruction of private
    driver objects to free allocated pools.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7311>
src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_meta_copy.c
src/broadcom/vulkan/v3dv_private.h