summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2019-01-16 14:15:28 +0200
committerTapani Pälli <[email protected]>2019-01-17 07:22:02 +0200
commita311aa631d2037447f2bc38e8ab60707b0d3be3b (patch)
tree30ec4b8fdeb1b3efef393e7f205cdfd023a35b95
parent99ef66c325a99b3e191987d8327e7e4cd4aafcd7 (diff)
anv: do not advertise AHW support if extension not enabled
Fixes following failing vk-gl-cts cases on Linux desktop: dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.buffer.info dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.image.info dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.image.info dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.buffer.info Fixes: 517103abf1c "anv/android: add ahardwarebuffer external memory properties" Reported-by: Juan A. Suarez <[email protected]> Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Juan A. Suarez <[email protected]>
-rw-r--r--src/intel/vulkan/anv_formats.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 124d76c0e9f..7e9ae1ab4c4 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -1044,7 +1044,10 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2(
if (result != VK_SUCCESS)
goto fail;
- if (android_usage) {
+ bool ahw_supported =
+ physical_device->supported_extensions.ANDROID_external_memory_android_hardware_buffer;
+
+ if (ahw_supported && android_usage) {
android_usage->androidHardwareBufferUsage =
anv_ahw_usage_from_vk_usage(base_info->flags,
base_info->usage);
@@ -1067,9 +1070,11 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2(
external_props->externalMemoryProperties = prime_fd_props;
break;
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID:
- if (external_props)
+ if (ahw_supported && external_props) {
external_props->externalMemoryProperties = android_image_props;
- break;
+ break;
+ }
+ /* fallthrough if ahw not supported */
default:
/* From the Vulkan 1.0.42 spec:
*
@@ -1147,15 +1152,19 @@ void anv_GetPhysicalDeviceExternalBufferProperties(
if (pExternalBufferInfo->flags)
goto unsupported;
+ ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
+
switch (pExternalBufferInfo->handleType) {
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT:
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT:
pExternalBufferProperties->externalMemoryProperties = prime_fd_props;
return;
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID:
- pExternalBufferProperties->externalMemoryProperties =
- android_buffer_props;
- return;
+ if (physical_device->supported_extensions.ANDROID_external_memory_android_hardware_buffer) {
+ pExternalBufferProperties->externalMemoryProperties = android_buffer_props;
+ return;
+ }
+ /* fallthrough if ahw not supported */
default:
goto unsupported;
}