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
This commit is contained in:
David Edmundson 2021-05-23 21:58:48 +01:00
parent 1e5fae1e91
commit 600c1e0a54

View file

@ -196,6 +196,9 @@ void EglStreamBackend::attachStreamConsumer(KWaylandServer::SurfaceInterface *su
void *eglStream,
wl_array *attribs)
{
if (!m_outputs.isEmpty()) {
makeContextCurrent(m_outputs.first());
}
QVector<EGLAttrib> 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);