diff options
3 files changed, 14 insertions, 4 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp index ccacf5739..8f3ce0936 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp @@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { static const char *qwaylandegl_threadedgl_blacklist_vendor[] = { - "Mesa Project", 0 }; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index a062a2f98..18ed1d61e 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -260,21 +260,22 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis switch (m_format.renderableType()) { case QSurfaceFormat::OpenVG: - eglBindAPI(EGL_OPENVG_API); + m_api = EGL_OPENVG_API; break; #ifdef EGL_VERSION_1_4 # if !defined(QT_OPENGL_ES_2) case QSurfaceFormat::DefaultRenderableType: # endif case QSurfaceFormat::OpenGL: - eglBindAPI(EGL_OPENGL_API); + m_api = EGL_OPENGL_API; break; #endif case QSurfaceFormat::OpenGLES: default: - eglBindAPI(EGL_OPENGL_ES_API); + m_api = EGL_OPENGL_ES_API; break; } + eglBindAPI(m_api); m_context = eglCreateContext(m_eglDisplay, m_config, m_shareEGLContext, eglContextAttrs.constData()); @@ -358,6 +359,15 @@ QWaylandGLContext::~QWaylandGLContext() bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) { + // in QWaylandGLContext() we called eglBindAPI with the correct value. However, + // eglBindAPI's documentation says: + // "eglBindAPI defines the current rendering API for EGL in the thread it is called from" + // Since makeCurrent() can be called from a different thread than the one we created the + // context in make sure to call eglBindAPI in the correct thread. + if (eglQueryAPI() != m_api) { + eglBindAPI(m_api); + } + QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface); EGLSurface eglSurface = window->eglSurface(); diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h index 1c2db8aaf..bc92c9501 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h @@ -85,6 +85,7 @@ private: QSurfaceFormat m_format; DecorationsBlitter *m_blitter; bool mUseNativeDefaultFbo; + uint m_api; friend class DecorationsBlitter; }; |