summaryrefslogtreecommitdiff
path: root/src/hardwareintegration/compositor/wayland-eglstream-controller
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/hardwareintegration/compositor/wayland-eglstream-controller
parenta3ab80f3463ce4f2e8c973e3f1048cc133fdba35 (diff)
downloadqtwayland-137966a6293b50f6b248d130a2e36e67df49335e.tar.gz
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/hardwareintegration/compositor/wayland-eglstream-controller')
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp20
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
index 8285e18d..6c031aa8 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
@@ -298,7 +298,7 @@ void WaylandEglStreamClientBufferIntegration::attachEglStreamConsumer(struct ::w
d->initEglStream(clientBuffer, wl_buffer);
}
-void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
+bool WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
{
Q_D(WaylandEglStreamClientBufferIntegration);
@@ -307,32 +307,32 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available.");
- return;
+ return false;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window.");
- return;
+ return false;
}
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.");
- return;
+ return false;
}
d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
d->egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));
if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.");
- return;
+ return false;
}
d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.");
- return;
+ return false;
}
if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) {
@@ -340,7 +340,7 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
if (!d->display_bound) {
if (!ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display.");
- return;
+ return false;
} else {
qWarning("QtCompositor: Could not bind Wayland display. Ignoring.");
}
@@ -351,6 +351,12 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
d->funcs = new QEGLStreamConvenience;
d->funcs->initialize(d->egl_display);
+ if (!d->funcs->initialized) {
+ qWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize eglstreams API";
+ return false;
+ }
+
+ return true;
}
QtWayland::ClientBuffer *WaylandEglStreamClientBufferIntegration::createBufferFor(wl_resource *buffer)
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
index 4c4cce25..35d2c80d 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
@@ -44,7 +44,7 @@ public:
WaylandEglStreamClientBufferIntegration();
~WaylandEglStreamClientBufferIntegration() override;
- void initializeHardware(struct ::wl_display *display) override;
+ bool initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;