summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandcompositor.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-22 13:41:49 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-25 14:45:15 +0200
commit137966a6293b50f6b248d130a2e36e67df49335e (patch)
treeba1b77a36dce68cb0748b855a2c94e685f8a7243 /src/compositor/compositor_api/qwaylandcompositor.cpp
parenta3ab80f3463ce4f2e8c973e3f1048cc133fdba35 (diff)
Compositor: Warn and clean up when client hardware buffer integrations fail
We've recently seen a number of performance issues on bugreports and on the mailing list. The problem in many of these cases, is that no client hardware buffer plugin is used. I.e. it's just due to our fallback to CPU buffers when the compositor is configured incorrectly or run in a setup where hardware buffers are not available. This patch detects when client hardware buffer plugins fail and prints a warning explaining the issue to the console. This will make it easier to differentiate between expected and unexpected drops in performance and will hopefully also guide users in the right direction to fix their setup (set the right environment variables and perhaps recompile Qt with a supported OpenGL version). QtWayland::ClientBufferIntegration now returns a bool indicating success or failure. The integration is now destroyed immediately if it failed, instead of leaving it lying around until the compositor shuts down. There has been some slight changes in the xcomposite plugins as well, turning some qFatals into qCWarnings and failing more softly (with the warning mentioned above). Task-number: QTBUG-78483 Change-Id: I55293dbb3cf72768f3982c075fcf63e79329ada1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandcompositor.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 7c3750207..52a6614bc 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -366,8 +366,6 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration()
loadClientBufferIntegration();
loadServerBufferIntegration();
- if (client_buffer_integration)
- client_buffer_integration->initializeHardware(display);
if (server_buffer_integration)
server_buffer_integration->initializeHardware(q);
#endif
@@ -399,12 +397,32 @@ void QWaylandCompositorPrivate::loadClientBufferIntegration()
if (!targetKey.isEmpty()) {
client_buffer_integration.reset(QtWayland::ClientBufferIntegrationFactory::create(targetKey, QStringList()));
if (client_buffer_integration) {
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Loaded client buffer integration:" << targetKey;
client_buffer_integration->setCompositor(q);
- if (hw_integration)
- hw_integration->setClientBufferIntegration(targetKey);
+ if (!client_buffer_integration->initializeHardware(display)) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize hardware for client buffer integration:" << targetKey;
+ client_buffer_integration.reset();
+ }
+ } else {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to load client buffer integration:" << targetKey;
}
}
- //BUG: if there is no client buffer integration, bad things will happen when opengl is used
+
+ if (!client_buffer_integration) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "No client buffer integration was loaded, this means that clients will fall back"
+ << "to use CPU buffers (wl_shm) for transmitting buffers instead of using zero-copy"
+ << "GPU buffer handles. Expect serious performance impact with OpenGL clients due"
+ << "to potentially multiple copies between CPU and GPU memory per buffer.\n"
+ << "See the QtWayland readme for more info about how to build and configure Qt for"
+ << "your device.";
+ return;
+ }
+
+ if (client_buffer_integration && hw_integration)
+ hw_integration->setClientBufferIntegration(targetKey);
#endif
}