From 3e9dc4f777ce20c3b73237d0f436c59822fe8fa3 Mon Sep 17 00:00:00 2001 From: John Anthony Date: Wed, 18 Jun 2025 15:52:48 +0200 Subject: [PATCH] panvk: use variable count when initializing iub buffer descriptor Ensure we use the variable count to initialize the internal buffer descriptor for variable count inline uniform block, if we have one. Reviewed-by: Boris Brezillon Reviewed-by: Olivia Lee Reviewed-by: Christoph Pillmayer Fixes: 5fe5e317 ("panvk: advertise descriptor indexing on valhall") Part-of: --- src/panfrost/vulkan/panvk_vX_descriptor_set.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/panfrost/vulkan/panvk_vX_descriptor_set.c b/src/panfrost/vulkan/panvk_vX_descriptor_set.c index a64b61a3dd7..14ecf639160 100644 --- a/src/panfrost/vulkan/panvk_vX_descriptor_set.c +++ b/src/panfrost/vulkan/panvk_vX_descriptor_set.c @@ -351,17 +351,24 @@ desc_set_write_immutable_samplers(struct panvk_descriptor_set *set, } static void -panvk_init_iub(struct panvk_descriptor_set *set, uint32_t binding) +panvk_init_iub(struct panvk_descriptor_set *set, uint32_t binding, + uint32_t variable_count) { const struct panvk_descriptor_set_binding_layout *binding_layout = &set->layout->bindings[binding]; + bool has_variable_count = + binding_layout->flags & + VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT; + /* The first element is the buffer descriptor. */ uint32_t iub_data_offset = panvk_get_desc_index(binding_layout, 1, NO_SUBDESC) * PANVK_DESCRIPTOR_SIZE; uint64_t iub_data_dev = set->descs.dev + iub_data_offset; - uint32_t iub_size_dev = panvk_get_iub_size(binding_layout->desc_count); + uint32_t iub_desc_count = has_variable_count ? + panvk_get_iub_desc_count(variable_count) : binding_layout->desc_count; + uint32_t iub_size_dev = panvk_get_iub_size(iub_desc_count); #if PAN_ARCH < 9 struct { @@ -443,7 +450,7 @@ panvk_desc_pool_allocate_set(struct panvk_descriptor_pool *pool, for (uint32_t b = 0; b < layout->binding_count; ++b) { if (layout->bindings[b].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) - panvk_init_iub(set, b); + panvk_init_iub(set, b, variable_count); } *out = set;