diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-01-27 11:53:25 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-01-29 15:51:08 +0000 |
commit | 09e8d69b7a5c6f394b6a43f6c485d26f74189541 (patch) | |
tree | 9f948f25f08bd2044cfb0dd00b9e029090159568 /src/platformsupport | |
parent | 6774edcef0f9f34d41d1156f6c9748f6d9a18930 (diff) |
eglfs: Sanitize the widget compositor's context handling
createPlatformOpenGLContext() used to silently set the widget
compositor's context as the context to share resources with.
This works mostly, but is the wrong level to enforce the resource
sharing. For example, QOpenGLContext::shareGroup() becomes
inconsistent since from QOpenGLContext's view there was no
shareContext specified.
The inability to test via shareGroup() is the reason eglfs started to
show warnings when exiting applications. The resource sharing was in
place on EGL level but QOpenGLContext knew nothing about it.
Therefore, let's switch over to the way other components, f.ex. Web
Engine use: set the internal global share context pointer to the
widget compositor's context. This way everything remains consistent:
the widget compositor's context is stored upon creating the main
QEGLFSWindow, QWidget::shareContext() picks this up then, and as a
result we have sharing set up on QOpenGLContext's level instead of
sneaking it in in the QPlatformOpenGLContext implementation.
Task-number: QTBUG-50707
Change-Id: I5fc1dec58c69c46aa83c7b4cab1eadce6fa633ce
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/platformcompositor/qopenglcompositor.cpp | 2 | ||||
-rw-r--r-- | src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/platformsupport/platformcompositor/qopenglcompositor.cpp b/src/platformsupport/platformcompositor/qopenglcompositor.cpp index 2e386532e2..7e0973040a 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositor.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositor.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE It is up to the platform plugin to manage the lifetime of the compositor (instance(), destroy()), set the correct destination - context and window as early as possible (setTargetWindow()), + context and window as early as possible (setTarget()), register the composited windows as they are shown, activated, raised and lowered (addWindow(), moveToTop(), etc.), and to schedule repaints (update()). diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index 07a1e77c3a..83b551557f 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -184,6 +184,8 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion ®ion QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); QOpenGLContext *dstCtx = compositor->context(); + Q_ASSERT(dstCtx); + QWindow *dstWin = compositor->targetWindow(); if (!dstWin) return; @@ -209,6 +211,12 @@ void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegi QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); QOpenGLContext *dstCtx = compositor->context(); + Q_ASSERT(dstCtx); // setTarget() must have been called before, e.g. from QEGLFSWindow + + // The compositor's context and the context to which QOpenGLWidget/QQuickWidget + // textures belong are not the same. They share resources, though. + Q_ASSERT(context->shareGroup() == dstCtx->shareGroup()); + QWindow *dstWin = compositor->targetWindow(); if (!dstWin) return; |