Mesa (main): venus: fix asserts on mem bo
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 3 06:02:46 UTC 2021
Module: Mesa
Branch: main
Commit: 4bd7a3829ed8c7d00859fb9c3ee7317e43cdb98f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bd7a3829ed8c7d00859fb9c3ee7317e43cdb98f
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Wed Jun 2 20:17:22 2021 -0700
venus: fix asserts on mem bo
They failed to check the result before asserting.
Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11154>
---
src/virtio/vulkan/vn_device_memory.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c
index a92e24f87ce..330d0b5c5c8 100644
--- a/src/virtio/vulkan/vn_device_memory.c
+++ b/src/virtio/vulkan/vn_device_memory.c
@@ -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;
More information about the mesa-commit
mailing list