return -1;
}
+#if ANDROID_API_LEVEL >= 26
static VkResult
get_ahw_buffer_format_properties(
VkDevice device_h,
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
+#endif
+
/* Construct ahw usage mask from image usage bits, see
* 'AHardwareBuffer Usage Equivalence' in Vulkan spec.
*/
const VkImageUsageFlags vk_usage)
{
uint64_t ahw_usage = 0;
-
+#if ANDROID_API_LEVEL >= 26
if (vk_usage & VK_IMAGE_USAGE_SAMPLED_BIT)
ahw_usage |= AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
/* No usage bits set - set at least one GPU usage. */
if (ahw_usage == 0)
ahw_usage = AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
-
+#endif
return ahw_usage;
}
struct anv_device_memory *mem,
const VkImportAndroidHardwareBufferInfoANDROID *info)
{
+#if ANDROID_API_LEVEL >= 26
ANV_FROM_HANDLE(anv_device, device, device_h);
/* Import from AHardwareBuffer to anv_device_memory. */
mem->ahw = info->buffer;
return VK_SUCCESS;
+#else
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
+#endif
}
VkResult
struct anv_device_memory *mem,
const VkMemoryAllocateInfo *pAllocateInfo)
{
+#if ANDROID_API_LEVEL >= 26
ANV_FROM_HANDLE(anv_device, dev, device_h);
const VkMemoryDedicatedAllocateInfo *dedicated_info =
return VK_ERROR_OUT_OF_HOST_MEMORY;
mem->ahw = ahw;
-
return VK_SUCCESS;
+#else
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
+#endif
+
}
VkResult
const VkAllocationCallbacks *alloc,
VkImage *out_image_h)
{
+#if ANDROID_API_LEVEL >= 26
ANV_FROM_HANDLE(anv_device, device, device_h);
const struct VkExternalFormatANDROID *ext_info =
*out_image_h = image_h;
return VK_SUCCESS;
+#else
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
+#endif
}
+
VkResult
anv_image_from_gralloc(VkDevice device_h,
const VkImageCreateInfo *base_info,