Module: Mesa Branch: main Commit: 5a9f907d9484aae6d09e9734ddf0e7951745f534 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a9f907d9484aae6d09e9734ddf0e7951745f534
Author: Yiwei Zhang <[email protected]> Date: Tue Sep 28 07:00:13 2021 +0000 venus: properly check and fill ahb buffer properties When it comes to AHB, pExternalBufferInfo->handleType is already overridden to the renderer handle type. Thus the AHB buffer prop path is not used. However, this is not caught by cts, vvl or apps because the host renderer memory features so far satisfy the ahb requirement. Fixes: ebf0e455063 ("venus: add ahb image and buffer properties query support") Signed-off-by: Yiwei Zhang <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Ryan Neph <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13076> --- src/virtio/vulkan/vn_physical_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index ab2c052b4ac..a9723e24993 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -2256,6 +2256,9 @@ vn_GetPhysicalDeviceExternalBufferProperties( physical_dev->external_memory.renderer_handle_type; const VkExternalMemoryHandleTypeFlags supported_handle_types = physical_dev->external_memory.supported_handle_types; + const bool is_ahb = + pExternalBufferInfo->handleType == + VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID; VkExternalMemoryProperties *props = &pExternalBufferProperties->externalMemoryProperties; @@ -2278,8 +2281,7 @@ vn_GetPhysicalDeviceExternalBufferProperties( physical_dev->instance, physicalDevice, pExternalBufferInfo, pExternalBufferProperties); - if (pExternalBufferInfo->handleType == - VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + if (is_ahb) { props->compatibleHandleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID; /* AHB backed buffer requires renderer to support import bit while it
