summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-08-30 09:31:33 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-09-07 06:24:41 +0000
commit65b7e7e66801b711edf69192a3758677b2710b35 (patch)
tree50baf6d5813cd7b3f9e21fa11a883cbeee415f0f
parent72fd86d7d1b2b1de705bbdcce4193bd19d433f93 (diff)
Fix regression in QWaylandGlContext::makeCurrent for offscreen surfaces
[ChangeLog][QPA plugin] Fixed a bug where offscreen surfaces would get surfaceless EGL contexts. Fixes a regression in in bf09c7a1. The call, window->updateSurface(window->isExposed()), is problematic because offscreen textures are never exposed, and consequently, eglSurface will be EGL_NO_SURFACE, which will then create a surfaceless context in the call: eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context) This reverts to the old behavior of always trying to create an EGL surface, unless the window doesn't have a valid wl_surface, in which case it doesn't make sense (which is what bf09c7a1 fixed, QTBUG-65553). Task-number: QTBUG-70242 Task-number: QTBUG-68605 Task-number: QTBUG-67601 Change-Id: I44b07bb8bf4b33c73c6379a1de8e9e5cfd220b51 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 192b2e8f59e7f0cb3c2d482524bf171a81a213c5)
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp9
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index 20cc8bd9f..e4da26133 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -132,13 +132,16 @@ void QWaylandEglWindow::updateSurface(bool create)
m_resize = true;
}
- } else if (create) {
- m_waylandEglWindow = wl_egl_window_create(object(), sizeWithMargins.width(), sizeWithMargins.height());
+ } else if (create && wl_surface::isInitialized()) {
+ ::wl_surface *wlSurface = wl_surface::object();
+ m_waylandEglWindow = wl_egl_window_create(wlSurface, sizeWithMargins.width(), sizeWithMargins.height());
}
- if (!m_eglSurface && create) {
+ if (!m_eglSurface && m_waylandEglWindow && create) {
EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
+ if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE))
+ qWarning("QtWayland: Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
}
}
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index f4dd6f492..2a9e39ed6 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -407,7 +407,7 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
window->createDecoration();
if (eglSurface == EGL_NO_SURFACE) {
- window->updateSurface(window->isExposed());
+ window->updateSurface(true);
eglSurface = window->eglSurface();
}