mesa/vulkan: use DETECT_OS_ANDROID
This uses DETECT_OS_ANDROID instead of defined(ANDROID). This better supports glibc based host builds in the Soong build system. Reviewed-by: Aaron Ruby <aruby@blackberry.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26874>
This commit is contained in:

committed by
Marge Bot

parent
c27cd96f31
commit
a1e67b3933
@@ -25,11 +25,13 @@
|
|||||||
|
|
||||||
#include "vulkan/vulkan_core.h"
|
#include "vulkan/vulkan_core.h"
|
||||||
|
|
||||||
|
#include "util/detect_os.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ANDROID_API_LEVEL >= 26
|
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||||
|
|
||||||
VkFormat vk_ahb_format_to_image_format(uint32_t ahb_format);
|
VkFormat vk_ahb_format_to_image_format(uint32_t ahb_format);
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ uint64_t vk_image_usage_to_ahb_usage(const VkImageCreateFlags vk_create,
|
|||||||
struct AHardwareBuffer *
|
struct AHardwareBuffer *
|
||||||
vk_alloc_ahardware_buffer(const VkMemoryAllocateInfo *pAllocateInfo);
|
vk_alloc_ahardware_buffer(const VkMemoryAllocateInfo *pAllocateInfo);
|
||||||
|
|
||||||
#else /* ANDROID_API_LEVEL >= 26 */
|
#else /* DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26 */
|
||||||
|
|
||||||
static inline VkFormat
|
static inline VkFormat
|
||||||
vk_ahb_format_to_image_format(uint32_t ahb_format)
|
vk_ahb_format_to_image_format(uint32_t ahb_format)
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#include "vk_common_entrypoints.h"
|
#include "vk_common_entrypoints.h"
|
||||||
#include "vk_util.h"
|
#include "vk_util.h"
|
||||||
|
|
||||||
#if defined(ANDROID) && ANDROID_API_LEVEL >= 26
|
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||||
#include <vndk/hardware_buffer.h>
|
#include <vndk/hardware_buffer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ vk_device_memory_create(struct vk_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID: {
|
case VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID: {
|
||||||
#if defined(ANDROID) && ANDROID_API_LEVEL >= 26
|
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||||
const VkImportAndroidHardwareBufferInfoANDROID *ahb_info = (void *)ext;
|
const VkImportAndroidHardwareBufferInfoANDROID *ahb_info = (void *)ext;
|
||||||
|
|
||||||
assert(mem->import_handle_type == 0);
|
assert(mem->import_handle_type == 0);
|
||||||
@@ -80,7 +80,7 @@ vk_device_memory_create(struct vk_device *device,
|
|||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
unreachable("AHardwareBuffer import requires Android >= 26");
|
unreachable("AHardwareBuffer import requires Android >= 26");
|
||||||
#endif /* ANDROID_API_LEVEL >= 26 */
|
#endif /* DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26 */
|
||||||
}
|
}
|
||||||
|
|
||||||
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR: {
|
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR: {
|
||||||
@@ -181,15 +181,16 @@ vk_device_memory_destroy(struct vk_device *device,
|
|||||||
const VkAllocationCallbacks *alloc,
|
const VkAllocationCallbacks *alloc,
|
||||||
struct vk_device_memory *mem)
|
struct vk_device_memory *mem)
|
||||||
{
|
{
|
||||||
#if defined(ANDROID) && ANDROID_API_LEVEL >= 26
|
|
||||||
|
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||||
if (mem->ahardware_buffer)
|
if (mem->ahardware_buffer)
|
||||||
AHardwareBuffer_release(mem->ahardware_buffer);
|
AHardwareBuffer_release(mem->ahardware_buffer);
|
||||||
#endif /* ANDROID_API_LEVEL >= 26 */
|
#endif /* DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26 */
|
||||||
|
|
||||||
vk_object_free(device, alloc, mem);
|
vk_object_free(device, alloc, mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ANDROID) && ANDROID_API_LEVEL >= 26
|
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||||
VkResult
|
VkResult
|
||||||
vk_common_GetMemoryAndroidHardwareBufferANDROID(
|
vk_common_GetMemoryAndroidHardwareBufferANDROID(
|
||||||
VkDevice _device,
|
VkDevice _device,
|
||||||
|
Reference in New Issue
Block a user