Module: Mesa Branch: master Commit: 7d7ae5e1c3451174a3c8dec2d50763a40069fe5b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d7ae5e1c3451174a3c8dec2d50763a40069fe5b
Author: Kyle Brenneman <kbrenne...@nvidia.com> Date: Mon Sep 12 17:04:38 2016 -0400 egl: Use _eglCreateWindowSurfaceCommon consistently This moves the native window fixup to a helper function so we don't repeat ourselves. Reviewed-by: Adam Jackson <a...@redhat.com> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> --- src/egl/main/eglapi.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index df355a5..dd2b4cc 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -762,14 +762,9 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, attrib_list); } - -static EGLSurface EGLAPIENTRY -eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, - void *native_window, - const EGLint *attrib_list) +static void * +fixupNativeWindow(_EGLDisplay *disp, void *native_window) { - _EGLDisplay *disp = _eglLockDisplay(dpy); - #ifdef HAVE_X11_PLATFORM if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) { /* The `native_window` parameter for the X11 platform differs between @@ -779,9 +774,20 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, * `Window*`. Convert `Window*` to `Window` because that's what * dri2_x11_create_window_surface() expects. */ - native_window = (void*) (* (Window*) native_window); + return (void *)(* (Window*) native_window); } #endif + return native_window; +} + +static EGLSurface EGLAPIENTRY +eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, + void *native_window, + const EGLint *attrib_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + + native_window = fixupNativeWindow(disp, native_window); return _eglCreateWindowSurfaceCommon(disp, config, native_window, attrib_list); @@ -793,14 +799,16 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLSurface surface; EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window, - int_attribs); + native_window = fixupNativeWindow(disp, native_window); + surface = _eglCreateWindowSurfaceCommon(disp, config, native_window, + int_attribs); free(int_attribs); return surface; } _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit