panvk: Report allocation failures in the CreateImageView path

Allocation of the texture payload can fail, we need to report
VK_ERROR_OUT_OF_DEVICE_MEMORY in that case.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
This commit is contained in:
Boris Brezillon
2024-09-24 15:36:32 +02:00
committed by Marge Bot
parent 7da23be734
commit 63fb2e2c04
@@ -81,6 +81,7 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
bool driver_internal =
(pCreateInfo->flags & VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA) != 0;
struct panvk_image_view *view;
VkResult result;
view = vk_image_view_create(&device->vk, driver_internal, pCreateInfo,
pAllocator, sizeof(*view));
@@ -160,6 +161,10 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
};
view->mem = panvk_pool_alloc_mem(&device->mempools.rw, alloc_info);
if (!panvk_priv_mem_host_addr(view->mem)) {
result = vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
goto err_destroy_iview;
}
struct panfrost_ptr ptr = {
.gpu = panvk_priv_mem_dev_addr(view->mem),
@@ -222,6 +227,10 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
*pView = panvk_image_view_to_handle(view);
return VK_SUCCESS;
err_destroy_iview:
vk_image_view_destroy(&device->vk, pAllocator, &view->vk);
return result;
}
VKAPI_ATTR void VKAPI_CALL