venus: fix asserts on mem bo

They failed to check the result before asserting.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11154>
This commit is contained in:
Chia-I Wu
2021-06-02 20:17:22 -07:00
committed by Marge Bot
parent 67ad9f7580
commit 4bd7a3829e
+4 -4
View File
@@ -291,7 +291,7 @@ vn_AllocateMemory(VkDevice device,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID);
const bool need_bo =
(mem_type->propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) ||
export_info;
export_info || import_ahb_info || import_fd_info;
const bool suballocate =
need_bo && !pAllocateInfo->pNext &&
!(mem_type->propertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) &&
@@ -311,14 +311,11 @@ vn_AllocateMemory(VkDevice device,
if (import_ahb_info) {
result = vn_android_device_import_ahb(dev, mem, pAllocateInfo,
import_ahb_info->buffer);
assert(mem->base_bo);
} else if (export_ahb) {
result = vn_android_device_allocate_ahb(dev, mem, pAllocateInfo);
assert(mem->base_bo);
} else if (import_fd_info) {
result = vn_device_memory_import_dma_buf(dev, mem, pAllocateInfo,
import_fd_info->fd);
assert(mem->base_bo);
} else if (suballocate) {
result = vn_device_memory_pool_alloc(
dev, pAllocateInfo->memoryTypeIndex, mem->size, &mem->base_memory,
@@ -333,6 +330,9 @@ vn_AllocateMemory(VkDevice device,
return vn_error(dev->instance, result);
}
if (need_bo)
assert(mem->base_bo);
*pMemory = mem_handle;
return VK_SUCCESS;