mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
egl: Promote _eglLock/UnlockDisplay to internal API
This reads a bit more cleanly than egl_lock/egl_unlock I think. Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18713>
This commit is contained in:
parent
5e407ec524
commit
1f94f28e8c
4 changed files with 23 additions and 33 deletions
|
|
@ -653,12 +653,9 @@ dri2_add_pbuffer_configs_for_visuals(_EGLDisplay *disp)
|
|||
GLboolean
|
||||
dri2_validate_egl_image(void *image, void *data)
|
||||
{
|
||||
_EGLDisplay *disp = data;
|
||||
_EGLImage *img;
|
||||
|
||||
egl_lock(disp);
|
||||
img = _eglLookupImage(image, disp);
|
||||
egl_unlock(disp);
|
||||
_EGLDisplay *disp = _eglLockDisplay(data);
|
||||
_EGLImage *img = _eglLookupImage(image, disp);
|
||||
_eglUnlockDisplay(disp);
|
||||
|
||||
if (img == NULL) {
|
||||
_eglError(EGL_BAD_PARAMETER, "dri2_validate_egl_image");
|
||||
|
|
|
|||
|
|
@ -212,12 +212,9 @@ static bool
|
|||
wgl_validate_egl_image(struct st_manager *smapi, void *image)
|
||||
{
|
||||
struct wgl_egl_display *wgl_dpy = (struct wgl_egl_display *)smapi;
|
||||
_EGLDisplay *disp = wgl_dpy->parent;
|
||||
_EGLImage *img;
|
||||
|
||||
egl_lock(disp);
|
||||
img = _eglLookupImage(image, disp);
|
||||
egl_unlock(disp);
|
||||
_EGLDisplay *disp = _eglLockDisplay(wgl_dpy->parent);
|
||||
_EGLImage *img = _eglLookupImage(image, disp);
|
||||
_eglUnlockDisplay(disp);
|
||||
|
||||
if (img == NULL) {
|
||||
_eglError(EGL_BAD_PARAMETER, "wgl_validate_egl_image");
|
||||
|
|
|
|||
|
|
@ -275,12 +275,14 @@ _eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg)
|
|||
/**
|
||||
* Lookup and lock a display.
|
||||
*/
|
||||
static inline _EGLDisplay *
|
||||
_EGLDisplay *
|
||||
_eglLockDisplay(EGLDisplay dpy)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
if (disp)
|
||||
egl_lock(disp);
|
||||
if (disp) {
|
||||
u_rwlock_rdlock(&disp->TerminateLock);
|
||||
simple_mtx_lock(&disp->Mutex);
|
||||
}
|
||||
return disp;
|
||||
}
|
||||
|
||||
|
|
@ -288,10 +290,11 @@ _eglLockDisplay(EGLDisplay dpy)
|
|||
/**
|
||||
* Unlock a display.
|
||||
*/
|
||||
static inline void
|
||||
void
|
||||
_eglUnlockDisplay(_EGLDisplay *disp)
|
||||
{
|
||||
egl_unlock(disp);
|
||||
simple_mtx_unlock(&disp->Mutex);
|
||||
u_rwlock_rdunlock(&disp->TerminateLock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1609,8 +1612,7 @@ _eglWaitClientCommon(void)
|
|||
if (!ctx)
|
||||
RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
|
||||
|
||||
disp = ctx->Resource.Display;
|
||||
egl_lock(disp);
|
||||
disp = _eglLockDisplay(ctx->Resource.Display);
|
||||
|
||||
/* let bad current context imply bad current surface */
|
||||
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
||||
|
|
@ -1655,8 +1657,7 @@ eglWaitNative(EGLint engine)
|
|||
|
||||
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL);
|
||||
|
||||
disp = ctx->Resource.Display;
|
||||
egl_lock(disp);
|
||||
disp = _eglLockDisplay(ctx->Resource.Display);
|
||||
|
||||
/* let bad current context imply bad current surface */
|
||||
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
||||
|
|
|
|||
|
|
@ -225,19 +225,14 @@ struct _egl_display
|
|||
EGLGetBlobFuncANDROID BlobCacheGet;
|
||||
};
|
||||
|
||||
static inline void
|
||||
egl_lock(_EGLDisplay *disp)
|
||||
{
|
||||
u_rwlock_rdlock(&disp->TerminateLock);
|
||||
simple_mtx_lock(&disp->Mutex);
|
||||
}
|
||||
|
||||
static inline void
|
||||
egl_unlock(_EGLDisplay *disp)
|
||||
{
|
||||
simple_mtx_unlock(&disp->Mutex);
|
||||
u_rwlock_rdunlock(&disp->TerminateLock);
|
||||
}
|
||||
extern _EGLDisplay *
|
||||
_eglLockDisplay(EGLDisplay dpy);
|
||||
|
||||
|
||||
extern void
|
||||
_eglUnlockDisplay(_EGLDisplay *disp);
|
||||
|
||||
|
||||
extern _EGLPlatformType
|
||||
_eglGetNativePlatform(void *nativeDisplay);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue