diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-28 03:01:54 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-28 03:01:54 +0200 |
commit | 9db98c7e0a2656988d5c549f0618b2ba882f1fc9 (patch) | |
tree | a65528ce2b2adbf553685bdd99e3c4accecd9291 | |
parent | bd5917025fe7491c9f24e99c20484c7ffce9f172 (diff) | |
parent | 51472970ce519fb39f492238b879d67ad9505f28 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ib0b8d303b86e9a7bee8df45733cd9b5b1b2d666d
6 files changed, 20 insertions, 10 deletions
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp index 90e1f4377..aa0cb58a4 100644 --- a/examples/wayland/custom-extension/client-common/customextension.cpp +++ b/examples/wayland/custom-extension/client-common/customextension.cpp @@ -49,8 +49,6 @@ ****************************************************************************/ #include "customextension.h" -#include <QtWaylandClient/private/qwaylanddisplay_p.h> -#include <QtWaylandClient/private/qwaylandintegration_p.h> #include <QtGui/QGuiApplication> #include <QtGui/QWindow> #include <QtGui/QPlatformSurfaceEvent> diff --git a/examples/wayland/custom-extension/client-common/customextension.h b/examples/wayland/custom-extension/client-common/customextension.h index 5e48ea75e..7a188c3d6 100644 --- a/examples/wayland/custom-extension/client-common/customextension.h +++ b/examples/wayland/custom-extension/client-common/customextension.h @@ -51,9 +51,8 @@ #ifndef CUSTOMEXTENSION_H #define CUSTOMEXTENSION_H -#include <qpa/qwindowsysteminterface.h> -#include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qwaylandclientextension.h> +#include <QtWaylandClient/QWaylandClientExtension> +#include <QtGui/QWindow> #include "qwayland-custom.h" QT_BEGIN_NAMESPACE diff --git a/examples/wayland/custom-extension/compositor/compositor.pro b/examples/wayland/custom-extension/compositor/compositor.pro index b0ff7b2f7..751b5ca3d 100644 --- a/examples/wayland/custom-extension/compositor/compositor.pro +++ b/examples/wayland/custom-extension/compositor/compositor.pro @@ -1,6 +1,6 @@ QT += core gui qml -QT += waylandcompositor-private +QT += waylandcompositor CONFIG += wayland-scanner CONFIG += c++11 diff --git a/examples/wayland/custom-extension/cpp-client/cpp-client.pro b/examples/wayland/custom-extension/cpp-client/cpp-client.pro index b700f2367..388a09bfa 100644 --- a/examples/wayland/custom-extension/cpp-client/cpp-client.pro +++ b/examples/wayland/custom-extension/cpp-client/cpp-client.pro @@ -1,4 +1,4 @@ -QT += waylandclient-private gui-private +QT += waylandclient gui-private CONFIG += wayland-scanner WAYLANDCLIENTSOURCES += ../protocol/custom.xml diff --git a/examples/wayland/custom-extension/qml-client/qml-client.pro b/examples/wayland/custom-extension/qml-client/qml-client.pro index d45067e5a..a8fa420af 100644 --- a/examples/wayland/custom-extension/qml-client/qml-client.pro +++ b/examples/wayland/custom-extension/qml-client/qml-client.pro @@ -1,5 +1,5 @@ TEMPLATE = app -QT += qml quick waylandclient-private +QT += qml quick waylandclient gui-private CONFIG += wayland-scanner WAYLANDCLIENTSOURCES += ../protocol/custom.xml diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 6de664564..2cadf8503 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -180,12 +180,15 @@ public: bool initEglStream(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle); void handleEglstreamTexture(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle); void registerBuffer(struct ::wl_resource *buffer, BufferState state); + void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { orphanedTextures << texture; } + void deleteOrphanedTextures(); EGLDisplay egl_display = EGL_NO_DISPLAY; bool valid = false; bool display_bound = false; QOffscreenSurface *offscreenSurface = nullptr; QOpenGLContext *localContext = nullptr; + QVector<QOpenGLTexture *> orphanedTextures; PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display = nullptr; PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display = nullptr; @@ -376,6 +379,13 @@ void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEgl localContext->doneCurrent(); } +void WaylandEglClientBufferIntegrationPrivate::deleteOrphanedTextures() +{ + Q_ASSERT(QOpenGLContext::currentContext()); + qDeleteAll(orphanedTextures); + orphanedTextures.clear(); +} + WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration() : d_ptr(new WaylandEglClientBufferIntegrationPrivate) { @@ -484,7 +494,7 @@ WaylandEglClientBuffer::~WaylandEglClientBuffer() p->funcs->destroy_stream(p->egl_display, d->egl_stream); for (auto *texture : d->textures) - delete texture; + p->deleteGLTextureWhenPossible(texture); } delete d; } @@ -526,6 +536,10 @@ QWaylandBufferRef::BufferFormatEgl WaylandEglClientBuffer::bufferFormatEgl() con QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane) { + auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration); + // At this point we should have a valid OpenGL context, so it's safe to destroy textures + p->deleteOrphanedTextures(); + if (!m_buffer) return nullptr; @@ -533,7 +547,6 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane) if (d->eglMode == BufferState::ModeEGLStream) return texture; // EGLStreams texture is maintained by handle_eglstream_texture() - auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration); const auto target = static_cast<QOpenGLTexture::Target>(d->egl_format == EGL_TEXTURE_EXTERNAL_WL ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D); if (!texture) { |