diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-04-21 08:46:43 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-05-03 06:46:50 +0200 |
commit | 6d8e7567d7d1737c240cfca4402bf6ec5a67b02e (patch) | |
tree | dabeabdcaaee30525194b267f51384cf27c83103 /src/hardwareintegration/compositor/wayland-eglstream-controller | |
parent | e58eb814c84d506b47469d000b4913b6d3d61dc2 (diff) | |
download | qtwayland-6d8e7567d7d1737c240cfca4402bf6ec5a67b02e.tar.gz |
Allow multiple client buffer integrations to initialize
This amends 585f20dce37c398d8b2e6367008e3329dac79e24 where
support for multiple client buffer integrations was added.
Previously, this would not work unless you also set
QT_WAYLAND_IGNORE_BIND_DISPLAY in the environment, because
we would fail if eglBindWaylandDisplayWL() returned false,
which it will when the display is already bound.
Instead, we assume the display is correctly bound when the
function returns false, and then we make sure we unbind from
the same integration that originally did the bind.
The patch adds unbind to the destructor of linux-dmabuf and
eglstream integrations. This was previously missing.
[ChangeLog][QtWaylandCompositor] Enabled support for multiple
client buffer integrations without the need to set the
QT_WAYLAND_IGNORE_BIND_DISPLAY environment variable.
Fixes: QTBUG-101366
Change-Id: Iefeb865b540d96a55d3be9b9c1fb41bf388638ca
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.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp index 9bdf8eb5..f4feb2e9 100644 --- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp @@ -155,6 +155,7 @@ public: EGLDisplay egl_display = EGL_NO_DISPLAY; bool display_bound = false; + ::wl_display *wlDisplay = nullptr; QOffscreenSurface *offscreenSurface = nullptr; QOpenGLContext *localContext = nullptr; QList<QOpenGLTexture *> orphanedTextures; @@ -282,7 +283,13 @@ WaylandEglStreamClientBufferIntegration::WaylandEglStreamClientBufferIntegration WaylandEglStreamClientBufferIntegration::~WaylandEglStreamClientBufferIntegration() { + Q_D(WaylandEglStreamClientBufferIntegration); WaylandEglStreamClientBufferIntegrationPrivate::shuttingDown = true; + if (d->egl_unbind_wayland_display != nullptr && d->display_bound) { + Q_ASSERT(d->wlDisplay != nullptr); + if (!d->egl_unbind_wayland_display(d->egl_display, d->wlDisplay)) + qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed"; + } } void WaylandEglStreamClientBufferIntegration::attachEglStreamConsumer(struct ::wl_resource *wl_surface, struct ::wl_resource *wl_buffer) @@ -336,14 +343,10 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) { d->display_bound = d->egl_bind_wayland_display(d->egl_display, display); - if (!d->display_bound) { - if (!ignoreBindDisplay) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display."); - return; - } else { - qWarning("QtCompositor: Could not bind Wayland display. Ignoring."); - } - } + if (!d->display_bound) + qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration."; + + d->wlDisplay = display; } d->eglStreamController = new WaylandEglStreamController(display, this); |