summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2024-06-12 09:53:47 +0200
committerLaszlo Agocs <[email protected]>2024-06-13 15:43:57 +0200
commit0a10d23c4a49dd14a1ded41b7cc6921909b0ee7a (patch)
treeff3066869bd9da8d24792777061d751bfeaadda6
parentd1d17cf070d156d6200e3642614ccacb702a20d1 (diff)
eglfs: Revive QWidget rendering
After recent changes to widgets and backingstores, attempting to run any widget-based application with eglfs resulted in a crash. The backingstore implementation used here was not fully migrated. Update flush() to create the rendering infrastructure if needed, and make it call into rhiFlush(). Amends eb4cb719257d3b57cd801273d4011579d8c81714 Change-Id: I253c37200f5a902a0e61b62581ac456549f3aeba Pick-to: 6.8 Fixes: QTBUG-126221 Reviewed-by: Tor Arne Vestbø <[email protected]>
-rw-r--r--src/opengl/qopenglcompositorbackingstore.cpp34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/opengl/qopenglcompositorbackingstore.cpp b/src/opengl/qopenglcompositorbackingstore.cpp
index 371ca868f85..052f29d41e6 100644
--- a/src/opengl/qopenglcompositorbackingstore.cpp
+++ b/src/opengl/qopenglcompositorbackingstore.cpp
@@ -134,36 +134,24 @@ void QOpenGLCompositorBackingStore::updateTexture()
}
}
-void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
+void QOpenGLCompositorBackingStore::flush(QWindow *flushedWindow, const QRegion &region, const QPoint &offset)
{
// Called for ordinary raster windows.
- auto *handle = dynamic_cast<QOpenGLCompositorWindow *>(window->handle());
- if (handle && !handle->backingStore())
- handle->setBackingStore(this);
Q_UNUSED(region);
Q_UNUSED(offset);
- m_rhi = rhi(window);
- Q_ASSERT(m_rhi);
-
- QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
- QOpenGLContext *dstCtx = compositor->context();
- if (!dstCtx)
- return;
-
- QWindow *dstWin = compositor->targetWindow();
- if (!dstWin)
- return;
-
- if (!dstCtx->makeCurrent(dstWin))
- return;
-
- updateTexture();
- m_textures->clear();
- m_textures->appendTexture(nullptr, m_bsTextureWrapper, window->geometry());
+ if (!rhi(flushedWindow)) {
+ QPlatformBackingStoreRhiConfig rhiConfig;
+ rhiConfig.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
+ rhiConfig.setEnabled(true);
+ createRhi(flushedWindow, rhiConfig);
+ }
- compositor->update();
+ static QPlatformTextureList emptyTextureList;
+ bool translucentBackground = m_image.hasAlphaChannel();
+ rhiFlush(flushedWindow, flushedWindow->devicePixelRatio(),
+ region, offset, &emptyTextureList, translucentBackground);
}
QPlatformBackingStore::FlushResult QOpenGLCompositorBackingStore::rhiFlush(QWindow *window,