From: Adam Jackson Date: Tue, 20 Sep 2022 17:51:00 +0000 (-0400) Subject: egl: Untangle some spaghetti around _eglLookupDisplay X-Git-Tag: upstream/22.3.5~2543 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2ee2de1fb4980a28cc83cff504b0736d4e383bd;p=platform%2Fupstream%2Fmesa.git egl: Untangle some spaghetti around _eglLookupDisplay Only eglapi needs any of this. Reviewed-by: Eric Engestrom Part-of: --- diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 5e3360e..1da7de0 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -273,6 +273,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. */ _EGLDisplay * diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 9d49ec5..39850e3 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -375,26 +375,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 * own the resource. */ diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 532b2a9..2054669 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -255,28 +255,10 @@ _eglCleanupDisplay(_EGLDisplay *disp); extern EGLBoolean -_eglCheckDisplayHandle(EGLDisplay dpy); - - -extern EGLBoolean _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. */ static inline EGLDisplay