egl: Untangle some spaghetti around _eglLookupDisplay
Only eglapi needs any of this. Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18713>
This commit is contained in:
@@ -272,6 +272,27 @@ _eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup a handle to find the linked display.
|
||||||
|
* Return NULL if the handle has no corresponding linked display.
|
||||||
|
*/
|
||||||
|
static _EGLDisplay *
|
||||||
|
_eglLookupDisplay(EGLDisplay dpy)
|
||||||
|
{
|
||||||
|
simple_mtx_lock(_eglGlobal.Mutex);
|
||||||
|
|
||||||
|
_EGLDisplay *cur = _eglGlobal.DisplayList;
|
||||||
|
while (cur) {
|
||||||
|
if (cur == (_EGLDisplay *) dpy)
|
||||||
|
break;
|
||||||
|
cur = cur->Next;
|
||||||
|
}
|
||||||
|
simple_mtx_unlock(_eglGlobal.Mutex);
|
||||||
|
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup and lock a display.
|
* Lookup and lock a display.
|
||||||
*/
|
*/
|
||||||
|
@@ -374,26 +374,6 @@ _eglCleanupDisplay(_EGLDisplay *disp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return EGL_TRUE if the given handle is a valid handle to a display.
|
|
||||||
*/
|
|
||||||
EGLBoolean
|
|
||||||
_eglCheckDisplayHandle(EGLDisplay dpy)
|
|
||||||
{
|
|
||||||
_EGLDisplay *cur;
|
|
||||||
|
|
||||||
simple_mtx_lock(_eglGlobal.Mutex);
|
|
||||||
cur = _eglGlobal.DisplayList;
|
|
||||||
while (cur) {
|
|
||||||
if (cur == (_EGLDisplay *) dpy)
|
|
||||||
break;
|
|
||||||
cur = cur->Next;
|
|
||||||
}
|
|
||||||
simple_mtx_unlock(_eglGlobal.Mutex);
|
|
||||||
return (cur != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return EGL_TRUE if the given resource is valid. That is, the display does
|
* Return EGL_TRUE if the given resource is valid. That is, the display does
|
||||||
* own the resource.
|
* own the resource.
|
||||||
|
@@ -254,28 +254,10 @@ extern void
|
|||||||
_eglCleanupDisplay(_EGLDisplay *disp);
|
_eglCleanupDisplay(_EGLDisplay *disp);
|
||||||
|
|
||||||
|
|
||||||
extern EGLBoolean
|
|
||||||
_eglCheckDisplayHandle(EGLDisplay dpy);
|
|
||||||
|
|
||||||
|
|
||||||
extern EGLBoolean
|
extern EGLBoolean
|
||||||
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *disp);
|
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *disp);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lookup a handle to find the linked display.
|
|
||||||
* Return NULL if the handle has no corresponding linked display.
|
|
||||||
*/
|
|
||||||
static inline _EGLDisplay *
|
|
||||||
_eglLookupDisplay(EGLDisplay dpy)
|
|
||||||
{
|
|
||||||
_EGLDisplay *disp = (_EGLDisplay *) dpy;
|
|
||||||
if (!_eglCheckDisplayHandle(dpy))
|
|
||||||
disp = NULL;
|
|
||||||
return disp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the handle of a linked display, or EGL_NO_DISPLAY.
|
* Return the handle of a linked display, or EGL_NO_DISPLAY.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user