From d640b0d71b6910e0c8d0bdb7299fe1cb24b0890b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Wed, 26 Oct 2016 13:54:51 +0300 Subject: egl: set preserved behavior for surface only if config supports it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326 Cc: "12.0 13.0" Reviewed-by: Eric Engestrom Reviewed-by: Chad Versace Tested-by: Mark Janes (cherry picked from commit 2035930966b05a7c4dd1f6559d66b5a3b41e01a5) --- src/egl/main/eglsurface.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/egl/main') diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index 231a5f0..3af337f 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"; -- cgit v1.1