[Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 13 14:39:17 UTC 2016


On 12 September 2016 at 23:19, Adam Jackson <ajax at redhat.com> wrote:
> From: Kyle Brenneman <kbrenneman at nvidia.com>
>
> ---
>  src/egl/main/eglapi.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 658d0d7..dc61d5f 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1384,11 +1384,10 @@ eglDestroyImage(EGLDisplay dpy, EGLImage image)
>
>
>  static EGLSync
> -_eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list,
> +_eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLint *attrib_list,
>                 const EGLAttrib *attrib_list64, EGLBoolean is64,
>                 EGLenum invalid_type_error)
>  {
> -   _EGLDisplay *disp = _eglLockDisplay(dpy);
>     _EGLContext *ctx = _eglGetCurrentContext();
>     _EGLDriver *drv;
>     _EGLSync *sync;
> @@ -1400,7 +1399,7 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list,
>        RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
>
>     /* return an error if the client API doesn't support GL_OES_EGL_sync */
> -   if (!ctx || ctx->Resource.Display != dpy ||
> +   if (!ctx || ctx->Resource.Display != disp ||
>         ctx->ClientAPI != EGL_OPENGL_ES_API)
>        RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
>
> @@ -1431,7 +1430,8 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list,
>  static EGLSync EGLAPIENTRY
>  eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
>  {
> -   return _eglCreateSync(dpy, type, attrib_list, NULL, EGL_FALSE,
> +   _EGLDisplay *disp = _eglLockDisplay(dpy);
(Feel free to ignore) nitpick:
Add blank line after the variable declaration.

(More important) note:
Keeping the _eglLockDisplay() in the top level (EGL API) while the
unlock in the lower level (fooCommon) will come to bite us. We could
update the RETURN_EGL_ERROR and co + all the call sites yet it's not
something we have to do atm.

-Emil


More information about the mesa-dev mailing list