19f464c52Smaya/*
29f464c52Smaya * Copyright © 2018 Intel Corporation
39f464c52Smaya *
49f464c52Smaya * Permission is hereby granted, free of charge, to any person obtaining a
59f464c52Smaya * copy of this software and associated documentation files (the "Software"),
69f464c52Smaya * to deal in the Software without restriction, including without limitation
79f464c52Smaya * the rights to use, copy, modify, merge, publish, distribute, sublicense,
89f464c52Smaya * and/or sell copies of the Software, and to permit persons to whom the
99f464c52Smaya * Software is furnished to do so, subject to the following conditions:
109f464c52Smaya *
119f464c52Smaya * The above copyright notice and this permission notice (including the next
129f464c52Smaya * paragraph) shall be included in all copies or substantial portions of the
139f464c52Smaya * Software.
149f464c52Smaya *
159f464c52Smaya * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
169f464c52Smaya * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179f464c52Smaya * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
189f464c52Smaya * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
199f464c52Smaya * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
209f464c52Smaya * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
219f464c52Smaya * IN THE SOFTWARE.
229f464c52Smaya */
239f464c52Smaya
249f464c52Smaya#ifndef ANV_ANDROID_H
259f464c52Smaya#define ANV_ANDROID_H
269f464c52Smaya
277ec681f3Smrg#if defined(ANDROID) && ANDROID_API_LEVEL >= 26
287ec681f3Smrg#include <vndk/hardware_buffer.h>
297ec681f3Smrg#endif
309f464c52Smaya#include <vulkan/vulkan.h>
319f464c52Smaya#include <vulkan/vulkan_android.h>
329f464c52Smaya#include <vulkan/vk_android_native_buffer.h>
339f464c52Smaya
349f464c52Smayastruct anv_device_memory;
359f464c52Smayastruct anv_device;
369f464c52Smayastruct anv_image;
379f464c52Smaya
387ec681f3SmrgVkResult anv_image_init_from_gralloc(struct anv_device *device,
397ec681f3Smrg                                     struct anv_image *image,
407ec681f3Smrg                                     const VkImageCreateInfo *base_info,
417ec681f3Smrg                                     const VkNativeBufferANDROID *gralloc_info);
427ec681f3Smrg
437ec681f3SmrgVkResult anv_image_bind_from_gralloc(struct anv_device *device,
447ec681f3Smrg                                     struct anv_image *image,
457ec681f3Smrg                                     const VkNativeBufferANDROID *gralloc_info);
469f464c52Smaya
479f464c52Smayauint64_t anv_ahw_usage_from_vk_usage(const VkImageCreateFlags vk_create,
489f464c52Smaya                                     const VkImageUsageFlags vk_usage);
499f464c52Smaya
509f464c52SmayaVkResult anv_import_ahw_memory(VkDevice device_h,
519f464c52Smaya                               struct anv_device_memory *mem,
529f464c52Smaya                               const VkImportAndroidHardwareBufferInfoANDROID *info);
539f464c52Smaya
549f464c52SmayaVkResult anv_create_ahw_memory(VkDevice device_h,
559f464c52Smaya                               struct anv_device_memory *mem,
569f464c52Smaya                               const VkMemoryAllocateInfo *pAllocateInfo);
579f464c52Smaya#endif /* ANV_ANDROID_H */
58