v3dv/descriptor_set: don't free individual set if not allowed
authorAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 16 Mar 2021 22:07:44 +0000 (22:07 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 17 Mar 2021 10:05:07 +0000 (10:05 +0000)
commitc373b24369808f30535bd5e72effa252b2fd7c1e
tree22e38b59a51bd2407d921f46460b005726f7e4f9
parentaefac6074136f7ce075494dbc3fffb5eb23c5e45
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@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9640>
src/broadcom/vulkan/v3dv_descriptor_set.c