From e641022bf9482a11209577b5654cd43231be0755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 17 Jan 2016 22:01:00 +0100 Subject: [PATCH] skip SWAP_BEHAVIOR_PRESERVED for supportsBufferAge pointless and unsupported on latter MESA/DRI3 http://lists.freedesktop.org/archives/mesa-dev/2015-November/100869.html Thanks to Uriy Zhuravlev for reporting and investigation BUG: 356992 FIXED-IN: 5.5.4 --- eglonxbackend.cpp | 4 +++- libkwineffects/kwinglutils.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eglonxbackend.cpp b/eglonxbackend.cpp index f7c9475cc1..f2c81dd5d1 100644 --- a/eglonxbackend.cpp +++ b/eglonxbackend.cpp @@ -91,6 +91,8 @@ EglOnXBackend::~EglOnXBackend() void EglOnXBackend::init() { + initEGL(); // required to toggle + initBufferAge(); // EGL_SWAP_BEHAVIOR_PRESERVED_BIT if (!initRenderingContext()) { setFailed(QStringLiteral("Could not initialize rendering context")); return; @@ -251,7 +253,7 @@ bool EglOnXBackend::initRenderingContext() bool EglOnXBackend::initBufferConfigs() { const EGLint config_attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_SWAP_BEHAVIOR_PRESERVED_BIT, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT | (supportsBufferAge() ? 0 : EGL_SWAP_BEHAVIOR_PRESERVED_BIT), EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 438b785610..8bf62cd89e 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -96,6 +96,8 @@ void initGLX() void initEGL() { EGLDisplay dpy = eglGetCurrentDisplay(); + if (dpy == EGL_NO_DISPLAY) + dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); int major, minor; eglInitialize(dpy, &major, &minor); eglVersion = MAKE_GL_VERSION(major, minor, 0);