mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 00:49:04 +02:00
vulkan/android: Add basic u_gralloc support
We want to move more Android-related functions into common code.
Many of which require interactions with the gralloc. Therefore,
struct u_gralloc must be kept in a common code.
vk_android_get_ugralloc() must be used for gralloc API calls.
vk_android_{init|destroy}_ugralloc() must be used in Vulkan HAL
initialization code, e.g.:
- In XXXX_hal_open() to initialize the gralloc
- In XXXX_hal_close() to destroy the gralloc
We do not put gralloc initialization into the generic code because we want
it to be initialized by Zygote's Vulkan preloader, which may sometimes
preload gralloc shared libraries, thus speeding up the initialization
of user applications.
Change-Id: I2af643bd132e6cdbfed043c8c18836501764952f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Tested-by: tarsin <yuanqingxiang233@163.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25360>
This commit is contained in:
parent
cd3871e7a4
commit
dd9a426e3e
2 changed files with 47 additions and 0 deletions
|
|
@ -40,6 +40,28 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
static struct u_gralloc *u_gralloc;
|
||||
|
||||
struct u_gralloc *
|
||||
vk_android_get_ugralloc(void)
|
||||
{
|
||||
return u_gralloc;
|
||||
}
|
||||
|
||||
struct u_gralloc *
|
||||
vk_android_init_ugralloc(void)
|
||||
{
|
||||
u_gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
|
||||
|
||||
return u_gralloc;
|
||||
}
|
||||
|
||||
void
|
||||
vk_android_destroy_ugralloc(void)
|
||||
{
|
||||
u_gralloc_destroy(&u_gralloc);
|
||||
}
|
||||
|
||||
#if ANDROID_API_LEVEL >= 26
|
||||
#include <vndk/hardware_buffer.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,31 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct u_gralloc;
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
struct u_gralloc *vk_android_get_ugralloc(void);
|
||||
struct u_gralloc *vk_android_init_ugralloc(void);
|
||||
void vk_android_destroy_ugralloc(void);
|
||||
#else
|
||||
static inline struct u_gralloc *
|
||||
vk_android_get_ugralloc(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct u_gralloc *
|
||||
vk_android_init_ugralloc(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
vk_android_destroy_ugralloc(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||
|
||||
VkFormat vk_ahb_format_to_image_format(uint32_t ahb_format);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue