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:

committed by
Marge Bot

parent
cd3871e7a4
commit
dd9a426e3e
@@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user