[Mesa-dev] [PATCH] egl: set preserved behavior for surface only if config supports it

Eric Engestrom eric.engestrom at imgtec.com
Wed Oct 26 13:02:06 UTC 2016


On Wednesday, 2016-10-26 13:54:51 +0300, Tapani Pälli wrote:
> Otherwise we can end up with mismatching behavior between config and
> surface when client queries surface attributes. As example, configs
> for DRI3 do not support preserved behavior but here we were setting
> preserved behavior for pixmap and pbuffer.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326
> Cc: "12.0 13.0" <mesa-stable at lists.freedesktop.org>

Fixes: a5ab46909e9475da0eb8 ("egl: make pixmaps and pbuffers
                              EGL_BUFFER_PRESERVED")
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> ---
>  src/egl/main/eglsurface.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
> index eb0bdfe..8e56919 100644
> --- a/src/egl/main/eglsurface.c
> +++ b/src/egl/main/eglsurface.c
> @@ -262,9 +262,13 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
>  {
>     const char *func;
>     EGLint renderBuffer = EGL_BACK_BUFFER;
> -   EGLint swapBehavior = EGL_BUFFER_PRESERVED;
> +   EGLint swapBehavior = EGL_BUFFER_DESTROYED;
>     EGLint err;
>  
> +   /* Swap behavior can be preserved only if config supports this. */
> +   if (conf->SurfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)
> +      swapBehavior = EGL_BUFFER_PRESERVED;
> +
>     switch (type) {
>     case EGL_WINDOW_BIT:
>        func = "eglCreateWindowSurface";
> -- 
> 2.7.4
> 


More information about the mesa-dev mailing list