venus: use VK_USE_PLATFORM_ANDROID_KHR when applicable
To stay consistent with common code gen: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36702 Besides using the spec platform guard, this change also: - drops the guard for ANB sharedImage - keep the gettid and disk cache guards as they are Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36802>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vulkan_android.h>
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
|
||||
VkResult
|
||||
vn_android_image_from_anb(struct vn_device *dev,
|
||||
@@ -35,7 +35,7 @@ vn_android_device_import_ahb(struct vn_device *dev,
|
||||
struct vn_device_memory *mem,
|
||||
const struct VkMemoryAllocateInfo *alloc_info);
|
||||
|
||||
#else
|
||||
#else /* VK_USE_PLATFORM_ANDROID_KHR */
|
||||
|
||||
static inline VkResult
|
||||
vn_android_image_from_anb(UNUSED struct vn_device *dev,
|
||||
@@ -64,6 +64,6 @@ vn_android_device_import_ahb(
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
#endif /* DETECT_OS_ANDROID */
|
||||
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
|
||||
|
||||
#endif /* VN_ANDROID_H */
|
||||
|
||||
@@ -395,7 +395,7 @@ vn_device_update_shader_cache_id(struct vn_device *dev)
|
||||
* The shader cache is destroyed after creating the necessary files
|
||||
* and not utilized by venus.
|
||||
*/
|
||||
#if !DETECT_OS_ANDROID && defined(ENABLE_SHADER_CACHE)
|
||||
#if !defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(ENABLE_SHADER_CACHE)
|
||||
const uint8_t *device_uuid =
|
||||
dev->physical_device->base.vk.properties.pipelineCacheUUID;
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@ vn_CreateImage(VkDevice device,
|
||||
} else if (ahb_info) {
|
||||
result = vn_image_create_deferred(dev, pCreateInfo, alloc, &img);
|
||||
} else if (swapchain_info) {
|
||||
#if DETECT_OS_ANDROID
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
result = vn_image_create_deferred(dev, pCreateInfo, alloc, &img);
|
||||
#else
|
||||
result = wsi_common_create_swapchain_image(
|
||||
@@ -788,7 +788,7 @@ vn_image_bind_wsi_memory(struct vn_device *dev,
|
||||
vn_device_memory_from_handle(info->memory);
|
||||
|
||||
if (!mem) {
|
||||
#if DETECT_OS_ANDROID
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
mem = vn_android_get_wsi_memory_from_bind_info(dev, info);
|
||||
if (!mem) {
|
||||
STACK_ARRAY_FINISH(local_infos);
|
||||
|
||||
@@ -838,11 +838,9 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
|
||||
if (renderer_info->pci.has_bus_info)
|
||||
VN_SET_VK_PROPS(props, &renderer_info->pci.props);
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
/* VK_ANDROID_native_buffer */
|
||||
if (vk_android_get_front_buffer_usage())
|
||||
props->sharedImage = true;
|
||||
#endif
|
||||
|
||||
/* TODO: Fix sparse binding on lavapipe. */
|
||||
if (props->driverID == VK_DRIVER_ID_MESA_LLVMPIPE)
|
||||
@@ -887,7 +885,7 @@ vn_physical_device_init_queue_family_properties(
|
||||
vn_call_vkGetPhysicalDeviceQueueFamilyProperties2(
|
||||
ring, vn_physical_device_to_handle(physical_dev), &count, props);
|
||||
|
||||
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 34
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR) && ANDROID_API_LEVEL >= 34
|
||||
/* Starting from Android 14 (Android U), framework HWUI has required a
|
||||
* second graphics queue to avoid racing between webview and skiavk.
|
||||
*/
|
||||
@@ -1013,14 +1011,14 @@ vn_physical_device_init_external_memory(
|
||||
physical_dev->external_memory.renderer_handle_type =
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
physical_dev->external_memory.supported_handle_types |=
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
|
||||
#else /* DETECT_OS_ANDROID */
|
||||
#else
|
||||
physical_dev->external_memory.supported_handle_types =
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT |
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
|
||||
#endif /* DETECT_OS_ANDROID */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,7 +1137,7 @@ vn_physical_device_get_native_extensions(
|
||||
physical_dev->renderer_sync_fd.semaphore_exportable)
|
||||
exts->KHR_external_semaphore_fd = true;
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
if (physical_dev->external_memory.renderer_handle_type &&
|
||||
renderer_exts->EXT_image_drm_format_modifier &&
|
||||
renderer_exts->EXT_queue_family_foreign) {
|
||||
@@ -1159,12 +1157,12 @@ vn_physical_device_get_native_extensions(
|
||||
physical_dev->renderer_sync_fd.fence_exportable)
|
||||
exts->ANDROID_native_buffer = true;
|
||||
}
|
||||
#else /* DETECT_OS_ANDROID */
|
||||
#else /* VK_USE_PLATFORM_ANDROID_KHR */
|
||||
if (physical_dev->external_memory.renderer_handle_type) {
|
||||
exts->KHR_external_memory_fd = true;
|
||||
exts->EXT_external_memory_dma_buf = true;
|
||||
}
|
||||
#endif /* DETECT_OS_ANDROID */
|
||||
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
|
||||
|
||||
#ifdef VN_USE_WSI_PLATFORM
|
||||
if (physical_dev->renderer_sync_fd.semaphore_importable) {
|
||||
@@ -1207,7 +1205,7 @@ vn_physical_device_get_passthrough_extensions(
|
||||
{
|
||||
struct vn_renderer *renderer = physical_dev->instance->renderer;
|
||||
|
||||
#if DETECT_OS_ANDROID || defined(VN_USE_WSI_PLATFORM)
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(VN_USE_WSI_PLATFORM)
|
||||
/* WSI support currently requires semaphore sync fd import for
|
||||
* VK_KHR_synchronization2 for code simplicity. This requirement can be
|
||||
* dropped by implementing external semaphore purely on the driver side
|
||||
|
||||
Reference in New Issue
Block a user