venus: use common vk_android_get_front_buffer_usage helper
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35568>
This commit is contained in:
Yiwei Zhang 2025-06-16 19:01:55 -07:00 committed by Marge Bot
parent 61a90a154d
commit 2d3f64bf97
3 changed files with 2 additions and 37 deletions

View file

@ -25,32 +25,6 @@
#include "vn_physical_device.h"
#include "vn_queue.h"
struct vn_android_gralloc {
uint64_t front_rendering_usage;
};
static struct vn_android_gralloc _vn_android_gralloc;
static void
vn_android_gralloc_shared_present_usage_init_once()
{
assert(vk_android_get_ugralloc());
int ret = u_gralloc_get_front_rendering_usage(
vk_android_get_ugralloc(), &_vn_android_gralloc.front_rendering_usage);
if (ret == 0)
assert(_vn_android_gralloc.front_rendering_usage);
}
uint64_t
vn_android_gralloc_get_shared_present_usage()
{
static once_flag once = ONCE_FLAG_INIT;
call_once(&once, vn_android_gralloc_shared_present_usage_init_once);
return _vn_android_gralloc.front_rendering_usage;
}
struct vn_android_gralloc_buffer_properties {
uint32_t drm_fourcc;
uint32_t num_planes;
@ -246,7 +220,7 @@ vn_GetSwapchainGrallocUsage2ANDROID(
*grallocProducerUsage |= AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
if (swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID)
*grallocProducerUsage |= vn_android_gralloc_get_shared_present_usage();
*grallocProducerUsage |= vk_android_get_front_buffer_usage();
vn_tls_set_async_pipeline_create();

View file

@ -54,9 +54,6 @@ vn_android_drm_format_to_vk_format(uint32_t format);
uint32_t
vn_android_get_ahb_buffer_memory_type_bits(struct vn_device *dev);
uint64_t
vn_android_gralloc_get_shared_present_usage(void);
#else
static inline VkResult
@ -120,12 +117,6 @@ vn_android_get_ahb_buffer_memory_type_bits(UNUSED struct vn_device *dev)
return 0;
}
static inline uint64_t
vn_android_gralloc_get_shared_present_usage(void)
{
return 0;
}
#endif /* DETECT_OS_ANDROID */
#endif /* VN_ANDROID_H */

View file

@ -840,7 +840,7 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
#if DETECT_OS_ANDROID
/* VK_ANDROID_native_buffer */
if (vn_android_gralloc_get_shared_present_usage())
if (vk_android_get_front_buffer_usage())
props->sharedImage = true;
#endif