mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
egl/dri2: Use util_call_once_data to replace usage of mtx_t glFlushMutex
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
This commit is contained in:
parent
56a34d1568
commit
86290c81b2
1 changed files with 10 additions and 5 deletions
|
|
@ -65,6 +65,7 @@
|
|||
#include "util/libsync.h"
|
||||
#include "util/os_file.h"
|
||||
#include "util/u_atomic.h"
|
||||
#include "util/u_call_once.h"
|
||||
#include "util/u_vector.h"
|
||||
#include "mapi/glapi/glapi.h"
|
||||
#include "util/bitscan.h"
|
||||
|
|
@ -132,16 +133,20 @@ dri_set_background_context(void *loaderPrivate)
|
|||
_eglBindContextToThread(ctx, t);
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_gl_flush_get(_glapi_proc *glFlush)
|
||||
{
|
||||
*glFlush = _glapi_get_proc_address("glFlush");
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_gl_flush()
|
||||
{
|
||||
static void (*glFlush)(void);
|
||||
static mtx_t glFlushMutex = _MTX_INITIALIZER_NP;
|
||||
static util_once_flag once = UTIL_ONCE_FLAG_INIT;
|
||||
|
||||
mtx_lock(&glFlushMutex);
|
||||
if (!glFlush)
|
||||
glFlush = _glapi_get_proc_address("glFlush");
|
||||
mtx_unlock(&glFlushMutex);
|
||||
util_call_once_data(&once,
|
||||
(util_call_once_data_func)dri2_gl_flush_get, &glFlush);
|
||||
|
||||
/* if glFlush is not available things are horribly broken */
|
||||
if (!glFlush) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue