Mesa (master): v3dv/descriptor_set: don't free individual set if not allowed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 17 10:30:06 UTC 2021


Module: Mesa
Branch: master
Commit: c373b24369808f30535bd5e72effa252b2fd7c1e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c373b24369808f30535bd5e72effa252b2fd7c1e

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Tue Mar 16 22:07:44 2021 +0000

v3dv/descriptor_set: don't free individual set if not allowed

If we have a host_memory_base pointer it means that we are handling
the pool memory as a whole, so each set is a sub-slice of the memory
pool. In this case we can't just free the individual set. In other
words, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT is not set.

Note tha at that point we were able to sub-allocate an set, and we are
failing to sub-allocate the pool bo for the descripto bo. So
technically we could try to return that set to the pool (so undo the
change on host_memory_ptr before), that I assume was my intention when
(wrongly) calling vk_free there. But in practice, at that point we are
already on a out of descriptor pool situation, so in the end it
doesn't even matter.

This fixes a double free crash with the UE4 VehicleGame demo.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9640>

---

 src/broadcom/vulkan/v3dv_descriptor_set.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/broadcom/vulkan/v3dv_descriptor_set.c b/src/broadcom/vulkan/v3dv_descriptor_set.c
index 54787c99abe..7b41f918ce8 100644
--- a/src/broadcom/vulkan/v3dv_descriptor_set.c
+++ b/src/broadcom/vulkan/v3dv_descriptor_set.c
@@ -829,7 +829,6 @@ descriptor_set_create(struct v3dv_device *device,
                  sizeof(pool->entries[0]) * (pool->entry_count - index));
       } else {
          assert(pool->host_memory_base);
-         vk_object_free(&device->vk, NULL, set);
          return out_of_pool_memory(device, pool);
       }
 



More information about the mesa-commit mailing list