mesa/src/amd/vulkan/radv_android.h
Samuel Pitoiset fb73ccea56 radv: add radv_android.h
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28551>
2024-04-04 16:35:15 +00:00

72 lines
2.7 KiB
C

/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef RADV_ANDROID_H
#define RADV_ANDROID_H
#include <stdbool.h>
#include <vulkan/vulkan.h>
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vulkan_android.h>
#include "vk_android.h"
/* Helper to determine if we should compile
* any of the Android AHB support.
*
* To actually enable the ext we also need
* the necessary kernel support.
*/
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
#define RADV_SUPPORT_ANDROID_HARDWARE_BUFFER 1
#include <vndk/hardware_buffer.h>
#else
#define RADV_SUPPORT_ANDROID_HARDWARE_BUFFER 0
#endif
struct radv_device;
struct radv_device_memory;
VkResult radv_image_from_gralloc(VkDevice device_h, const VkImageCreateInfo *base_info,
const VkNativeBufferANDROID *gralloc_info, const VkAllocationCallbacks *alloc,
VkImage *out_image_h);
unsigned radv_ahb_format_for_vk_format(VkFormat vk_format);
VkFormat radv_select_android_external_format(const void *next, VkFormat default_format);
VkResult radv_import_ahb_memory(struct radv_device *device, struct radv_device_memory *mem, unsigned priority,
const VkImportAndroidHardwareBufferInfoANDROID *info);
VkResult radv_create_ahb_memory(struct radv_device *device, struct radv_device_memory *mem, unsigned priority,
const VkMemoryAllocateInfo *pAllocateInfo);
bool radv_android_gralloc_supports_format(VkFormat format, VkImageUsageFlagBits usage);
#endif /* RADV_ANDROID_H */