From: Samuel Pitoiset Date: Tue, 7 Nov 2023 09:30:43 +0000 (+0100) Subject: radv: fix a descriptor leak with debug names and host base descriptor set X-Git-Tag: upstream/23.3.3~210 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd46e0b6d3331070be2b0b04f481bf37ffa548a8;p=platform%2Fupstream%2Fmesa.git 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 Part-of: (cherry picked from commit 4239e13ff658f7e4746779b8b4c4954b9437533c) --- diff --git a/.pick_status.json b/.pick_status.json index 356f633..8d34aa8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1414,7 +1414,7 @@ "description": "radv: fix a descriptor leak with debug names and host base descriptor set", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index a0aa067..602a995 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -691,7 +691,7 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po pool->entries[pool->entry_count].size = layout_size; pool->entries[pool->entry_count].set = set; } else { - pool->layouts[pool->entry_count] = layout; + pool->sets[pool->entry_count] = set; } pool->current_offset += layout_size; @@ -775,7 +775,8 @@ radv_destroy_descriptor_pool(struct radv_device *device, const VkAllocationCallb } } else { for (uint32_t i = 0; i < pool->entry_count; ++i) { - vk_descriptor_set_layout_unref(&device->vk, &pool->layouts[i]->vk); + vk_descriptor_set_layout_unref(&device->vk, &pool->sets[i]->header.layout->vk); + vk_object_base_finish(&pool->sets[i]->header.base); } } @@ -881,15 +882,15 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr bo_size += 16 * MIN2(num_16byte_descriptors, pCreateInfo->maxSets); } - uint64_t layouts_size = 0; + uint64_t sets_size = 0; if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) { size += pCreateInfo->maxSets * sizeof(struct radv_descriptor_set); size += sizeof(struct radeon_winsys_bo *) * bo_count; size += sizeof(struct radv_descriptor_range) * range_count; - layouts_size = sizeof(struct radv_descriptor_set_layout *) * pCreateInfo->maxSets; - size += layouts_size; + sets_size = sizeof(struct radv_descriptor_set *) * pCreateInfo->maxSets; + size += sets_size; } else { size += sizeof(struct radv_descriptor_pool_entry) * pCreateInfo->maxSets; } @@ -903,7 +904,7 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr vk_object_base_init(&device->vk, &pool->base, VK_OBJECT_TYPE_DESCRIPTOR_POOL); if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) { - pool->host_memory_base = (uint8_t *)pool + sizeof(struct radv_descriptor_pool) + layouts_size; + pool->host_memory_base = (uint8_t *)pool + sizeof(struct radv_descriptor_pool) + sets_size; pool->host_memory_ptr = pool->host_memory_base; pool->host_memory_end = (uint8_t *)pool + size; } @@ -975,7 +976,8 @@ radv_ResetDescriptorPool(VkDevice _device, VkDescriptorPool descriptorPool, VkDe } } else { for (uint32_t i = 0; i < pool->entry_count; ++i) { - vk_descriptor_set_layout_unref(&device->vk, &pool->layouts[i]->vk); + vk_descriptor_set_layout_unref(&device->vk, &pool->sets[i]->header.layout->vk); + vk_object_base_finish(&pool->sets[i]->header.base); } } diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 5eb9102..56d0ad2 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1201,7 +1201,7 @@ struct radv_descriptor_pool { uint32_t max_entry_count; union { - struct radv_descriptor_set_layout *layouts[0]; + struct radv_descriptor_set *sets[0]; struct radv_descriptor_pool_entry entries[0]; }; };