anv: use common vk_android_get_front_buffer_usage helper

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35568>
This commit is contained in:
Yiwei Zhang 2025-06-16 19:46:06 -07:00 committed by Marge Bot
parent 6ea894a809
commit 64326d0be5
2 changed files with 3 additions and 15 deletions

View file

@ -584,12 +584,8 @@ VkResult anv_GetSwapchainGrallocUsage2ANDROID(
*grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_HWCOMPOSER;
}
struct u_gralloc *gralloc = vk_android_get_ugralloc();
if ((swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID) &&
gralloc) {
uint64_t front_rendering_usage = 0;
u_gralloc_get_front_rendering_usage(gralloc, &front_rendering_usage);
*grallocProducerUsage |= front_rendering_usage;
if (swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID) {
*grallocProducerUsage |= vk_android_get_front_buffer_usage();
}
return VK_SUCCESS;

View file

@ -1263,14 +1263,6 @@ get_properties(const struct anv_physical_device *pdevice,
VkSampleCountFlags sample_counts =
isl_device_get_sample_counts(&pdevice->isl_dev);
#if DETECT_OS_ANDROID
/* Used to fill struct VkPhysicalDevicePresentationPropertiesANDROID */
uint64_t front_rendering_usage = 0;
struct u_gralloc *gralloc = vk_android_get_ugralloc();
if (gralloc != NULL)
u_gralloc_get_front_rendering_usage(gralloc, &front_rendering_usage);
#endif /* DETECT_OS_ANDROID */
struct anv_descriptor_limits desc_limits;
get_device_descriptor_limits(pdevice, &desc_limits);
@ -2001,7 +1993,7 @@ get_properties(const struct anv_physical_device *pdevice,
/* VK_ANDROID_native_buffer */
#if DETECT_OS_ANDROID
{
props->sharedImage = front_rendering_usage ? VK_TRUE : VK_FALSE;
props->sharedImage = !!vk_android_get_front_buffer_usage();
}
#endif /* DETECT_OS_ANDROID */