anv/sparse: rework anv_free_sparse_bindings() error handling

None of the callers of anv_free_sparse_bindings() check for its return
result, and they also don't have a way to propagate it up the stack.
So just don't return error codes that won't be checked. Instead,
add an assertion so at least we can detect failures in our CI or
development runs.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28724>
This commit is contained in:
Paulo Zanoni
2024-04-11 17:04:20 -07:00
committed by Marge Bot
parent 95dc34cd97
commit a791805d10
2 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -3052,8 +3052,8 @@ VkResult anv_init_sparse_bindings(struct anv_device *device,
enum anv_bo_alloc_flags alloc_flags,
uint64_t client_address,
struct anv_address *out_address);
VkResult anv_free_sparse_bindings(struct anv_device *device,
struct anv_sparse_binding_data *sparse);
void anv_free_sparse_bindings(struct anv_device *device,
struct anv_sparse_binding_data *sparse);
VkResult anv_sparse_bind_buffer(struct anv_device *device,
struct anv_buffer *buffer,
const VkSparseMemoryBind *vk_bind,
+9 -5
View File
@@ -658,12 +658,12 @@ anv_init_sparse_bindings(struct anv_device *device,
return VK_SUCCESS;
}
VkResult
void
anv_free_sparse_bindings(struct anv_device *device,
struct anv_sparse_binding_data *sparse)
{
if (!sparse->address)
return VK_SUCCESS;
return;
sparse_debug("%s: address:0x%016"PRIx64" size:0x%08"PRIx64"\n",
__func__, sparse->address, sparse->size);
@@ -686,12 +686,16 @@ anv_free_sparse_bindings(struct anv_device *device,
.signal_count = 0,
};
VkResult res = anv_sparse_bind(device, &submit);
/* Our callers don't have a way to signal failure to the upper layers, so
* just keep the vma if we fail to unbind it. Still, let's have an
* assertion because this really shouldn't be happening.
*/
assert(res == VK_SUCCESS);
if (res != VK_SUCCESS)
return res;
return;
anv_vma_free(device, sparse->vma_heap, sparse->address, sparse->size);
return VK_SUCCESS;
}
static VkExtent3D