summaryrefslogtreecommitdiffstats
path: root/examples/wayland/multi-screen
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-12-16 09:39:30 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-01-04 08:49:36 +0100
commit3054da0de0429f089b3325ed574a7f097bff68b3 (patch)
treef26803a88d21caad2ac1ce6f7f04cb9e578dc6f5 /examples/wayland/multi-screen
parentfaeb189b9372b9aa6e1a8a50b9c0c7383f9c43d1 (diff)
Fix leak in multi-output compositor examples
When closing windows in e.g. multi-output, you will see warnings that textures are leaking because the current context is not shared with the context owning the texture. The way Qt Wayland Compositor internals are made, they depend on AA_ShareOpenGLContexts to be set, because buffers are consistently referenced across window/context boundaries. Change f1407493d6d25f24a3c71fbcedc00598baa44b56 mentions the requirement on EGLStreams, but this is also required on multi-output compositors to avoid leaks (and possibly sometimes crashes on some drivers). Task-number: QTBUG-87597 Change-Id: Ib0ccc61dee5dbc63704b0af1432fbf69645d39eb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'examples/wayland/multi-screen')
-rw-r--r--examples/wayland/multi-screen/doc/src/multi-screen.qdoc4
-rw-r--r--examples/wayland/multi-screen/main.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
index cd60213b5..5e8e74557 100644
--- a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
+++ b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
@@ -42,4 +42,8 @@
* WaylandQuickItem::setPrimary() is called at appropriate times to set the
* primary view for the ShellSurface, which is used when the client asks to be
* maximized or fullscreen.
+ *
+ * \note In order to support multiple Wayland outputs in the same compositor, the
+ * \l Qt::AA_ShareOpenGLContexts attribute must be set before the \l QGuiApplication
+ * object is constructed.
*/
diff --git a/examples/wayland/multi-screen/main.cpp b/examples/wayland/multi-screen/main.cpp
index 304b13c4a..1edb18c34 100644
--- a/examples/wayland/multi-screen/main.cpp
+++ b/examples/wayland/multi-screen/main.cpp
@@ -57,6 +57,8 @@
int main(int argc, char *argv[])
{
+ // AA_ShareOpenGLContexts is required for compositors with multiple outputs
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QGuiApplication app(argc, argv);
QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));