summaryrefslogtreecommitdiffstats
path: root/src/compositor/hardware_integration
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/hardware_integration')
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri19
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration.cpp40
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration_p.h46
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration.cpp56
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration_p.h49
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration.cpp43
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration_p.h60
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwltextureorphanage.cpp108
-rw-r--r--src/compositor/hardware_integration/qwltextureorphanage_p.h64
23 files changed, 301 insertions, 911 deletions
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index 6bf7a75b5..bb21e3d8b 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -1,11 +1,17 @@
-qtConfig(opengl) {
- CONFIG += wayland-scanner
- WAYLANDSERVERSOURCES += \
- ../extensions/server-buffer-extension.xml \
- ../extensions/hardware-integration.xml \
+CONFIG += wayland-scanner
+WAYLANDSERVERSOURCES += \
+ ../extensions/server-buffer-extension.xml \
+ ../extensions/hardware-integration.xml \
+
+HEADERS += \
+ hardware_integration/qwlclientbufferintegration_p.h \
+
+SOURCES += \
+ hardware_integration/qwlclientbufferintegration.cpp \
+
+qtConfig(opengl) {
HEADERS += \
- hardware_integration/qwlclientbufferintegration_p.h \
hardware_integration/qwlclientbufferintegrationfactory_p.h \
hardware_integration/qwlclientbufferintegrationplugin_p.h \
hardware_integration/qwlserverbufferintegration_p.h \
@@ -17,7 +23,6 @@ qtConfig(opengl) {
hardware_integration/qwlhardwarelayerintegrationplugin_p.h \
SOURCES += \
- hardware_integration/qwlclientbufferintegration.cpp \
hardware_integration/qwlclientbufferintegrationfactory.cpp \
hardware_integration/qwlclientbufferintegrationplugin.cpp \
hardware_integration/qwlserverbufferintegration.cpp \
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
index 7407aca58..db2ebe401 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegration_p.h"
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
index 13a69fce9..5f9247d6a 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H
#define QWAYLANDCLIENTBUFFERINTEGRATION_H
@@ -55,7 +19,8 @@
#include <QtWaylandCompositor/qwaylandsurface.h>
#include <QtWaylandCompositor/qwaylandbufferref.h>
#include <QtCore/QSize>
-#include <wayland-server.h>
+#include <QtCore/private/qglobal_p.h>
+#include <wayland-server-core.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QOpenGLTexture;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegration
{
public:
ClientBufferIntegration();
@@ -77,6 +42,7 @@ public:
virtual void initializeHardware(struct ::wl_display *display) = 0;
virtual ClientBuffer *createBufferFor(struct ::wl_resource *buffer) = 0;
+ virtual bool isProtected(struct ::wl_resource *buffer) { Q_UNUSED(buffer); return false; }
protected:
QWaylandCompositor *m_compositor = nullptr;
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
index 68c8ac4c6..c85cba80f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegrationfactory_p.h"
#include "qwlclientbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwbifiLoader,
(QtWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList ClientBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList ClientBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwbifiLoader->keyMap().values();
}
-ClientBufferIntegration *ClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+ClientBufferIntegration *ClientBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (ClientBufferIntegration *ret = qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (ClientBufferIntegration *ret = qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(qwbifiLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
index b03b80578..7d08e25c0 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class ClientBufferIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static ClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static ClientBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
index 5ee647752..8c3ad8e4f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegrationplugin_p.h"
@@ -55,3 +19,5 @@ ClientBufferIntegrationPlugin::~ClientBufferIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwlclientbufferintegrationplugin_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
index e50d25193..aa6b0f2e6 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class ClientBufferIntegration;
#define QtWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandCompositor.QtWaylandClientBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
index 76cf0990a..6b6fefe24 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegration_p.h"
@@ -46,3 +10,5 @@ namespace QtWayland {
}
QT_END_NAMESPACE
+
+#include "moc_qwlhardwarelayerintegration_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
index 1e5fb1a1b..18ede78a6 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATION_H
#define QWAYLANDHARDWARELAYERINTEGRATION_H
@@ -54,6 +18,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QObject>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -63,7 +28,7 @@ class QWaylandQuickHardwareLayer;
namespace QtWayland {
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegration : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegration : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
index 4b85be820..01c0c95a0 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegrationfactory_p.h"
#include "qwlhardwarelayerintegrationplugin_p.h"
@@ -49,49 +13,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwhlifLoader,
(QtWaylandHardwareLayerIntegrationFactoryInterface_iid, QLatin1String("/wayland-hardware-layer-integration"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandHardwareLayerIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList HardwareLayerIntegrationFactory::keys(const QString &pluginPath)
+QStringList HardwareLayerIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwhlifLoader->keyMap().values();
}
-HardwareLayerIntegration *HardwareLayerIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+HardwareLayerIntegration *HardwareLayerIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (HardwareLayerIntegration *ret = qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (HardwareLayerIntegration *ret = qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(qwhlifLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
index 83c9c523b..c24c712f7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
#define QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class HardwareLayerIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static HardwareLayerIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static HardwareLayerIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
index 0ae3a0b6a..541b20de7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegrationplugin_p.h"
@@ -55,3 +19,5 @@ HardwareLayerIntegrationPlugin::~HardwareLayerIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwlhardwarelayerintegrationplugin_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
index acf80fe33..ce5e1e9a2 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
#define QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class HardwareLayerIntegration;
#define QtWaylandHardwareLayerIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QtWaylandHardwareLayerIntegrationFactoryInterface.5.11"
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhwintegration.cpp b/src/compositor/hardware_integration/qwlhwintegration.cpp
index b6650fcf7..9882dc280 100644
--- a/src/compositor/hardware_integration/qwlhwintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhwintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhwintegration_p.h"
@@ -51,21 +15,21 @@ HardwareIntegration::HardwareIntegration(QWaylandCompositor *compositor)
{
}
-void HardwareIntegration::setClientBufferIntegration(const QString &name)
+void HardwareIntegration::setClientBufferIntegrationName(const QString &name)
{
- m_client_buffer_integration = name;
+ m_client_buffer_integration_name = name;
}
-void HardwareIntegration::setServerBufferIntegration(const QString &name)
+void HardwareIntegration::setServerBufferIntegrationName(const QString &name)
{
- m_server_buffer_integration = name;
+ m_server_buffer_integration_name = name;
}
void HardwareIntegration::hardware_integration_bind_resource(Resource *resource)
{
- if (m_client_buffer_integration.size())
- send_client_backend(resource->handle, m_client_buffer_integration);
- if (m_server_buffer_integration.size())
- send_server_backend(resource->handle, m_server_buffer_integration);
+ if (!m_client_buffer_integration_name.isEmpty())
+ send_client_backend(resource->handle, m_client_buffer_integration_name);
+ if (!m_server_buffer_integration_name.isEmpty())
+ send_server_backend(resource->handle, m_server_buffer_integration_name);
}
}
diff --git a/src/compositor/hardware_integration/qwlhwintegration_p.h b/src/compositor/hardware_integration/qwlhwintegration_p.h
index f3e486a4a..bc8ffd227 100644
--- a/src/compositor/hardware_integration/qwlhwintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhwintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLHWINTEGRATION_P_H
#define QWLHWINTEGRATION_P_H
@@ -56,6 +20,7 @@
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtCore/QString>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -68,15 +33,15 @@ class HardwareIntegration : public QWaylandCompositorExtensionTemplate<HardwareI
public:
HardwareIntegration(QWaylandCompositor *compositor);
- void setClientBufferIntegration(const QString &name);
- void setServerBufferIntegration(const QString &name);
+ void setClientBufferIntegrationName(const QString &name);
+ void setServerBufferIntegrationName(const QString &name);
protected:
void hardware_integration_bind_resource(Resource *resource) override;
private:
- QString m_client_buffer_integration;
- QString m_server_buffer_integration;
+ QString m_client_buffer_integration_name;
+ QString m_server_buffer_integration_name;
};
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
index 657a4bff5..e08af0206 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegration_p.h"
@@ -68,9 +32,10 @@ ServerBufferIntegration::ServerBufferIntegration()
ServerBufferIntegration::~ServerBufferIntegration()
{ }
-void ServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool ServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_UNUSED(compositor);
+ return true;
}
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
index 7d8901d58..92bbdee4d 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H
#define QWAYLANDSERVERBUFFERINTEGRATION_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/QSize>
#include <QtGui/qopengl.h>
@@ -70,12 +34,13 @@ class QImage;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBuffer
{
public:
enum Format {
RGBA32,
- A8
+ A8,
+ Custom
};
ServerBuffer(const QSize &size, ServerBuffer::Format format);
@@ -85,6 +50,7 @@ public:
virtual bool bufferInUse() { return true; }
virtual QOpenGLTexture *toOpenGlTexture() = 0;
+ virtual void releaseOpenGlTexture() {}
virtual bool isYInverted() const;
@@ -95,16 +61,24 @@ protected:
Format m_format;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegration
{
public:
ServerBufferIntegration();
virtual ~ServerBufferIntegration();
- virtual void initializeHardware(QWaylandCompositor *);
+ virtual bool initializeHardware(QWaylandCompositor *);
virtual bool supportsFormat(ServerBuffer::Format format) const = 0;
virtual ServerBuffer *createServerBufferFromImage(const QImage &qimage, ServerBuffer::Format format) = 0;
+ virtual ServerBuffer *createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat)
+ {
+ Q_UNUSED(view);
+ Q_UNUSED(size);
+ Q_UNUSED(glInternalFormat);
+ return nullptr;
+ }
};
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
index 2b60de5eb..a92c3f35e 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegrationfactory_p.h"
#include "qwlserverbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsbifLoader,
(QtWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList ServerBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList ServerBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwsbifLoader->keyMap().values();
}
-ServerBufferIntegration *ServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+ServerBufferIntegration *ServerBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (ServerBufferIntegration *ret = qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (ServerBufferIntegration *ret = qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(qwsbifLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
index 0d40aed0a..778399928 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class ServerBufferIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static ServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static ServerBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
index c81dcf848..1e687d17a 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegrationplugin_p.h"
@@ -56,3 +20,5 @@ ServerBufferIntegrationPlugin::~ServerBufferIntegrationPlugin()
QT_END_NAMESPACE
+#include "moc_qwlserverbufferintegrationplugin_p.cpp"
+
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
index 2f45fee19..8f64878fe 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class ServerBufferIntegration;
#define QtWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QtWaylandServerBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwltextureorphanage.cpp b/src/compositor/hardware_integration/qwltextureorphanage.cpp
new file mode 100644
index 000000000..c1ff86977
--- /dev/null
+++ b/src/compositor/hardware_integration/qwltextureorphanage.cpp
@@ -0,0 +1,108 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwltextureorphanage_p.h"
+
+#include <QOpenGLContext>
+#include <QOpenGLTexture>
+#include <QDebug>
+#include <QtTypeTraits>
+#include <QMutexLocker>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qLcWTO, "qt.waylandcompositor.orphanage")
+
+Q_GLOBAL_STATIC(QtWayland::QWaylandTextureOrphanage, inst)
+
+namespace QtWayland {
+
+QWaylandTextureOrphanage::~QWaylandTextureOrphanage()
+{
+ QMutexLocker locker(&m_containerLock);
+ if (!m_orphanedTextures.isEmpty()) {
+ qCWarning(qLcWTO) << Q_FUNC_INFO << "m_orphanedTextures container isn't empty! content:"
+ << m_orphanedTextures;
+ }
+}
+
+QWaylandTextureOrphanage *QWaylandTextureOrphanage::instance()
+{
+ return inst;
+}
+
+void QWaylandTextureOrphanage::admitTexture(QOpenGLTexture *tex, QOpenGLContext *ctx)
+{
+ qCDebug(qLcWTO) << Q_FUNC_INFO << "got a texture (" << (void *)tex
+ << ") ready to be deleted! It's ctx:" << ctx;
+
+ {
+ QMutexLocker locker(&m_containerLock);
+ m_orphanedTextures.insert(ctx, tex);
+ }
+
+ connect(ctx, &QOpenGLContext::aboutToBeDestroyed, this,
+ [this, ctx]() { this->onContextAboutToBeDestroyed(ctx); },
+ Qt::ConnectionType(Qt::DirectConnection));
+}
+
+void QWaylandTextureOrphanage::deleteTextures()
+{
+ QOpenGLContext *cCtx = QOpenGLContext::currentContext();
+
+ if (cCtx == nullptr) {
+ qCWarning(qLcWTO) << Q_FUNC_INFO << "cannot delete textures without current OpenGL context";
+ return;
+ }
+
+ {
+ QMutexLocker locker(&m_containerLock);
+
+ for (QOpenGLContext *aCtx : m_orphanedTextures.keys()) {
+ if (QOpenGLContext::areSharing(cCtx, aCtx)) {
+
+ qCDebug(qLcWTO) << Q_FUNC_INFO << "currentContext (" << cCtx
+ << ") and ctx of orphane(s) (" << aCtx
+ << ") are shared! => deleteTexturesByContext";
+
+ deleteTexturesByContext(aCtx);
+ }
+ }
+ }
+}
+
+void QWaylandTextureOrphanage::onContextAboutToBeDestroyed(QOpenGLContext *ctx)
+{
+ Q_ASSERT(ctx != nullptr);
+
+ qCDebug(qLcWTO) << Q_FUNC_INFO << " ctx (" << ctx
+ << ") fired aboutToBeDestroyed => deleteTexturesByContext(ctx)";
+
+ {
+ QMutexLocker locker(&m_containerLock);
+ deleteTexturesByContext(ctx);
+ }
+}
+
+void QWaylandTextureOrphanage::deleteTexturesByContext(QOpenGLContext *ctx)
+{
+ // NOTE: We are (by class-internal design) locked (m_containerLock)
+ // when we enter this function!
+ // If not (e.g.: someone changes something in/around this class),
+ // then in a debug-build we will fail below:
+ Q_ASSERT(!m_containerLock.tryLock());
+
+ QList<QOpenGLTexture *> texturesToDelete = m_orphanedTextures.values(ctx);
+ m_orphanedTextures.remove(ctx);
+
+ for (QOpenGLTexture *tex : texturesToDelete) {
+ delete tex;
+ qCDebug(qLcWTO) << Q_FUNC_INFO << " texture (" << (void *)tex << ") got deleted";
+ }
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#include "moc_qwltextureorphanage_p.cpp"
diff --git a/src/compositor/hardware_integration/qwltextureorphanage_p.h b/src/compositor/hardware_integration/qwltextureorphanage_p.h
new file mode 100644
index 000000000..f040ec750
--- /dev/null
+++ b/src/compositor/hardware_integration/qwltextureorphanage_p.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWLTEXTUREORPHANAGE_P_H
+#define QWLTEXTUREORPHANAGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QMutex>
+#include <QLoggingCategory>
+#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLContext;
+class QOpenGLTexture;
+
+Q_DECLARE_LOGGING_CATEGORY(qLcWTO)
+
+namespace QtWayland {
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextureOrphanage : public QObject
+{
+ Q_OBJECT
+
+public:
+ QWaylandTextureOrphanage(){};
+ ~QWaylandTextureOrphanage();
+
+ static QWaylandTextureOrphanage *instance();
+
+ // texture that isn't needed anymore will be "take care of" (killed) appropriately
+ void admitTexture(QOpenGLTexture *tex, QOpenGLContext *ctx);
+
+ // uses QOpenGLContext::currentContext to call deleteTexturesByContext on all shared ctx
+ void deleteTextures();
+
+public Q_SLOTS:
+ // uses sender() to call deleteTexturesByContext
+ void onContextAboutToBeDestroyed(QOpenGLContext *ctx);
+
+private:
+ void deleteTexturesByContext(QOpenGLContext *ctx);
+
+ // tracks all the orphanes that need to be deleted
+ QMultiHash<QOpenGLContext *, QOpenGLTexture *> m_orphanedTextures;
+
+ QMutex m_containerLock;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+#endif