From b1db49d07857e0681e3c1bca9ae5a40f46ea5e3b Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 28 Jun 2024 11:43:15 +0200 Subject: [PATCH] panvk: Allow more descriptor sets on Valhall The hardware limit on Valhall is 16 descriptor tables, but we reserve one for our internal descriptors (dummy sampler, vertex attributes and dynamic buffers), which leaves us with 15 user descriptor sets. Signed-off-by: Boris Brezillon Reviewed-by: Mary Guillemard Part-of: --- .../vulkan/panvk_descriptor_set_layout.h | 2 +- src/panfrost/vulkan/panvk_physical_device.c | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/panfrost/vulkan/panvk_descriptor_set_layout.h b/src/panfrost/vulkan/panvk_descriptor_set_layout.h index e29ed877c0c..057eb6a0802 100644 --- a/src/panfrost/vulkan/panvk_descriptor_set_layout.h +++ b/src/panfrost/vulkan/panvk_descriptor_set_layout.h @@ -19,7 +19,7 @@ #include "genxml/gen_macros.h" #define PANVK_DESCRIPTOR_SIZE 32 -#define MAX_SETS 4 +#define MAX_SETS (PAN_ARCH <= 7 ? 4 : 15) #define MAX_DYNAMIC_UNIFORM_BUFFERS 16 #define MAX_DYNAMIC_STORAGE_BUFFERS 8 #define MAX_PUSH_DESCS 32 diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 39eafc16328..55e93525231 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -249,7 +249,7 @@ get_device_properties(const struct panvk_instance *instance, uint64_t os_page_size = 4096; os_get_page_size(&os_page_size); - ASSERTED unsigned arch = pan_arch(device->kmod.props.gpu_prod_id); + unsigned arch = pan_arch(device->kmod.props.gpu_prod_id); /* Ensure that the max threads count per workgroup is valid for Bifrost */ assert(arch > 8 || device->kmod.props.max_threads_per_wg <= 1024); @@ -298,14 +298,18 @@ get_device_properties(const struct panvk_instance *instance, .bufferImageGranularity = 64, /* Sparse binding not supported yet. */ .sparseAddressSpaceSize = 0, - /* Software limit. Pick the minimum required by Vulkan, because Bifrost - * GPUs don't have unified descriptor tables, which forces us to - * agregatte all descriptors from all sets and dispatch them to per-type - * descriptor tables emitted at draw/dispatch time. - * The more sets we support the more copies we are likely to have to do - * at draw time. + /* On Bifrost, this is a software limit. We pick the minimum required by + * Vulkan, because Bifrost GPUs don't have unified descriptor tables, + * which forces us to agregatte all descriptors from all sets and dispatch + * them to per-type descriptor tables emitted at draw/dispatch time. The + * more sets we support the more copies we are likely to have to do at + * draw time. + * + * Valhall has native support for descriptor sets, and allows a maximum + * of 16 sets, but we reserve one for our internal use, so we have 15 + * left. */ - .maxBoundDescriptorSets = 4, + .maxBoundDescriptorSets = arch <= 7 ? 4 : 15, /* MALI_RENDERER_STATE::sampler_count is 16-bit. */ .maxDescriptorSetSamplers = UINT16_MAX, /* MALI_RENDERER_STATE::uniform_buffer_count is 8-bit. We reserve 32 slots