From 600c1e0a543554eb44d79e526873c6ebbfcecb72 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 23 May 2021 21:58:48 +0100 Subject: [PATCH] platforms/drm: Make context current before EGLStreams calls attachStreamConsumer and resetOutput are not called as part of the scene render and as such the context might not be set. All credit goes to Simon Spinner for his investigation. BUG: 437573 --- src/plugins/platforms/drm/egl_stream_backend.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/drm/egl_stream_backend.cpp b/src/plugins/platforms/drm/egl_stream_backend.cpp index 80a9e52b8f..5db02a270a 100644 --- a/src/plugins/platforms/drm/egl_stream_backend.cpp +++ b/src/plugins/platforms/drm/egl_stream_backend.cpp @@ -196,6 +196,9 @@ void EglStreamBackend::attachStreamConsumer(KWaylandServer::SurfaceInterface *su void *eglStream, wl_array *attribs) { + if (!m_outputs.isEmpty()) { + makeContextCurrent(m_outputs.first()); + } QVector streamAttribs; streamAttribs << EGL_WAYLAND_EGLSTREAM_WL << (EGLAttrib)eglStream; EGLAttrib *attribArray = (EGLAttrib *)attribs->data; @@ -224,6 +227,9 @@ void EglStreamBackend::attachStreamConsumer(KWaylandServer::SurfaceInterface *su connect(surface, &KWaylandServer::SurfaceInterface::destroyed, this, [surface, this]() { + if (!m_outputs.isEmpty()) { + makeContextCurrent(m_outputs.first()); + } const StreamTexture &st = m_streamTextures.take(surface); pEglDestroyStreamKHR(eglDisplay(), st.stream); glDeleteTextures(1, &st.texture);