[Mesa-dev] [PATCH 08/14] egl: Factor out _eglCreateImageCommon
Kyle Brenneman
kbrenneman at nvidia.com
Tue Sep 13 17:06:50 UTC 2016
On 09/12/2016 04:19 PM, Adam Jackson wrote:
> From: Kyle Brenneman <kbrenneman at nvidia.com>
>
> ---
> src/egl/main/eglapi.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index a74e5e4..658d0d7 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1309,11 +1309,10 @@ eglReleaseThread(void)
> }
>
>
> -static EGLImage EGLAPIENTRY
> -eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
> +static EGLImage
> +_eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target,
> EGLClientBuffer buffer, const EGLint *attr_list)
> {
> - _EGLDisplay *disp = _eglLockDisplay(dpy);
> _EGLContext *context = _eglLookupContext(ctx, disp);
> _EGLDriver *drv;
> _EGLImage *img;
> @@ -1337,18 +1336,27 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
> RETURN_EGL_EVAL(disp, ret);
> }
>
> +static EGLImage EGLAPIENTRY
> +eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
> + EGLClientBuffer buffer, const EGLint *attr_list)
> +{
> + _EGLDisplay *disp = _eglLockDisplay(dpy);
> + return _eglCreateImageCommon(disp, ctx, target, buffer, attr_list);
> +}
> +
>
> EGLImage EGLAPIENTRY
> eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target,
> EGLClientBuffer buffer, const EGLAttrib *attr_list)
> {
> + _EGLDisplay *disp = _eglLockDisplay(dpy);
> EGLImage image;
> EGLint *int_attribs = _eglConvertAttribsToInt(attr_list);
>
> if (attr_list && !int_attribs)
> RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_IMAGE);
The RETURN_EGL_ERROR macro here should take the disp pointer so that it
unlocks the display before returning.
>
> - image = eglCreateImageKHR(dpy, ctx, target, buffer, int_attribs);
> + image = _eglCreateImageCommon(disp, ctx, target, buffer, int_attribs);
> free(int_attribs);
> return image;
> }
More information about the mesa-dev
mailing list