Skip to content

Commit 4239e13

Browse files
hakzsamMarge Bot
authored andcommitted
radv: fix a descriptor leak with debug names and host base descriptor set
vk_object_base_finish() needs to be called on the descriptor set in order to free the debug names. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10098 Signed-off-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26088>
1 parent 904015a commit 4239e13

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/amd/vulkan/radv_descriptor_set.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po
691691
pool->entries[pool->entry_count].size = layout_size;
692692
pool->entries[pool->entry_count].set = set;
693693
} else {
694-
pool->layouts[pool->entry_count] = layout;
694+
pool->sets[pool->entry_count] = set;
695695
}
696696

697697
pool->current_offset += layout_size;
@@ -775,7 +775,8 @@ radv_destroy_descriptor_pool(struct radv_device *device, const VkAllocationCallb
775775
}
776776
} else {
777777
for (uint32_t i = 0; i < pool->entry_count; ++i) {
778-
vk_descriptor_set_layout_unref(&device->vk, &pool->layouts[i]->vk);
778+
vk_descriptor_set_layout_unref(&device->vk, &pool->sets[i]->header.layout->vk);
779+
vk_object_base_finish(&pool->sets[i]->header.base);
779780
}
780781
}
781782

@@ -881,15 +882,15 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr
881882
bo_size += 16 * MIN2(num_16byte_descriptors, pCreateInfo->maxSets);
882883
}
883884

884-
uint64_t layouts_size = 0;
885+
uint64_t sets_size = 0;
885886

886887
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) {
887888
size += pCreateInfo->maxSets * sizeof(struct radv_descriptor_set);
888889
size += sizeof(struct radeon_winsys_bo *) * bo_count;
889890
size += sizeof(struct radv_descriptor_range) * range_count;
890891

891-
layouts_size = sizeof(struct radv_descriptor_set_layout *) * pCreateInfo->maxSets;
892-
size += layouts_size;
892+
sets_size = sizeof(struct radv_descriptor_set *) * pCreateInfo->maxSets;
893+
size += sets_size;
893894
} else {
894895
size += sizeof(struct radv_descriptor_pool_entry) * pCreateInfo->maxSets;
895896
}
@@ -903,7 +904,7 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr
903904
vk_object_base_init(&device->vk, &pool->base, VK_OBJECT_TYPE_DESCRIPTOR_POOL);
904905

905906
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) {
906-
pool->host_memory_base = (uint8_t *)pool + sizeof(struct radv_descriptor_pool) + layouts_size;
907+
pool->host_memory_base = (uint8_t *)pool + sizeof(struct radv_descriptor_pool) + sets_size;
907908
pool->host_memory_ptr = pool->host_memory_base;
908909
pool->host_memory_end = (uint8_t *)pool + size;
909910
}
@@ -975,7 +976,8 @@ radv_ResetDescriptorPool(VkDevice _device, VkDescriptorPool descriptorPool, VkDe
975976
}
976977
} else {
977978
for (uint32_t i = 0; i < pool->entry_count; ++i) {
978-
vk_descriptor_set_layout_unref(&device->vk, &pool->layouts[i]->vk);
979+
vk_descriptor_set_layout_unref(&device->vk, &pool->sets[i]->header.layout->vk);
980+
vk_object_base_finish(&pool->sets[i]->header.base);
979981
}
980982
}
981983

src/amd/vulkan/radv_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ struct radv_descriptor_pool {
12151215
uint32_t max_entry_count;
12161216

12171217
union {
1218-
struct radv_descriptor_set_layout *layouts[0];
1218+
struct radv_descriptor_set *sets[0];
12191219
struct radv_descriptor_pool_entry entries[0];
12201220
};
12211221
};

0 commit comments

Comments
 (0)