mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 06:30:11 +01:00
vulkan/android: update helper to initialize u_gralloc once
Initialize u_gralloc once upon the initial init or get call. We'll skip updating the backend drivers for this since most usages will be cleaned up later. Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35561>
This commit is contained in:
parent
6c284cd534
commit
0c141ef492
1 changed files with 10 additions and 4 deletions
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "vk_enum_defines.h"
|
||||
|
||||
#include "c11/threads.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "util/libsync.h"
|
||||
#include "util/os_file.h"
|
||||
|
|
@ -50,24 +51,29 @@
|
|||
|
||||
static struct u_gralloc *_gralloc;
|
||||
|
||||
static void
|
||||
vk_android_init_ugralloc_once(void)
|
||||
{
|
||||
_gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
|
||||
}
|
||||
|
||||
struct u_gralloc *
|
||||
vk_android_get_ugralloc(void)
|
||||
{
|
||||
static once_flag once = ONCE_FLAG_INIT;
|
||||
call_once(&once, vk_android_init_ugralloc_once);
|
||||
return _gralloc;
|
||||
}
|
||||
|
||||
struct u_gralloc *
|
||||
vk_android_init_ugralloc(void)
|
||||
{
|
||||
_gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
|
||||
|
||||
return _gralloc;
|
||||
return vk_android_get_ugralloc();
|
||||
}
|
||||
|
||||
void
|
||||
vk_android_destroy_ugralloc(void)
|
||||
{
|
||||
u_gralloc_destroy(&_gralloc);
|
||||
}
|
||||
|
||||
/* If any bits in test_mask are set, then unset them and return true. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue