summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration
diff options
context:
space:
mode:
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/CMakeLists.txt9
-rw-r--r--src/hardwareintegration/client/CMakeLists.txt6
-rw-r--r--src/hardwareintegration/client/brcm-egl/brcm-egl.pri3
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp43
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h42
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp54
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h45
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp44
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h41
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp46
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h41
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp46
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h41
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h46
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp44
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp62
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h42
-rw-r--r--src/hardwareintegration/client/wayland-egl/CMakeLists.txt34
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp70
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h85
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h60
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h62
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h51
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h27
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp99
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h98
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h70
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp322
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h102
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h72
-rw-r--r--src/hardwareintegration/client/wayland-egl/wayland-egl.pri12
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp152
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h118
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp78
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h70
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp134
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h80
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri16
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp114
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h80
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp138
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h111
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp121
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h81
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri16
-rw-r--r--src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp64
-rw-r--r--src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h69
-rw-r--r--src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri11
-rw-r--r--src/hardwareintegration/compositor/CMakeLists.txt8
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp30
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h34
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp86
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h32
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri2
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp42
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h31
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp34
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h31
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp62
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h40
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp30
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h34
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri4
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp77
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h50
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp231
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h42
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri3
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp55
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h33
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp77
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h30
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt30
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri4
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp194
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h84
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h69
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri2
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp30
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h32
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp168
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h32
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp160
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h77
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp176
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h86
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri16
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp58
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h78
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp65
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h60
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h67
98 files changed, 1175 insertions, 4855 deletions
diff --git a/src/hardwareintegration/CMakeLists.txt b/src/hardwareintegration/CMakeLists.txt
new file mode 100644
index 000000000..bc75a2088
--- /dev/null
+++ b/src/hardwareintegration/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(client)
+endif()
+if(TARGET Qt::WaylandCompositor)
+ add_subdirectory(compositor)
+endif()
diff --git a/src/hardwareintegration/client/CMakeLists.txt b/src/hardwareintegration/client/CMakeLists.txt
new file mode 100644
index 000000000..f63592c84
--- /dev/null
+++ b/src/hardwareintegration/client/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+endif()
diff --git a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
index f9f8d0726..e58b2cf85 100644
--- a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
+++ b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
@@ -1,7 +1,6 @@
INCLUDEPATH += $$PWD
QMAKE_USE += egl wayland-client libdl
-QT += egl_support-private
SOURCES += $$PWD/qwaylandbrcmeglintegration.cpp \
$$PWD/qwaylandbrcmglcontext.cpp \
@@ -11,5 +10,5 @@ HEADERS += $$PWD/qwaylandbrcmeglintegration.h \
$$PWD/qwaylandbrcmglcontext.h \
$$PWD/qwaylandbrcmeglwindow.h
-CONFIG += wayland-scanner
+CONFIG += wayland-scanner-client-wayland-protocol-include
WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/brcm.xml
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
index 59dc76825..8f9047993 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmeglintegration.h"
@@ -78,6 +42,7 @@ QWaylandBrcmEglIntegration::~QWaylandBrcmEglIntegration()
void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay)
{
+ m_display = waylandDisplay;
m_waylandDisplay = waylandDisplay->wl_display();
waylandDisplay->addRegistryListener(wlDisplayHandleGlobal, this);
EGLint major,minor;
@@ -111,7 +76,7 @@ void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay)
QWaylandWindow *QWaylandBrcmEglIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandBrcmEglWindow(window);
+ return new QWaylandBrcmEglWindow(window, m_display);
}
QPlatformOpenGLContext *QWaylandBrcmEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
index f65a88b1b..ac164ab9d 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMEGLINTEGRATION_H
#define QWAYLANDBRCMEGLINTEGRATION_H
@@ -93,6 +57,8 @@ private:
struct qt_brcm *m_waylandBrcm = nullptr;
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+
+ QWaylandDisplay *m_display = nullptr;
};
}
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
index 31adf100b..117e57807 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmeglwindow.h"
@@ -43,7 +7,7 @@
#include <QtWaylandClient/private/qwaylandscreen_p.h>
#include "qwaylandbrcmglcontext.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
@@ -124,8 +88,8 @@ private:
struct wl_event_queue *m_eventQueue = nullptr;
};
-QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
, m_eglIntegration(static_cast<QWaylandBrcmEglIntegration *>(mDisplay->clientBufferIntegration()))
, m_format(window->format())
, m_eventQueue(wl_display_create_queue(mDisplay->wl_display()))
@@ -185,14 +149,14 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2;
- m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
+ EGLConfig eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
- m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), m_eglConfig);
+ m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), eglConfig);
EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM;
EGLint rt;
- eglGetConfigAttrib(m_eglIntegration->eglDisplay(), m_eglConfig, EGL_RENDERABLE_TYPE, &rt);
+ eglGetConfigAttrib(m_eglIntegration->eglDisplay(), eglConfig, EGL_RENDERABLE_TYPE, &rt);
if (rt & EGL_OPENGL_ES_BIT) {
pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM;
@@ -228,7 +192,7 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
EGL_NONE
};
- m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), m_eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
+ m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
if (m_eglSurfaces[i] == EGL_NO_SURFACE)
qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]);
m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5, m_eventQueue);
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
index 2d418ecac..3b9026f9c 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMEGLWINDOW_H
#define QWAYLANDBRCMEGLWINDOW_H
@@ -51,14 +15,13 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class QWaylandGLContext;
class QWaylandBrcmBuffer;
class QWaylandBrcmEglWindow : public QWaylandWindow
{
Q_OBJECT
public:
- QWaylandBrcmEglWindow(QWindow *window);
+ QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandBrcmEglWindow();
WindowType windowType() const override;
void setGeometry(const QRect &rect) override;
@@ -77,8 +40,6 @@ private:
const QWaylandWindow *m_parentWindow = nullptr;
- EGLConfig m_eglConfig = 0;
-
EGLint m_globalImages[3*5];
EGLSurface m_eglSurfaces[3];
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
index 5c585746c..66135a7cc 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmglcontext.h"
@@ -43,7 +7,7 @@
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include "qwaylandbrcmeglwindow.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
@@ -66,7 +30,7 @@ QWaylandBrcmGLContext::QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfa
eglBindAPI(EGL_OPENGL_ES_API);
- QVector<EGLint> eglContextAttrs;
+ QList<EGLint> eglContextAttrs;
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2);
eglContextAttrs.append(EGL_NONE);
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
index d95ea9410..e64a20d9b 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMGLCONTEXT_H
#define QWAYLANDBRCMGLCONTEXT_H
@@ -51,7 +15,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
class QWaylandWindow;
-class QWaylandGLWindowSurface;
class QWaylandBrcmGLContext : public QPlatformOpenGLContext {
public:
diff --git a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
index 9f840414e..54df2badd 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dmabufserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -83,7 +47,7 @@ DmaBufServerBuffer::DmaBufServerBuffer(DmaBufServerBufferIntegration *integratio
int err = eglGetError();
qCDebug(lcQpaWayland) << "imported egl image" << m_image;
if (m_image == EGL_NO_IMAGE_KHR || err != EGL_SUCCESS)
- qCWarning(lcQpaWayland) << "DmaBufServerBuffer error importing image. EGL error code" << hex << err;
+ qCWarning(lcQpaWayland) << "DmaBufServerBuffer error importing image. EGL error code" << Qt::hex << err;
qt_server_buffer_set_user_data(id, this);
@@ -93,7 +57,7 @@ DmaBufServerBuffer::~DmaBufServerBuffer()
{
int err = m_integration->eglDestroyImageKHR(m_image);
if (err != EGL_SUCCESS)
- qCWarning(lcQpaWayland) << "~DmaBufServerBuffer error destroying image" << m_image << "error code " << hex << err;
+ qCWarning(lcQpaWayland) << "~DmaBufServerBuffer error destroying image" << m_image << "error code " << Qt::hex << err;
qt_server_buffer_release(m_server_buffer);
qt_server_buffer_destroy(m_server_buffer);
}
diff --git a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
index f38c2e151..13dbdfbfb 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include "qwayland-qt-dmabuf-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
index 754196468..16a3aa4cf 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "drmeglserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
@@ -125,7 +89,11 @@ void DrmEglServerBufferIntegration::initializeEgl()
return;
m_egl_initialized = true;
+#if QT_CONFIG(egl_extension_platform_wayland)
+ m_egl_display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, m_display->wl_display(), nullptr);
+#else
m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display());
+#endif
if (m_egl_display == EGL_NO_DISPLAY) {
qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display.");
return;
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
index 64201476d..a06bc96b8 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtCore/QVariant>
#include "qwayland-drm-egl-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
diff --git a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
index 252ceb698..54081de97 100644
--- a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "libhybriseglserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
diff --git a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
index 588366aa7..7fd4a2abb 100644
--- a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
+++ b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
@@ -44,8 +8,8 @@
#include "qwayland-libhybris-egl-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtCore/QList>
#include <QtCore/QTextStream>
-#include <QtCore/QVector>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -85,8 +49,8 @@ private:
EGLImageKHR m_image;
QOpenGLTexture *m_texture = nullptr;
int m_numFds;
- QVector<int32_t> m_ints;
- QVector<int32_t> m_fds;
+ QList<int32_t> m_ints;
+ QList<int32_t> m_fds;
int32_t m_stride;
int32_t m_hybrisFormat;
};
diff --git a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
index 73ff9e6e8..38065dbde 100644
--- a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "shmserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QImage>
#include <QtCore/QSharedMemory>
@@ -49,7 +13,7 @@ QT_BEGIN_NAMESPACE
static QOpenGLTexture *createTextureFromShm(const QString &key, int w, int h, int bpl, int format)
{
- QSharedMemory shm(key);
+ QT_IGNORE_DEPRECATIONS(QSharedMemory shm(key);)
bool ok;
ok = shm.attach(QSharedMemory::ReadOnly);
if (!ok) {
diff --git a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
index b162d6924..344046ae1 100644
--- a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SHMSERVERBUFFERINTEGRATION_H
#define SHMSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
index 4b2be50e6..8f1ff9a46 100644
--- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "vulkanserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/qopengl.h>
#include <QtGui/QImage>
#include <QtCore/QCoreApplication>
@@ -50,7 +14,7 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-static constexpr bool extraDebug =
+static constexpr bool sbiExtraDebug =
#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG
true;
#else
@@ -124,7 +88,7 @@ VulkanServerBuffer::~VulkanServerBuffer()
if (m_texture) { //only do gl cleanup if import has been called
m_integration->deleteGLTextureWhenPossible(m_texture);
- if (extraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject;
+ if (sbiExtraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject;
funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject);
}
qt_server_buffer_release(m_server_buffer);
@@ -136,7 +100,7 @@ void VulkanServerBuffer::import()
if (m_texture)
return;
- if (extraDebug) qDebug() << "importing" << m_fd << hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError();
auto *glContext = QOpenGLContext::currentContext();
if (!glContext)
@@ -146,21 +110,21 @@ void VulkanServerBuffer::import()
return;
funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
- if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, m_fd);
- if (extraDebug) qDebug() << "glImportMemoryFdEXT" << hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
m_texture->create();
- if (extraDebug) qDebug() << "created texture" << m_texture->textureId() << hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError();
m_texture->bind();
- if (extraDebug) qDebug() << "bound texture" << hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "bound texture" << Qt::hex << glGetError();
funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_internalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
- if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << hex << glGetError();
- if (extraDebug) qDebug() << "format" << hex << m_internalFormat << GL_RGBA8;
+ if (sbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8;
}
QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
@@ -193,7 +157,7 @@ void VulkanServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_regis
void VulkanServerBufferIntegration::zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format)
{
- if (extraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd;
+ if (sbiExtraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd;
auto *server_buffer = new VulkanServerBuffer(this, id, fd, width, height, memory_size, format);
qt_server_buffer_set_user_data(id, server_buffer);
}
diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
index 7add74269..2f0867a81 100644
--- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
+++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VULKANSERVERBUFFERINTEGRATION_H
#define VULKANSERVERBUFFERINTEGRATION_H
@@ -92,7 +56,7 @@ private:
static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
const QString &interface, uint32_t version);
QWaylandDisplay *m_display = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
+ QList<QOpenGLTexture *> orphanedTextures;
};
}
diff --git a/src/hardwareintegration/client/wayland-egl/CMakeLists.txt b/src/hardwareintegration/client/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..967dd3cab
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland-egl.pro.
+
+#####################################################################
+## WaylandEglClientHwIntegrationPrivate Module:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_module(WaylandEglClientHwIntegrationPrivate
+ CONFIG_MODULE_NAME wayland_egl_client_hw_integration
+ INTERNAL_MODULE
+ SOURCES
+ qwaylandeglclientbufferintegration.cpp qwaylandeglclientbufferintegration_p.h
+ qwaylandeglinclude_p.h
+ qwaylandeglwindow.cpp qwaylandeglwindow_p.h
+ qwaylandglcontext.cpp qwaylandglcontext_p.h
+ INCLUDE_DIRECTORIES
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_LIBRARIES
+ ${CMAKE_DL_LIBS}
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGLPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+ Wayland::Egl
+ NO_GENERATE_CPP_EXPORTS
+)
+
+#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
+# MODULE = "wayland_egl_client_hw_integration"
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
index 3a34d2561..3b97aef20 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandeglclientbufferintegration.h"
-
-#include "qwaylandeglwindow.h"
-#include "qwaylandglcontext.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandeglclientbufferintegration_p.h"
+
+#include "qwaylandeglwindow_p.h"
+#include "qwaylandglcontext_p.h"
#include <wayland-client-core.h>
@@ -76,6 +40,9 @@ QWaylandEglClientBufferIntegration::~QWaylandEglClientBufferIntegration()
void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
{
+#if QT_CONFIG(egl_extension_platform_wayland)
+ m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr);
+#else
if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) {
if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") ||
q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") ||
@@ -98,6 +65,7 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) display->wl_display());
}
+#endif
m_display = display;
@@ -108,7 +76,7 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
EGLint major,minor;
if (!eglInitialize(m_eglDisplay, &major, &minor)) {
- qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << hex << eglGetError();
+ qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << Qt::hex << eglGetError();
m_eglDisplay = EGL_NO_DISPLAY;
return;
}
@@ -124,6 +92,13 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
break;
}
}
+
+ // On desktop NVIDIA resizing QtQuick freezes them when using threaded rendering QTBUG-95817
+ // In order to support threaded rendering on embedded platforms where resizing is not needed
+ // we check if XDG_CURRENT_DESKTOP is set which desktop environments should set
+ if (qstrcmp(vendor, "NVIDIA") == 0 && qEnvironmentVariableIsSet("XDG_CURRENT_DESKTOP")) {
+ m_supportsThreading = false;
+ }
}
bool QWaylandEglClientBufferIntegration::isValid() const
@@ -143,12 +118,15 @@ bool QWaylandEglClientBufferIntegration::supportsWindowDecoration() const
QWaylandWindow *QWaylandEglClientBufferIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandEglWindow(window);
+ return new QWaylandEglWindow(window, m_display);
}
QPlatformOpenGLContext *QWaylandEglClientBufferIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
{
- return new QWaylandGLContext(m_eglDisplay, m_display, glFormat, share);
+ QSurfaceFormat fmt = glFormat;
+ if (m_display->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ return new QWaylandGLContext(m_eglDisplay, m_display, fmt, share);
}
void *QWaylandEglClientBufferIntegration::nativeResource(NativeResource resource)
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
deleted file mode 100644
index 0c5326230..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLINTEGRATION_H
-#define QWAYLANDEGLINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-
-#include "qwaylandeglinclude.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-
-class QWaylandEglClientBufferIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandEglClientBufferIntegration();
- ~QWaylandEglClientBufferIntegration() override;
-
- void initialize(QWaylandDisplay *display) override;
- bool isValid() const override;
- bool supportsThreadedOpenGL() const override;
- bool supportsWindowDecoration() const override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- void *nativeResource(NativeResource resource) override;
- void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override;
-
- EGLDisplay eglDisplay() const;
-
-private:
- QWaylandDisplay *m_display = nullptr;
-
- EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
- bool m_supportsThreading = false;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h
new file mode 100644
index 000000000..ed8fdec2d
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h
@@ -0,0 +1,60 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// 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.
+//
+
+#ifndef QWAYLANDEGLINTEGRATION_H
+#define QWAYLANDEGLINTEGRATION_H
+
+#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
+
+#include "qwaylandeglinclude_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+namespace QtWaylandClient {
+
+class QWaylandWindow;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandEglClientBufferIntegration : public QWaylandClientBufferIntegration
+{
+public:
+ QWaylandEglClientBufferIntegration();
+ ~QWaylandEglClientBufferIntegration() override;
+
+ void initialize(QWaylandDisplay *display) override;
+ bool isValid() const override;
+ bool supportsThreadedOpenGL() const override;
+ bool supportsWindowDecoration() const override;
+
+ QWaylandWindow *createEglWindow(QWindow *window) override;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
+
+ void *nativeResource(NativeResource resource) override;
+ void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override;
+
+ EGLDisplay eglDisplay() const;
+
+private:
+ QWaylandDisplay *m_display = nullptr;
+
+ EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ bool m_supportsThreading = false;
+};
+
+QT_END_NAMESPACE
+
+}
+
+#endif // QWAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h b/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h
deleted file mode 100644
index ac0d96791..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLWINDOW_H
-#define QWAYLANDEGLWINDOW_H
-
-#include <QtWaylandClient/qwaylanddisplay.h>
-
-#include "qwaylandeglintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandEglDisplay : public QWaylandDisplay
-{
-public:
-
- QWaylandEglDisplay()
- : QWaylandDisplay()
- { }
-};
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
deleted file mode 100644
index e9998b832..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLINCLUDE_H
-#define QWAYLANDEGLINCLUDE_H
-
-#include <string.h>
-#include <wayland-client-core.h>
-
-#include <wayland-egl.h>
-
-#define EGL_EGLEXT_PROTOTYPES
-#include <QtEglSupport/private/qt_egl_p.h>
-
-#endif // QWAYLANDEGLINCLUDE_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h
new file mode 100644
index 000000000..eb52ce8ee
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+//
+// 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.
+//
+
+#ifndef QWAYLANDEGLINCLUDE_H
+#define QWAYLANDEGLINCLUDE_H
+
+#include <string.h>
+#include <wayland-client-core.h>
+
+#include <wayland-egl.h>
+
+#define EGL_EGLEXT_PROTOTYPES
+#include <QtGui/private/qt_egl_p.h>
+
+#endif // QWAYLANDEGLINCLUDE_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index 030422c56..0b014cd5c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -1,48 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandeglwindow.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandeglwindow_p.h"
#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include "qwaylandglcontext.h"
+#include <QtWaylandClient/private/qwaylandsurface_p.h>
+#include "qwaylandglcontext_p.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QDebug>
#include <QtGui/QWindow>
@@ -54,20 +19,15 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandEglWindow::QWaylandEglWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
, m_clientBufferIntegration(static_cast<QWaylandEglClientBufferIntegration *>(mDisplay->clientBufferIntegration()))
+ , m_format(window->requestedFormat())
{
- QSurfaceFormat fmt = window->requestedFormat();
- if (mDisplay->supportsWindowDecoration())
- fmt.setAlphaBufferSize(8);
- m_eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
- m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig, fmt);
-
- // Do not create anything from here. This platform window may belong to a
- // RasterGLSurface window which may have pure raster content. In this case, where the
- // window is never actually made current, creating a wl_egl_window and EGL surface
- // should be avoided.
+ connect(display, &QWaylandDisplay::connected, this, [this] {
+ m_clientBufferIntegration = static_cast<QWaylandEglClientBufferIntegration *>(
+ mDisplay->clientBufferIntegration());
+ });
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -105,7 +65,7 @@ void QWaylandEglWindow::setGeometry(const QRect &rect)
void QWaylandEglWindow::updateSurface(bool create)
{
- QMargins margins = frameMargins();
+ QMargins margins = clientSideMargins();
QRect rect = geometry();
QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale();
@@ -124,6 +84,7 @@ void QWaylandEglWindow::updateSurface(bool create)
}
mOffset = QPoint();
} else {
+ QReadLocker locker(&mSurfaceLock);
if (m_waylandEglWindow) {
int current_width, current_height;
static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt();
@@ -131,19 +92,26 @@ void QWaylandEglWindow::updateSurface(bool create)
if (!disableResizeCheck) {
wl_egl_window_get_attached_size(m_waylandEglWindow, &current_width, &current_height);
}
- if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height())) {
+ if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) || m_requestedSize != sizeWithMargins) {
wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y());
+ m_requestedSize = sizeWithMargins;
mOffset = QPoint();
m_resize = true;
}
- } else if (create && wlSurface()) {
- m_waylandEglWindow = wl_egl_window_create(wlSurface(), sizeWithMargins.width(), sizeWithMargins.height());
+ } else if (create && mSurface) {
+ m_waylandEglWindow = wl_egl_window_create(mSurface->object(), sizeWithMargins.width(), sizeWithMargins.height());
+ m_requestedSize = sizeWithMargins;
}
if (!m_eglSurface && m_waylandEglWindow && create) {
EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
- m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
+ QSurfaceFormat fmt = window()->requestedFormat();
+ if (mDisplay->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ EGLConfig eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
+ m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), eglConfig, fmt);
+ m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), eglConfig, eglw, 0);
if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE))
qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
}
@@ -153,7 +121,7 @@ void QWaylandEglWindow::updateSurface(bool create)
QRect QWaylandEglWindow::contentsRect() const
{
QRect r = geometry();
- QMargins m = frameMargins();
+ QMargins m = clientSideMargins();
return QRect(m.left(), m.bottom(), r.width(), r.height());
}
@@ -162,13 +130,6 @@ QSurfaceFormat QWaylandEglWindow::format() const
return m_format;
}
-void QWaylandEglWindow::setVisible(bool visible)
-{
- QWaylandWindow::setVisible(visible);
- if (!visible)
- invalidateSurface();
-}
-
void QWaylandEglWindow::invalidateSurface()
{
if (m_eglSurface) {
@@ -179,6 +140,8 @@ void QWaylandEglWindow::invalidateSurface()
wl_egl_window_destroy(m_waylandEglWindow);
m_waylandEglWindow = nullptr;
}
+ delete m_contentFBO;
+ m_contentFBO = nullptr;
}
EGLSurface QWaylandEglWindow::eglSurface() const
@@ -219,3 +182,5 @@ void QWaylandEglWindow::bindContentFBO()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandeglwindow_p.cpp"
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
deleted file mode 100644
index 9e6cb876c..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLWINDOW_H
-#define QWAYLANDEGLWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include "qwaylandeglinclude.h"
-#include "qwaylandeglclientbufferintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFramebufferObject;
-
-namespace QtWaylandClient {
-
-class QWaylandGLContext;
-
-class QWaylandEglWindow : public QWaylandWindow
-{
- Q_OBJECT
-public:
- QWaylandEglWindow(QWindow *window);
- ~QWaylandEglWindow();
- WindowType windowType() const override;
- void ensureSize() override;
-
- void updateSurface(bool create);
- void setGeometry(const QRect &rect) override;
- QRect contentsRect() const;
-
- EGLSurface eglSurface() const;
- GLuint contentFBO() const;
- GLuint contentTexture() const;
- bool needToUpdateContentFBO() const { return decoration() && (m_resize || !m_contentFBO); }
-
- QSurfaceFormat format() const override;
-
- void bindContentFBO();
-
- void invalidateSurface() override;
- void setVisible(bool visible) override;
-
-private:
- QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr;
- struct wl_egl_window *m_waylandEglWindow = nullptr;
-
- const QWaylandWindow *m_parentWindow = nullptr;
-
- EGLSurface m_eglSurface = EGL_NO_SURFACE;
- EGLConfig m_eglConfig;
- mutable bool m_resize = false;
- mutable QOpenGLFramebufferObject *m_contentFBO = nullptr;
-
- QSurfaceFormat m_format;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDEGLWINDOW_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
new file mode 100644
index 000000000..5b9aa9874
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// 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.
+//
+
+#ifndef QWAYLANDEGLWINDOW_H
+#define QWAYLANDEGLWINDOW_H
+
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+#include "qwaylandeglinclude_p.h"
+#include "qwaylandeglclientbufferintegration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLFramebufferObject;
+
+namespace QtWaylandClient {
+
+class QWaylandGLContext;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandEglWindow : public QWaylandWindow
+{
+ Q_OBJECT
+public:
+ QWaylandEglWindow(QWindow *window, QWaylandDisplay *display);
+ ~QWaylandEglWindow();
+ WindowType windowType() const override;
+ void ensureSize() override;
+
+ void updateSurface(bool create);
+ void setGeometry(const QRect &rect) override;
+ QRect contentsRect() const;
+
+ EGLSurface eglSurface() const;
+ GLuint contentFBO() const;
+ GLuint contentTexture() const;
+ bool needToUpdateContentFBO() const { return decoration() && (m_resize || !m_contentFBO); }
+
+ QSurfaceFormat format() const override;
+
+ void bindContentFBO();
+
+ void invalidateSurface() override;
+
+private:
+ QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr;
+ struct wl_egl_window *m_waylandEglWindow = nullptr;
+
+ EGLSurface m_eglSurface = EGL_NO_SURFACE;
+ mutable bool m_resize = false;
+ mutable QOpenGLFramebufferObject *m_contentFBO = nullptr;
+
+ QSurfaceFormat m_format;
+ QSize m_requestedSize;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDEGLWINDOW_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 5bd2760d0..02789b305 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -1,60 +1,24 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandglcontext.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandglcontext_p.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandsubsurface_p.h>
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include "qwaylandeglwindow.h"
+#include "qwaylandeglwindow_p.h"
#include <QDebug>
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QtGui/private/qopenglcontext_p.h>
-#include <QtGui/private/qopengltexturecache_p.h>
+#include <QtOpenGL/private/qopengltexturecache_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
-#include <QtGui/QOpenGLShaderProgram>
+#include <QtOpenGL/QOpenGLShaderProgram>
#include <QtGui/QOpenGLFunctions>
#include <QOpenGLBuffer>
@@ -192,22 +156,23 @@ public:
}
void blit(QWaylandEglWindow *window)
{
- Q_ASSERT(window->wlSurface());
QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context());
QSize surfaceSize = window->surfaceSize();
- int scale = window->scale() ;
+ qreal scale = window->scale() ;
glViewport(0, 0, surfaceSize.width() * scale, surfaceSize.height() * scale);
//Draw Decoration
- m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_inverseSquareVerticesOffset, 2);
- QImage decorationImage = window->decoration()->contentImage();
- cache->bindTexture(m_context->context(), decorationImage);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_textureWrap);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_textureWrap);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ if (auto *decoration = window->decoration()) {
+ m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_inverseSquareVerticesOffset, 2);
+ QImage decorationImage = decoration->contentImage();
+ cache->bindTexture(m_context->context(), decorationImage);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_textureWrap);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_textureWrap);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
//Draw Content
m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_squareVerticesOffset, 2);
@@ -226,179 +191,105 @@ public:
int m_textureWrap;
};
-
-
-QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
- : QPlatformOpenGLContext()
- , m_eglDisplay(eglDisplay)
- , m_display(display)
+QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display,
+ const QSurfaceFormat &fmt, QPlatformOpenGLContext *share)
+ : QEGLPlatformContext(fmt, share, eglDisplay), m_display(display)
{
- QSurfaceFormat fmt = format;
- if (static_cast<QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration())->display()->supportsWindowDecoration())
- fmt.setAlphaBufferSize(8);
- m_config = q_configFromGLFormat(m_eglDisplay, fmt);
- m_format = q_glFormatFromConfig(m_eglDisplay, m_config, fmt);
- m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
-
- QVector<EGLint> eglContextAttrs;
- eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
- eglContextAttrs.append(format.majorVersion());
- const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context");
- if (hasKHRCreateContext) {
- eglContextAttrs.append(EGL_CONTEXT_MINOR_VERSION_KHR);
- eglContextAttrs.append(format.minorVersion());
- int flags = 0;
- // The debug bit is supported both for OpenGL and OpenGL ES.
- if (format.testOption(QSurfaceFormat::DebugContext))
- flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
- // The fwdcompat bit is only for OpenGL 3.0+.
- if (m_format.renderableType() == QSurfaceFormat::OpenGL
- && format.majorVersion() >= 3
- && !format.testOption(QSurfaceFormat::DeprecatedFunctions))
- flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
- if (flags) {
- eglContextAttrs.append(EGL_CONTEXT_FLAGS_KHR);
- eglContextAttrs.append(flags);
- }
- // Profiles are OpenGL only and mandatory in 3.2+. The value is silently ignored for < 3.2.
- if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
- switch (format.profile()) {
- case QSurfaceFormat::NoProfile:
- break;
- case QSurfaceFormat::CoreProfile:
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR);
- break;
- case QSurfaceFormat::CompatibilityProfile:
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR);
- break;
- }
- }
- }
- eglContextAttrs.append(EGL_NONE);
+ m_reconnectionWatcher = QObject::connect(m_display, &QWaylandDisplay::connected,
+ m_display, [this] { invalidateContext(); });
- switch (m_format.renderableType()) {
+ switch (format().renderableType()) {
case QSurfaceFormat::OpenVG:
m_api = EGL_OPENVG_API;
break;
#ifdef EGL_VERSION_1_4
-# if !defined(QT_OPENGL_ES_2)
- case QSurfaceFormat::DefaultRenderableType:
-# endif
case QSurfaceFormat::OpenGL:
m_api = EGL_OPENGL_API;
break;
-#endif
- case QSurfaceFormat::OpenGLES:
+#endif // EGL_VERSION_1_4
default:
m_api = EGL_OPENGL_ES_API;
break;
}
- eglBindAPI(m_api);
-
- m_context = eglCreateContext(m_eglDisplay, m_config, m_shareEGLContext, eglContextAttrs.constData());
-
- if (m_context == EGL_NO_CONTEXT) {
- m_context = eglCreateContext(m_eglDisplay, m_config, EGL_NO_CONTEXT, eglContextAttrs.constData());
- m_shareEGLContext = EGL_NO_CONTEXT;
- }
-
- EGLint error = eglGetError();
- if (error != EGL_SUCCESS) {
- qWarning("QWaylandGLContext: failed to create EGLContext, error=%x", error);
- return;
- }
// Create an EGL context for the decorations blitter. By using a dedicated context we don't need to make sure to not
// change the context state and we also use OpenGL ES 2 API independently to what the app is using to draw.
- QVector<EGLint> eglDecorationsContextAttrs = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
- m_decorationsContext = eglCreateContext(m_eglDisplay, m_config, m_context, eglDecorationsContextAttrs.constData());
+ QList<EGLint> eglDecorationsContextAttrs = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
+ m_decorationsContext = eglCreateContext(eglDisplay, eglConfig(), eglContext(),
+ eglDecorationsContextAttrs.constData());
if (m_decorationsContext == EGL_NO_CONTEXT)
qWarning("QWaylandGLContext: Failed to create the decorations EGLContext. Decorations will not be drawn.");
EGLint a = EGL_MIN_SWAP_INTERVAL;
EGLint b = EGL_MAX_SWAP_INTERVAL;
- if (!eglGetConfigAttrib(m_eglDisplay, m_config, a, &a) ||
- !eglGetConfigAttrib(m_eglDisplay, m_config, b, &b) ||
- a > 0) {
- mSupportNonBlockingSwap = false;
+ if (!eglGetConfigAttrib(eglDisplay, eglConfig(), a, &a)
+ || !eglGetConfigAttrib(eglDisplay, eglConfig(), b, &b) || a > 0) {
+ m_supportNonBlockingSwap = false;
}
- if (!mSupportNonBlockingSwap) {
+ {
+ bool ok;
+ int supportNonBlockingSwap = qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT", &ok);
+ if (ok)
+ m_supportNonBlockingSwap = supportNonBlockingSwap != 0;
+ }
+ if (!m_supportNonBlockingSwap) {
qWarning(lcQpaWayland) << "Non-blocking swap buffers not supported."
<< "Subsurface rendering can be affected."
<< "It may also cause the event loop to freeze in some situations";
}
+}
- updateGLFormat();
+EGLSurface QWaylandGLContext::createTemporaryOffscreenSurface()
+{
+ m_wlSurface = m_display->createSurface(nullptr);
+ m_eglWindow = wl_egl_window_create(m_wlSurface, 1, 1);
+#if QT_CONFIG(egl_extension_platform_wayland)
+ EGLSurface eglSurface =
+ eglCreatePlatformWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr);
+#else
+ EGLSurface eglSurface = eglCreateWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr);
+#endif
+ return eglSurface;
}
-void QWaylandGLContext::updateGLFormat()
+void QWaylandGLContext::destroyTemporaryOffscreenSurface(EGLSurface eglSurface)
{
- // Have to save & restore to prevent QOpenGLContext::currentContext() from becoming
- // inconsistent after QOpenGLContext::create().
- EGLDisplay prevDisplay = eglGetCurrentDisplay();
- if (prevDisplay == EGL_NO_DISPLAY) // when no context is current
- prevDisplay = m_eglDisplay;
- EGLContext prevContext = eglGetCurrentContext();
- EGLSurface prevSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
- EGLSurface prevSurfaceRead = eglGetCurrentSurface(EGL_READ);
-
- wl_surface *wlSurface = m_display->createSurface(nullptr);
- wl_egl_window *eglWindow = wl_egl_window_create(wlSurface, 1, 1);
- EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, 0);
-
- if (eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- if (m_format.renderableType() == QSurfaceFormat::OpenGL
- || m_format.renderableType() == QSurfaceFormat::OpenGLES) {
- const GLubyte *s = glGetString(GL_VERSION);
- if (s) {
- QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
- int major, minor;
- if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
- m_format.setMajorVersion(major);
- m_format.setMinorVersion(minor);
- }
- }
- m_format.setProfile(QSurfaceFormat::NoProfile);
- m_format.setOptions(QSurfaceFormat::FormatOptions());
- if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
- // Check profile and options.
- if (m_format.majorVersion() < 3) {
- m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
- } else {
- GLint value = 0;
- glGetIntegerv(GL_CONTEXT_FLAGS, &value);
- if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
- m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
- if (value & GL_CONTEXT_FLAG_DEBUG_BIT)
- m_format.setOption(QSurfaceFormat::DebugContext);
- if (m_format.version() >= qMakePair(3, 2)) {
- value = 0;
- glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
- if (value & GL_CONTEXT_CORE_PROFILE_BIT)
- m_format.setProfile(QSurfaceFormat::CoreProfile);
- else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
- m_format.setProfile(QSurfaceFormat::CompatibilityProfile);
- }
- }
- }
- }
- eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
- }
- eglDestroySurface(m_eglDisplay, eglSurface);
- wl_egl_window_destroy(eglWindow);
- wl_surface_destroy(wlSurface);
+ eglDestroySurface(eglDisplay(), eglSurface);
+ wl_egl_window_destroy(m_eglWindow);
+ m_eglWindow = nullptr;
+ wl_surface_destroy(m_wlSurface);
+ m_wlSurface = nullptr;
}
QWaylandGLContext::~QWaylandGLContext()
{
+ QObject::disconnect(m_reconnectionWatcher);
delete m_blitter;
- eglDestroyContext(m_eglDisplay, m_context);
+ m_blitter = nullptr;
+ if (m_decorationsContext != EGL_NO_CONTEXT)
+ eglDestroyContext(eglDisplay(), m_decorationsContext);
+}
+
+void QWaylandGLContext::beginFrame()
+{
+ Q_ASSERT(m_currentWindow != nullptr);
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->beginFrame();
+}
+
+void QWaylandGLContext::endFrame()
+{
+ Q_ASSERT(m_currentWindow != nullptr);
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->endFrame();
}
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
{
+ if (!isValid()) {
+ return false;
+ }
+
// in QWaylandGLContext() we called eglBindAPI with the correct value. However,
// eglBindAPI's documentation says:
// "eglBindAPI defines the current rendering API for EGL in the thread it is called from"
@@ -408,44 +299,42 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
eglBindAPI(m_api);
}
- QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface);
- EGLSurface eglSurface = window->eglSurface();
+ m_currentWindow = static_cast<QWaylandEglWindow *>(surface);
+ EGLSurface eglSurface = m_currentWindow->eglSurface();
- if (!window->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) {
- if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
+ if (!m_currentWindow->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) {
+ if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) {
+ qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this);
return false;
}
return true;
}
- if (window->isExposed())
- window->setCanResize(false);
- if (m_decorationsContext != EGL_NO_CONTEXT && !window->decoration())
- window->createDecoration();
+ if (m_currentWindow->isExposed())
+ m_currentWindow->setCanResize(false);
if (eglSurface == EGL_NO_SURFACE) {
- window->updateSurface(true);
- eglSurface = window->eglSurface();
+ m_currentWindow->updateSurface(true);
+ eglSurface = m_currentWindow->eglSurface();
}
- if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
- window->setCanResize(true);
+ if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) {
+ qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this);
+ m_currentWindow->setCanResize(true);
return false;
}
//### setCurrentContext will be called in QOpenGLContext::makeCurrent after this function
// returns, but that's too late, as we need a current context in order to bind the content FBO.
QOpenGLContextPrivate::setCurrentContext(context());
- window->bindContentFBO();
+ m_currentWindow->bindContentFBO();
return true;
}
void QWaylandGLContext::doneCurrent()
{
- eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglMakeCurrent(eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
@@ -463,7 +352,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
EGLContext currentContext = eglGetCurrentContext();
EGLSurface currentSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
EGLSurface currentSurfaceRead = eglGetCurrentSurface(EGL_READ);
- eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_decorationsContext);
+ eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, m_decorationsContext);
if (!m_blitter)
m_blitter = new DecorationsBlitter(this);
@@ -474,15 +363,16 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
eglMakeCurrent(currentDisplay, currentSurfaceDraw, currentSurfaceRead, currentContext);
}
- int swapInterval = mSupportNonBlockingSwap ? 0 : m_format.swapInterval();
- eglSwapInterval(m_eglDisplay, swapInterval);
- if (swapInterval == 0 && m_format.swapInterval() > 0) {
+ int swapInterval = m_supportNonBlockingSwap ? 0 : format().swapInterval();
+ eglSwapInterval(eglDisplay(), swapInterval);
+ if (swapInterval == 0 && format().swapInterval() > 0) {
// Emulating a blocking swap
glFlush(); // Flush before waiting so we can swap more quickly when the frame event arrives
window->waitForFrameSync(100);
}
window->handleUpdate();
- eglSwapBuffers(m_eglDisplay, eglSurface);
+ if (!eglSwapBuffers(eglDisplay(), eglSurface))
+ qCWarning(lcQpaWayland, "eglSwapBuffers failed with %#x, surface: %p", eglGetError(), eglSurface);
window->setCanResize(true);
}
@@ -492,16 +382,6 @@ GLuint QWaylandGLContext::defaultFramebufferObject(QPlatformSurface *surface) co
return static_cast<QWaylandEglWindow *>(surface)->contentFBO();
}
-bool QWaylandGLContext::isSharing() const
-{
- return m_shareEGLContext != EGL_NO_CONTEXT;
-}
-
-bool QWaylandGLContext::isValid() const
-{
- return m_context != EGL_NO_CONTEXT;
-}
-
QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName)
{
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
@@ -510,9 +390,9 @@ QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName)
return proc;
}
-EGLConfig QWaylandGLContext::eglConfig() const
+EGLSurface QWaylandGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
{
- return m_config;
+ return static_cast<QWaylandEglWindow *>(surface)->eglSurface();
}
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
deleted file mode 100644
index 0e86ca4f5..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDGLCONTEXT_H
-#define QWAYLANDGLCONTEXT_H
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandeglinclude.h"
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLShaderProgram;
-class QOpenGLTextureCache;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandGLWindowSurface;
-class DecorationsBlitter;
-
-class QWaylandGLContext : public QPlatformOpenGLContext
-{
-public:
- QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
- ~QWaylandGLContext();
-
- void swapBuffers(QPlatformSurface *surface) override;
-
- bool makeCurrent(QPlatformSurface *surface) override;
- void doneCurrent() override;
-
- GLuint defaultFramebufferObject(QPlatformSurface *surface) const override;
-
- bool isSharing() const override;
- bool isValid() const override;
-
- QFunctionPointer getProcAddress(const char *procName) override;
-
- QSurfaceFormat format() const override { return m_format; }
-
- EGLConfig eglConfig() const;
- EGLContext eglContext() const { return m_context; }
-
-private:
- void updateGLFormat();
-
- EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
- QWaylandDisplay *m_display = nullptr;
- EGLContext m_context;
- EGLContext m_shareEGLContext;
- EGLContext m_decorationsContext;
- EGLConfig m_config;
- QSurfaceFormat m_format;
- DecorationsBlitter *m_blitter = nullptr;
- uint m_api;
- bool mSupportNonBlockingSwap = true;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDGLCONTEXT_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h
new file mode 100644
index 000000000..b985c6675
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// 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.
+//
+
+#ifndef QWAYLANDGLCONTEXT_H
+#define QWAYLANDGLCONTEXT_H
+
+#include "qwaylandeglinclude_p.h" //must be first
+
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtGui/private/qeglplatformcontext_p.h>
+#include <qpa/qplatformopenglcontext.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLShaderProgram;
+class QOpenGLTextureCache;
+
+namespace QtWaylandClient {
+
+class QWaylandEglWindow;
+class DecorationsBlitter;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandGLContext : public QEGLPlatformContext
+{
+public:
+ QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
+ ~QWaylandGLContext();
+ void swapBuffers(QPlatformSurface *surface) override;
+
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+
+ void beginFrame() override;
+ void endFrame() override;
+
+ GLuint defaultFramebufferObject(QPlatformSurface *surface) const override;
+
+ QFunctionPointer getProcAddress(const char *procName) override;
+
+protected:
+ EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
+ EGLSurface createTemporaryOffscreenSurface() override;
+ void destroyTemporaryOffscreenSurface(EGLSurface surface) override;
+
+private:
+ QWaylandDisplay *m_display = nullptr;
+ EGLContext m_decorationsContext;
+ DecorationsBlitter *m_blitter = nullptr;
+ bool m_supportNonBlockingSwap = true;
+ EGLenum m_api;
+ wl_surface *m_wlSurface = nullptr;
+ wl_egl_window *m_eglWindow = nullptr;
+ QWaylandEglWindow *m_currentWindow = nullptr;
+ QMetaObject::Connection m_reconnectionWatcher;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDGLCONTEXT_H
diff --git a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
index d7634b150..5d0d0204b 100644
--- a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
@@ -1,14 +1,14 @@
INCLUDEPATH += $$PWD
-QMAKE_USE += egl wayland-client wayland-egl
+QMAKE_USE += egl wayland-client wayland-egl libdl
-QT += egl_support-private
+QT += opengl-private
SOURCES += $$PWD/qwaylandeglclientbufferintegration.cpp \
$$PWD/qwaylandglcontext.cpp \
$$PWD/qwaylandeglwindow.cpp
-HEADERS += $$PWD/qwaylandeglclientbufferintegration.h \
- $$PWD/qwaylandglcontext.h \
- $$PWD/qwaylandeglwindow.h \
- $$PWD/qwaylandeglinclude.h
+HEADERS += $$PWD/qwaylandeglclientbufferintegration_p.h \
+ $$PWD/qwaylandglcontext_p.h \
+ $$PWD/qwaylandeglwindow_p.h \
+ $$PWD/qwaylandeglinclude_p.h
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
deleted file mode 100644
index 104a4df91..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include "qwaylandxcompositeeglwindow.h"
-
-#include <QtCore/QDebug>
-#include <QtEglSupport/private/qeglconvenience_p.h>
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLClientBufferIntegration::QWaylandXCompositeEGLClientBufferIntegration()
- : QWaylandClientBufferIntegration()
-{
- qDebug() << "Using XComposite-EGL";
-}
-
-QWaylandXCompositeEGLClientBufferIntegration::~QWaylandXCompositeEGLClientBufferIntegration()
-{
- XCloseDisplay(mDisplay);
-}
-
-void QWaylandXCompositeEGLClientBufferIntegration::initialize(QWaylandDisplay *display)
-{
- mWaylandDisplay = display;
- mWaylandDisplay->addRegistryListener(&wlDisplayHandleGlobal, this);
- while (!mDisplay) {
- display->flushRequests();
- display->blockingReadEvents();
- }
-}
-
-QWaylandWindow * QWaylandXCompositeEGLClientBufferIntegration::createEglWindow(QWindow *window)
-{
- return new QWaylandXCompositeEGLWindow(window,this);
-}
-
-QPlatformOpenGLContext *QWaylandXCompositeEGLClientBufferIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
-{
- EGLDisplay display = eglDisplay();
- EGLConfig config = q_configFromGLFormat(display, glFormat, true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT);
- return new QWaylandXCompositeEGLContext(glFormat, share, display, config);
-}
-
-Display * QWaylandXCompositeEGLClientBufferIntegration::xDisplay() const
-{
- return mDisplay;
-}
-
-EGLDisplay QWaylandXCompositeEGLClientBufferIntegration::eglDisplay() const
-{
- return mEglDisplay;
-}
-
-int QWaylandXCompositeEGLClientBufferIntegration::screen() const
-{
- return mScreen;
-}
-
-Window QWaylandXCompositeEGLClientBufferIntegration::rootWindow() const
-{
- return mRootWindow;
-}
-
-QWaylandDisplay * QWaylandXCompositeEGLClientBufferIntegration::waylandDisplay() const
-{
- return mWaylandDisplay;
-}
-qt_xcomposite * QWaylandXCompositeEGLClientBufferIntegration::waylandXComposite() const
-{
- return mWaylandComposite;
-}
-
-const struct qt_xcomposite_listener QWaylandXCompositeEGLClientBufferIntegration::xcomposite_listener = {
- QWaylandXCompositeEGLClientBufferIntegration::rootInformation
-};
-
-void QWaylandXCompositeEGLClientBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
-{
- Q_UNUSED(version);
- if (interface == "qt_xcomposite") {
- QWaylandXCompositeEGLClientBufferIntegration *integration = static_cast<QWaylandXCompositeEGLClientBufferIntegration *>(data);
- integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry,id,&qt_xcomposite_interface,1));
- qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
- }
-
-}
-
-void QWaylandXCompositeEGLClientBufferIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window)
-{
- Q_UNUSED(xcomposite);
- QWaylandXCompositeEGLClientBufferIntegration *integration = static_cast<QWaylandXCompositeEGLClientBufferIntegration *>(data);
-
- integration->mDisplay = XOpenDisplay(display_name);
- integration->mRootWindow = (Window) root_window;
- integration->mScreen = XDefaultScreen(integration->mDisplay);
- integration->mEglDisplay = eglGetDisplay(integration->mDisplay);
- eglBindAPI(EGL_OPENGL_ES_API);
- EGLint minor,major;
- if (!eglInitialize(integration->mEglDisplay,&major,&minor)) {
- qFatal("Failed to initialize EGL");
- }
- eglSwapInterval(integration->eglDisplay(),0);
- qDebug() << "ROOT INFORMATION" << integration->mDisplay << integration->mRootWindow << integration->mScreen;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
deleted file mode 100644
index 5fe21d7b7..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
-#define QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-#include <wayland-client-core.h>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QWindow>
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include <QWaitCondition>
-
-#include <X11/Xlib.h>
-#include <EGL/egl.h>
-
-// avoid clashes with Qt::CursorShape
-#ifdef CursorShape
-# define X_CursorShape CursorShape
-# undef CursorShape
-#endif
-
-struct qt_xcomposite;
-struct qt_xcomposite_listener;
-struct wl_registry;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLClientBufferIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandXCompositeEGLClientBufferIntegration();
- ~QWaylandXCompositeEGLClientBufferIntegration() override;
-
- void initialize(QWaylandDisplay *dispaly) override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- QWaylandDisplay *waylandDisplay() const;
- struct qt_xcomposite *waylandXComposite() const;
-
- Display *xDisplay() const;
- EGLDisplay eglDisplay() const;
- int screen() const;
- Window rootWindow() const;
-
- bool supportsThreadedOpenGL() const override { return true; }
- bool supportsWindowDecoration() const override { return false; }
-
-private:
- QWaylandDisplay *mWaylandDisplay = nullptr;
- struct qt_xcomposite *mWaylandComposite = nullptr;
-
- Display *mDisplay = nullptr;
- EGLDisplay mEglDisplay = EGL_NO_DISPLAY;
- int mScreen = 0;
- Window mRootWindow = -1;
-
- static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
-
- static const struct ::qt_xcomposite_listener xcomposite_listener;
- static void rootInformation(void *data,
- struct qt_xcomposite *xcomposite,
- const char *display_name,
- uint32_t root_window);
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
deleted file mode 100644
index a6fead95c..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglcontext.h"
-
-#include "qwaylandxcompositeeglwindow.h"
-
-#include <QtCore/QDebug>
-#include <QtGui/QRegion>
-
-#include <QtEglSupport/private/qeglconvenience_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig config)
- : QEGLPlatformContext(format, share, display, &config)
-{
-}
-
-void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface)
-{
- QEGLPlatformContext::swapBuffers(surface);
-
- QWaylandXCompositeEGLWindow *w =
- static_cast<QWaylandXCompositeEGLWindow *>(surface);
-
- QSize size = w->geometry().size();
-
- w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height()));
- w->waitForFrameSync(100);
-}
-
-EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
-{
- return static_cast<QWaylandXCompositeEGLWindow *>(surface)->eglSurface();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
deleted file mode 100644
index e0b70bf21..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLCONTEXT_H
-#define QWAYLANDXCOMPOSITEEGLCONTEXT_H
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include <QtEglSupport/private/qeglplatformcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLWindow;
-
-class QWaylandXCompositeEGLContext : public QEGLPlatformContext
-{
-public:
- QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig config);
-
- void swapBuffers(QPlatformSurface *surface) override;
-
-private:
- EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp
deleted file mode 100644
index 57a7ba7b6..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglwindow.h"
-#include "qwaylandxcompositebuffer.h"
-
-#include <QtEglSupport/private/qeglconvenience_p.h>
-#include <QtEglSupport/private/qxlibeglintegration_p.h>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-#include <X11/extensions/Xcomposite.h>
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration)
- : QWaylandWindow(window)
- , m_glxIntegration(glxIntegration)
- , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT))
-{
-}
-
-QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const
-{
- //yeah. this type needs a new name
- return QWaylandWindow::Egl;
-}
-
-void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect)
-{
- QWaylandWindow::setGeometry(rect);
-
- if (m_surface) {
- eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface);
- m_surface = 0;
- }
-}
-
-EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const
-{
- if (!m_surface)
- const_cast<QWaylandXCompositeEGLWindow *>(this)->createEglSurface();
- return m_surface;
-}
-
-void QWaylandXCompositeEGLWindow::createEglSurface()
-{
- QSize size(geometry().size());
- if (size.isEmpty()) {
- // QGLWidget wants a context for a window without geometry
- size = QSize(1,1);
- }
-
- delete m_buffer;
- //XFreePixmap deletes the glxPixmap as well
- if (m_xWindow) {
- XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
- }
-
- VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config);
-
- XVisualInfo visualInfoTemplate;
- memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
- visualInfoTemplate.visualid = visualId;
-
- int matchingCount = 0;
- XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount);
-
- Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone);
-
- XSetWindowAttributes a;
- a.colormap = cmap;
- m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(),
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWColormap, &a);
-
- XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual);
- XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
-
- m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, reinterpret_cast<EGLNativeWindowType>(m_xWindow), nullptr);
- if (m_surface == EGL_NO_SURFACE) {
- qFatal("Could not make eglsurface");
- }
-
- XSync(m_glxIntegration->xDisplay(),False);
- m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
- (uint32_t)m_xWindow,
- size);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
deleted file mode 100644
index 0c8bcf441..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLWINDOW_H
-#define QWAYLANDXCOMPOSITEEGLWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-#include "qwaylandxcompositeeglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLWindow : public QWaylandWindow
-{
-public:
- QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration);
- WindowType windowType() const override;
-
- void setGeometry(const QRect &rect) override;
-
- EGLSurface eglSurface() const;
-
- QWaylandBuffer *buffer() { return m_buffer; }
-
-private:
- void createEglSurface();
-
- QWaylandXCompositeEGLClientBufferIntegration *m_glxIntegration = nullptr;
- QWaylandBuffer *m_buffer = nullptr;
-
- Window m_xWindow = 0;
- EGLConfig m_config;
- EGLSurface m_surface = EGL_NO_SURFACE;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLWINDOW_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri
deleted file mode 100644
index f2beb1e03..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += egl wayland-client
-
-QT += egl_support-private
-
-SOURCES += \
- $$PWD/qwaylandxcompositeeglcontext.cpp \
- $$PWD/qwaylandxcompositeeglclientbufferintegration.cpp \
- $$PWD/qwaylandxcompositeeglwindow.cpp
-
-HEADERS += \
- $$PWD/qwaylandxcompositeeglcontext.h \
- $$PWD/qwaylandxcompositeeglclientbufferintegration.h \
- $$PWD/qwaylandxcompositeeglwindow.h
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp
deleted file mode 100644
index 351887416..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include <QtCore/QDebug>
-
-#include "qwaylandxcompositeglxcontext.h"
-
-#include "qwaylandxcompositeglxwindow.h"
-
-#include <QRegion>
-
-#include <dlfcn.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen)
- : m_display(display),
- m_format(format)
-{
- qDebug("creating XComposite-GLX context");
-
- if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType)
- m_format.setRenderableType(QSurfaceFormat::OpenGL);
-
- if (m_format.renderableType() != QSurfaceFormat::OpenGL) {
- qWarning("Unsupported renderable type");
- return;
- }
-
- GLXContext shareContext = share ? static_cast<QWaylandXCompositeGLXContext *>(share)->m_context : 0;
- GLXFBConfig config = qglx_findConfig(display, screen, m_format, GLX_WINDOW_BIT | GLX_PIXMAP_BIT);
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config);
- m_context = glXCreateContext(display, visualInfo, shareContext, true);
- qglx_surfaceFormatFromGLXFBConfig(&m_format, display, config);
-}
-
-bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface)
-{
- Window xWindow = static_cast<QWaylandXCompositeGLXWindow *>(surface)->xWindow();
-
- return glXMakeCurrent(m_display, xWindow, m_context);
-}
-
-void QWaylandXCompositeGLXContext::doneCurrent()
-{
- glXMakeCurrent(m_display, 0, 0);
-}
-
-void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface)
-{
- QWaylandXCompositeGLXWindow *w = static_cast<QWaylandXCompositeGLXWindow *>(surface);
-
- QSize size = w->geometry().size();
-
- glXSwapBuffers(m_display, w->xWindow());
-
- w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height()));
- w->waitForFrameSync(100);
-}
-
-QFunctionPointer QWaylandXCompositeGLXContext::getProcAddress(const char *procName)
-{
- QFunctionPointer proc = glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName));
- if (!proc)
- proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
- return proc;
-}
-
-QSurfaceFormat QWaylandXCompositeGLXContext::format() const
-{
- return m_format;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
deleted file mode 100644
index 1bb2f4f7d..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXCONTEXT_H
-#define QWAYLANDXCOMPOSITEGLXCONTEXT_H
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandxcompositeglxintegration.h"
-#include <QtGlxSupport/private/qglxconvenience_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXWindow;
-class QWaylandShmBuffer;
-
-class QWaylandXCompositeGLXContext : public QPlatformOpenGLContext
-{
-public:
- QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen);
-
- QSurfaceFormat format() const override;
-
- void swapBuffers(QPlatformSurface *surface) override;
-
- bool makeCurrent(QPlatformSurface *surface) override;
- void doneCurrent() override;
-
- QFunctionPointer getProcAddress(const char *procName) override;
-
-private:
- GLXContext m_context;
-
- Display *m_display = nullptr;
- QSurfaceFormat m_format;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
deleted file mode 100644
index 8be47fa2e..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeglxintegration.h"
-
-#include "qwaylandxcompositeglxwindow.h"
-
-#include <QtCore/QDebug>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration()
-{
- qDebug() << "Using XComposite-GLX";
-}
-
-QWaylandXCompositeGLXIntegration::~QWaylandXCompositeGLXIntegration()
-{
- XCloseDisplay(mDisplay);
-}
-
-void QWaylandXCompositeGLXIntegration::initialize(QWaylandDisplay *display)
-{
- mWaylandDisplay = display;
- mWaylandDisplay->addRegistryListener(QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this);
- while (!mDisplay) {
- display->flushRequests();
- display->blockingReadEvents();
- }
-}
-
-QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window)
-{
- return new QWaylandXCompositeGLXWindow(window, this);
-}
-
-QPlatformOpenGLContext *QWaylandXCompositeGLXIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
-{
- return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen);
-}
-
-Display * QWaylandXCompositeGLXIntegration::xDisplay() const
-{
- return mDisplay;
-}
-
-int QWaylandXCompositeGLXIntegration::screen() const
-{
- return mScreen;
-}
-
-Window QWaylandXCompositeGLXIntegration::rootWindow() const
-{
- return mRootWindow;
-}
-
-QWaylandDisplay * QWaylandXCompositeGLXIntegration::waylandDisplay() const
-{
- return mWaylandDisplay;
-}
-qt_xcomposite * QWaylandXCompositeGLXIntegration::waylandXComposite() const
-{
- return mWaylandComposite;
-}
-
-const struct qt_xcomposite_listener QWaylandXCompositeGLXIntegration::xcomposite_listener = {
- QWaylandXCompositeGLXIntegration::rootInformation
-};
-
-void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
-{
- Q_UNUSED(version);
- if (interface == "qt_xcomposite") {
- qDebug("XComposite-GLX: got qt_xcomposite global");
- QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
- integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry, id, &qt_xcomposite_interface, 1));
- qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
- }
-
-}
-
-void QWaylandXCompositeGLXIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window)
-{
- Q_UNUSED(xcomposite);
- QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
-
- qDebug("XComposite-GLX: xcomposite listener callback");
-
- integration->mDisplay = XOpenDisplay(display_name);
- integration->mRootWindow = (Window) root_window;
- integration->mScreen = XDefaultScreen(integration->mDisplay);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
deleted file mode 100644
index 809690816..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXINTEGRATION_H
-#define QWAYLANDXCOMPOSITEGLXINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-#include <wayland-client-core.h>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QWindow>
-
-#include <X11/Xlib.h>
-
-// avoid clashes with Qt::CursorShape
-#ifdef CursorShape
-# define X_CursorShape CursorShape
-# undef CursorShape
-#endif
-
-struct qt_xcomposite;
-struct qt_xcomposite_listener;
-struct wl_registry;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandXCompositeGLXIntegration();
- ~QWaylandXCompositeGLXIntegration() override;
-
- void initialize(QWaylandDisplay *display) override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- QWaylandDisplay *waylandDisplay() const;
- struct qt_xcomposite *waylandXComposite() const;
-
- Display *xDisplay() const;
- int screen() const;
- Window rootWindow() const;
-
- bool supportsThreadedOpenGL() const override { return false; }
- bool supportsWindowDecoration() const override { return false; }
-
-private:
- QWaylandDisplay *mWaylandDisplay = nullptr;
- struct qt_xcomposite *mWaylandComposite = nullptr;
-
- Display *mDisplay = nullptr;
- int mScreen = 0;
- Window mRootWindow = 0;
-
- static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
-
- static const struct qt_xcomposite_listener xcomposite_listener;
- static void rootInformation(void *data,
- struct qt_xcomposite *xcomposite,
- const char *display_name,
- uint32_t root_window);
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXINTEGRATION_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
deleted file mode 100644
index 2b491e24d..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeglxwindow.h"
-#include "qwaylandxcompositebuffer.h"
-
-#include <QtCore/QDebug>
-
-#include "wayland-xcomposite-client-protocol.h"
-#include <QtGui/QRegion>
-
-#include <X11/extensions/Xcomposite.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration)
- : QWaylandWindow(window)
- , m_glxIntegration(glxIntegration)
- , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT))
-{
-}
-
-QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const
-{
- //yeah. this type needs a new name
- return QWaylandWindow::Egl;
-}
-
-void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect)
-{
- QWaylandWindow::setGeometry(rect);
-
- if (m_xWindow) {
- XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
- m_xWindow = 0;
- }
-}
-
-Window QWaylandXCompositeGLXWindow::xWindow() const
-{
- if (!m_xWindow)
- const_cast<QWaylandXCompositeGLXWindow *>(this)->createSurface();
-
- return m_xWindow;
-}
-
-void QWaylandXCompositeGLXWindow::createSurface()
-{
- QSize size(geometry().size());
- if (size.isEmpty()) {
- //QGLWidget wants a context for a window without geometry
- size = QSize(1,1);
- }
-
- if (!m_glxIntegration->xDisplay()) {
- qWarning("XCompositeGLXWindow: X display still null?!");
- return;
- }
-
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config);
- Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),
- visualInfo->visual, AllocNone);
-
- XSetWindowAttributes a;
- a.background_pixel = WhitePixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen());
- a.border_pixel = BlackPixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen());
- a.colormap = cmap;
- m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(),
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWBackPixel|CWBorderPixel|CWColormap, &a);
-
- XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual);
- XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
-
- XSync(m_glxIntegration->xDisplay(), False);
- mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
- (uint32_t)m_xWindow,
- size);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
deleted file mode 100644
index 45a77a299..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXWINDOW_H
-#define QWAYLANDXCOMPOSITEGLXWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include "qwaylandxcompositeglxintegration.h"
-#include "qwaylandxcompositeglxcontext.h"
-
-#include <QtCore/QWaitCondition>
-
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXWindow : public QWaylandWindow
-{
-public:
- QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration);
- WindowType windowType() const override;
-
- void setGeometry(const QRect &rect) override;
-
- Window xWindow() const;
-
- QWaylandBuffer *buffer() { return mBuffer; }
-
-private:
- void createSurface();
-
- QWaylandXCompositeGLXIntegration *m_glxIntegration = nullptr;
-
- Window m_xWindow = 0;
- GLXFBConfig m_config;
- QWaylandBuffer *mBuffer = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXWINDOW_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri
deleted file mode 100644
index a2f5376a9..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-include ($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += wayland-client glx libdl
-
-QT += glx_support-private
-
-SOURCES += \
- $$PWD/qwaylandxcompositeglxcontext.cpp \
- $$PWD/qwaylandxcompositeglxintegration.cpp \
- $$PWD/qwaylandxcompositeglxwindow.cpp
-
-HEADERS += \
- $$PWD/qwaylandxcompositeglxcontext.h \
- $$PWD/qwaylandxcompositeglxintegration.h \
- $$PWD/qwaylandxcompositeglxwindow.h
diff --git a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp
deleted file mode 100644
index 33d9a6038..000000000
--- a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositebuffer.h"
-
-#include "wayland-xcomposite-client-protocol.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(qt_xcomposite *xcomposite, uint32_t window, const QSize &size)
- :mSize(size)
-{
- mBuffer = qt_xcomposite_create_buffer(xcomposite,
- window,
- size.width(),
- size.height());
-}
-
-QSize QWaylandXCompositeBuffer::size() const
-{
- return mSize;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h b/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
deleted file mode 100644
index 3ff7c51ce..000000000
--- a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEBUFFER_H
-#define QWAYLANDXCOMPOSITEBUFFER_H
-
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-#include <stdint.h>
-
-struct qt_xcomposite;
-struct wl_visual;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeBuffer : public QWaylandBuffer
-{
-public:
- QWaylandXCompositeBuffer(qt_xcomposite *xcomposite,
- uint32_t window,
- const QSize &size);
-
- QSize size() const;
-private:
- QSize mSize;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEBUFFER_H
diff --git a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri
deleted file mode 100644
index d2b129d03..000000000
--- a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-INCLUDEPATH += $$PWD
-
-QMAKE_USE += xcomposite x11
-CONFIG += wayland-scanner-client-wayland-protocol-include
-WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/xcomposite.xml
-
-HEADERS += \
- $$PWD/qwaylandxcompositebuffer.h
-
-SOURCES += \
- $$PWD/qwaylandxcompositebuffer.cpp
diff --git a/src/hardwareintegration/compositor/CMakeLists.txt b/src/hardwareintegration/compositor/CMakeLists.txt
new file mode 100644
index 000000000..8da6b3ce1
--- /dev/null
+++ b/src/hardwareintegration/compositor/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+endif()
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
index 760762572..1380bd5b8 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "brcmbuffer.h"
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
index 7350961a2..6a21c3f5c 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef BRCMBUFFER_H
#define BRCMBUFFER_H
@@ -33,8 +7,8 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+#include <QtCore/QList>
#include <QtCore/QSize>
-#include <QtCore/QVector>
#include <EGL/egl.h>
@@ -60,7 +34,7 @@ protected:
void buffer_destroy(Resource *resource) override;
private:
- QVector<EGLint> m_handle;
+ QList<EGLint> m_handle;
bool m_invertedY = false;
QSize m_size;
};
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
index 8ddb4f951..178a2e30a 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "brcmeglintegration.h"
#include "brcmbuffer.h"
@@ -67,48 +41,46 @@ BrcmEglIntegration::BrcmEglIntegration()
{
}
-bool BrcmEglIntegration::initializeHardware(struct ::wl_display *display)
+void BrcmEglIntegration::initializeHardware(struct ::wl_display *display)
{
Q_D(BrcmEglIntegration);
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (!nativeInterface)
- return false;
+ if (nativeInterface) {
+ d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
+ if (!d->egl_display)
+ qWarning("Failed to acquire EGL display from platform integration");
- d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
- if (!d->egl_display)
- qWarning("Failed to acquire EGL display from platform integration");
+ d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM");
- d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM");
+ if (!d->eglQueryGlobalImageBRCM) {
+ qWarning("Failed to resolve eglQueryGlobalImageBRCM");
+ return;
+ }
- if (!d->eglQueryGlobalImageBRCM) {
- qWarning("Failed to resolve eglQueryGlobalImageBRCM");
- return false;
- }
-
- d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+ d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
- if (!d->glEGLImageTargetTexture2DOES) {
- qWarning("Failed to resolve glEGLImageTargetTexture2DOES");
- return false;
- }
+ if (!d->glEGLImageTargetTexture2DOES) {
+ qWarning("Failed to resolve glEGLImageTargetTexture2DOES");
+ return;
+ }
- d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
+ d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
- if (!d->eglCreateImageKHR) {
- qWarning("Failed to resolve eglCreateImageKHR");
- return false;
- }
+ if (!d->eglCreateImageKHR) {
+ qWarning("Failed to resolve eglCreateImageKHR");
+ return;
+ }
- d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
+ d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
- if (!d->eglDestroyImageKHR) {
- qWarning("Failed to resolve eglDestroyImageKHR");
- return false;
+ if (!d->eglDestroyImageKHR) {
+ qWarning("Failed to resolve eglDestroyImageKHR");
+ return;
+ }
+ d->valid = true;
+ init(display, 1);
}
- d->valid = true;
- init(display, 1);
- return true;
}
QtWayland::ClientBuffer *BrcmEglIntegration::createBufferFor(wl_resource *buffer)
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
index 4bc98e8c5..4ee5d404e 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef BRCMEGLINTEGRATION_H
#define BRCMEGLINTEGRATION_H
@@ -47,7 +21,7 @@ class BrcmEglIntegration : public QtWayland::ClientBufferIntegration, public QtW
public:
BrcmEglIntegration();
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
protected:
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri b/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
index 2df101092..41f483c48 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
@@ -1,6 +1,6 @@
INCLUDEPATH += $$PWD
-QMAKE_USE_PRIVATE += egl wayland-server
+QMAKE_USE_PRIVATE += egl drm wayland-server
SOURCES += \
$$PWD/dmabufserverbufferintegration.cpp
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
index c72cf2d0a..a217c1c89 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "dmabufserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <drm_fourcc.h>
#include <unistd.h>
@@ -53,7 +27,7 @@ DmaBufServerBuffer::DmaBufServerBuffer(DmaBufServerBufferIntegration *integratio
int err = eglGetError();
if (err != EGL_SUCCESS || m_image == EGL_NO_IMAGE_KHR)
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer error creating EGL image" << hex << err;
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer error creating EGL image" << Qt::hex << err;
// TODO: formats with more than one plane
@@ -61,7 +35,7 @@ DmaBufServerBuffer::DmaBufServerBuffer(DmaBufServerBufferIntegration *integratio
if (!m_integration->eglExportDMABUFImageQueryMESA(m_image, &m_fourcc_format, &num_planes, nullptr)) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer: Failed to query egl image";
- qCDebug(qLcWaylandCompositorHardwareIntegration) << "error" << hex << eglGetError();
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "error" << Qt::hex << eglGetError();
} else {
qCDebug(qLcWaylandCompositorHardwareIntegration) << "num_planes" << num_planes << "fourcc_format" << m_fourcc_format;
if (num_planes != 1) {
@@ -75,7 +49,7 @@ DmaBufServerBuffer::DmaBufServerBuffer(DmaBufServerBufferIntegration *integratio
}
if (!m_integration->eglExportDMABUFImageMESA(m_image, &m_fd, &m_stride, &m_offset)) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer: Failed to export egl image. Error code" << hex << eglGetError();
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer: Failed to export egl image. Error code" << Qt::hex << eglGetError();
} else {
qCDebug(qLcWaylandCompositorHardwareIntegration) << "DmaBufServerBuffer exported egl image: fd" << m_fd << "stride" << m_stride << "offset" << m_offset;
m_texture->release();
@@ -89,7 +63,7 @@ DmaBufServerBuffer::~DmaBufServerBuffer()
int err;
m_integration->eglDestroyImageKHR(m_image);
if ((err = eglGetError()) != EGL_SUCCESS)
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "~DmaBufServerBuffer: eglDestroyImageKHR error" << hex << err;
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "~DmaBufServerBuffer: eglDestroyImageKHR error" << Qt::hex << err;
err = ::close(m_fd);
if (err)
@@ -126,7 +100,7 @@ QOpenGLTexture *DmaBufServerBuffer::toOpenGlTexture()
bool DmaBufServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DmaBufServerBufferIntegration::DmaBufServerBufferIntegration()
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
index 4e9f8c741..eb559686c 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-qt-dmabuf-server-buffer.h"
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index 03b389eff..3c49f30a4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "drmeglserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
QT_BEGIN_NAMESPACE
@@ -113,7 +87,7 @@ QOpenGLTexture *DrmEglServerBuffer::toOpenGlTexture()
bool DrmEglServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration()
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
index eab5f0c56..e99a62542 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-drm-egl-server-buffer.h"
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
index a0abf6972..c30bf5ae3 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "vsp2hardwarelayerintegration.h"
@@ -41,7 +15,9 @@ extern "C" {
#include <QWaylandQuickOutput>
#include <QQuickWindow>
-#include <QtPlatformHeaders/qeglfsfunctions.h>
+#include <qpa/qlatformscreen_p.h>
+
+using namespace QNativeInterface::Private;
QT_BEGIN_NAMESPACE
@@ -56,13 +32,17 @@ Vsp2Buffer::Vsp2Buffer(wl_kms_buffer *kmsBuffer)
Vsp2Layer::Vsp2Layer(QWaylandQuickHardwareLayer *hwLayer, Vsp2HardwareLayerIntegration *integration)
: m_hwLayer(hwLayer)
{
+ auto *wlItem = m_hwLayer->waylandItem();
+ m_screen = dynamic_cast<QVsp2Screen*>(wlItem->window()->screen()->handle());
+ Q_ASSERT(m_screen);
+
connect(hwLayer, &QWaylandQuickHardwareLayer::stackingLevelChanged, this, [integration](){
integration->recreateVspLayers();
});
connect(hwLayer->waylandItem(), &QWaylandQuickItem::surfaceChanged, this, &Vsp2Layer::handleSurfaceChanged);
connect(hwLayer->waylandItem(), &QQuickItem::opacityChanged, this, &Vsp2Layer::updateOpacity);
connect(hwLayer->waylandItem()->window(), &QQuickWindow::afterSynchronizing, this, &Vsp2Layer::updatePosition);
- hwLayer->disableSceneGraphPainting();
+ hwLayer->setSceneGraphPainting(false);
QWaylandViewPrivate::get(hwLayer->waylandItem()->view())->independentFrameCallback = true;
handleSurfaceChanged();
}
@@ -76,16 +56,17 @@ void Vsp2Layer::enableVspLayer()
m_buffer = Vsp2Buffer(kmsBuffer);
updatePosition();
+
+ m_layerIndex = m_screen->addLayer(m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine);
+
auto *wlItem = m_hwLayer->waylandItem();
- m_screen = wlItem->window()->screen();
- m_layerIndex = QEglFSFunctions::vsp2AddLayer(m_screen, m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine);
wlItem->surface()->frameStarted();
updateOpacity();
}
void Vsp2Layer::disableVspLayer()
{
- QEglFSFunctions::vsp2RemoveLayer(m_screen, m_layerIndex);
+ m_screen->removeLayer(m_layerIndex);
m_layerIndex = -1;
m_screen = nullptr;
}
@@ -112,9 +93,9 @@ void Vsp2Layer::handleBufferCommitted()
}
m_buffer = newBuffer;
+ m_screen->setLayerBuffer(m_layerIndex, m_buffer.dmabufFd);
+
auto *wlItem = m_hwLayer->waylandItem();
- m_screen = wlItem->window()->screen();
- QEglFSFunctions::vsp2SetLayerBuffer(m_screen, m_layerIndex, m_buffer.dmabufFd);
wlItem->surface()->frameStarted();
}
@@ -147,14 +128,14 @@ void Vsp2Layer::updatePosition()
m_position = globalGeometry.topLeft().toPoint();
if (isEnabled())
- QEglFSFunctions::vsp2SetLayerPosition(m_screen, m_layerIndex, m_position);
+ m_screen->setLayerPosition(m_layerIndex, m_position);
}
void Vsp2Layer::updateOpacity()
{
if (isEnabled()) {
qreal opacity = m_hwLayer->waylandItem()->opacity();
- QEglFSFunctions::vsp2SetLayerAlpha(m_screen, m_layerIndex, opacity);
+ m_screen->setLayerAlpha(m_layerIndex, opacity);
}
}
@@ -181,7 +162,7 @@ wl_kms_buffer *Vsp2Layer::nextKmsBuffer()
void Vsp2HardwareLayerIntegration::enableVspLayers()
{
- for (auto &layer : qAsConst(m_layers)) {
+ for (auto &layer : std::as_const(m_layers)) {
Q_ASSERT(!layer->isEnabled());
layer->enableVspLayer();
}
@@ -216,7 +197,8 @@ Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration()
<< "You need to set QT_QPA_PLATFORM=eglfs and QT_QPA_EGLFS_INTEGRATION=eglfs_kms_vsp2";
}
static Vsp2HardwareLayerIntegration *s_instance = this;
- QEglFSFunctions::vsp2AddBlendListener(QGuiApplication::primaryScreen(), [](){
+ auto screen = dynamic_cast<QVsp2Screen*>(QGuiApplication::primaryScreen()->handle());
+ screen->addBlendListener([](){
s_instance->sendFrameCallbacks();
});
}
@@ -243,7 +225,7 @@ void Vsp2HardwareLayerIntegration::remove(QWaylandQuickHardwareLayer *hwLayer)
void Vsp2HardwareLayerIntegration::sendFrameCallbacks()
{
- for (auto &layer : qAsConst(m_layers)) {
+ for (auto &layer : std::as_const(m_layers)) {
if (auto *surface = layer->hwLayer()->waylandItem()->surface())
surface->sendFrameCallbacks();
}
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
index 64b562d8e..3ec77957f 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 VSP2HARDWARELAYERINTEGRATION_H
#define VSP2HARDWARELAYERINTEGRATION_H
@@ -40,6 +14,10 @@ struct wl_kms_buffer;
QT_BEGIN_NAMESPACE
+namespace QNativeInterface::Private {
+struct QVsp2Screen;
+}
+
class QScreen;
class QWaylandSurface;
class QWaylandQuickHardwareLayer;
@@ -56,7 +34,7 @@ public:
void remove(QWaylandQuickHardwareLayer *layer) override;
void sendFrameCallbacks();
- QVector<QSharedPointer<Vsp2Layer>> m_layers;
+ QList<QSharedPointer<Vsp2Layer>> m_layers;
private:
void enableVspLayers();
void disableVspLayers();
@@ -86,7 +64,7 @@ public:
bool isEnabled() { return m_layerIndex != -1; }
QWaylandQuickHardwareLayer *hwLayer() const { return m_hwLayer; }
-public slots:
+public Q_SLOTS:
void handleBufferCommitted();
void handleSurfaceChanged();
void updatePosition();
@@ -95,7 +73,7 @@ public slots:
private:
wl_kms_buffer *nextKmsBuffer();
int m_layerIndex = -1;
- QScreen *m_screen = nullptr;
+ QVsp2Screen *m_screen = nullptr;
QPoint m_position;
QWaylandQuickHardwareLayer *m_hwLayer = nullptr;
QWaylandSurface *m_surface = nullptr;
diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
index f9ef5635d..f28c6df6d 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "libhybriseglserverbufferintegration.h"
diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
index addbb71f5..3759a3329 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
@@ -83,8 +57,8 @@ private:
int32_t m_stride;
QOpenGLTexture *m_texture = nullptr;
QtWaylandServer::qt_libhybris_egl_server_buffer::format m_hybris_format;
- QVector<int32_t> m_ints;
- QVector<int32_t> m_fds;
+ QList<int32_t> m_ints;
+ QList<int32_t> m_fds;
};
class LibHybrisEglServerBufferIntegration :
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
index a7630040e..a8baefc98 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
@@ -1,12 +1,10 @@
INCLUDEPATH += $$PWD
-QMAKE_USE_PRIVATE += egl wayland-server
+QMAKE_USE_PRIVATE += egl drm wayland-server
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += $$PWD/../../../3rdparty/protocol/linux-dmabuf-unstable-v1.xml
-QT += egl_support-private
-
SOURCES += \
$$PWD/linuxdmabufclientbufferintegration.cpp \
$$PWD/linuxdmabuf.cpp
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
index 28015d35b..a608b9c4d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
@@ -1,36 +1,11 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "linuxdmabuf.h"
#include "linuxdmabufclientbufferintegration.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
@@ -44,7 +19,7 @@ LinuxDmabuf::LinuxDmabuf(wl_display *display, LinuxDmabufClientBufferIntegration
{
}
-void LinuxDmabuf::setSupportedModifiers(const QHash<uint32_t, QVector<uint64_t>> &modifiers)
+void LinuxDmabuf::setSupportedModifiers(const QHash<uint32_t, QList<uint64_t>> &modifiers)
{
Q_ASSERT(resourceMap().isEmpty());
m_modifiers = modifiers;
@@ -58,7 +33,7 @@ void LinuxDmabuf::zwp_linux_dmabuf_v1_bind_resource(Resource *resource)
// send DRM_FORMAT_MOD_INVALID when no modifiers are supported for a format
if (modifiers.isEmpty())
modifiers << DRM_FORMAT_MOD_INVALID;
- for (const auto &modifier : qAsConst(modifiers)) {
+ for (const auto &modifier : std::as_const(modifiers)) {
if (resource->version() >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
const uint32_t modifier_lo = modifier & 0xFFFFFFFF;
const uint32_t modifier_hi = modifier >> 32;
@@ -118,7 +93,7 @@ bool LinuxDmabufParams::handleCreateParams(Resource *resource, int width, int he
// check for holes in plane sequence
auto planeIds = m_planes.keys();
std::sort(planeIds.begin(), planeIds.end());
- for (int i = 0; i < planeIds.count(); ++i) {
+ for (int i = 0; i < planeIds.size(); ++i) {
if (uint(i) != planeIds[i]) {
wl_resource_post_error(resource->handle,
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE,
@@ -283,10 +258,17 @@ LinuxDmabufWlBuffer::~LinuxDmabufWlBuffer()
void LinuxDmabufWlBuffer::buffer_destroy(Resource *resource)
{
Q_UNUSED(resource);
+
+ QMutexLocker locker(&m_texturesLock);
+
for (uint32_t i = 0; i < m_planesNumber; ++i) {
if (m_textures[i] != nullptr) {
- m_clientBufferIntegration->deleteGLTextureWhenPossible(m_textures[i]);
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(m_textures[i],
+ m_texturesContext[i]);
m_textures[i] = nullptr;
+ m_texturesContext[i] = nullptr;
+ QObject::disconnect(m_texturesAboutToBeDestroyedConnection[i]);
+ m_texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
}
if (m_eglImages[i] != EGL_NO_IMAGE_KHR) {
m_clientBufferIntegration->deleteImage(m_eglImages[i]);
@@ -308,9 +290,40 @@ void LinuxDmabufWlBuffer::initImage(uint32_t plane, EGLImageKHR image)
void LinuxDmabufWlBuffer::initTexture(uint32_t plane, QOpenGLTexture *texture)
{
+ QMutexLocker locker(&m_texturesLock);
+
Q_ASSERT(plane < m_planesNumber);
Q_ASSERT(m_textures.at(plane) == nullptr);
+ Q_ASSERT(QOpenGLContext::currentContext());
m_textures[plane] = texture;
+ m_texturesContext[plane] = QOpenGLContext::currentContext();
+
+ m_texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(m_texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ m_texturesContext[plane], [this, plane]() {
+
+ QMutexLocker locker(&this->m_texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from m_textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (this->m_textures[plane] == nullptr)
+ return;
+
+ delete this->m_textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(this->m_textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(this->m_texturesContext[plane]);
+
+ this->m_textures[plane] = nullptr;
+ this->m_texturesContext[plane] = nullptr;
+
+ QObject::disconnect(this->m_texturesAboutToBeDestroyedConnection[plane]);
+ this->m_texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
}
void LinuxDmabufWlBuffer::buffer_destroy_resource(Resource *resource)
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
index 8554721e1..dba4e3980 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 LINUXDMABUF_H
#define LINUXDMABUF_H
@@ -35,11 +9,15 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QSize>
#include <QtCore/QTextStream>
-#include <QtGui/QOpenGLTexture>
+
+#include <array>
+#include <QtGui/QOpenGLContext>
+#include <QtCore/QMutex>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -58,6 +36,12 @@
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
#endif
+// Copied from eglmesaext.h
+#ifndef EGL_WL_bind_wayland_display
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+#endif
+
QT_BEGIN_NAMESPACE
class QWaylandCompositor;
@@ -77,14 +61,14 @@ class LinuxDmabuf : public QtWaylandServer::zwp_linux_dmabuf_v1
public:
explicit LinuxDmabuf(wl_display *display, LinuxDmabufClientBufferIntegration *clientBufferIntegration);
- void setSupportedModifiers(const QHash<uint32_t, QVector<uint64_t>> &modifiers);
+ void setSupportedModifiers(const QHash<uint32_t, QList<uint64_t>> &modifiers);
protected:
void zwp_linux_dmabuf_v1_bind_resource(Resource *resource) override;
void zwp_linux_dmabuf_v1_create_params(Resource *resource, uint32_t params_id) override;
private:
- QHash<uint32_t, QVector<uint64_t>> m_modifiers; // key=DRM format, value=supported DRM modifiers for format
+ QHash<uint32_t, QList<uint64_t>> m_modifiers; // key=DRM format, value=supported DRM modifiers for format
LinuxDmabufClientBufferIntegration *m_clientBufferIntegration;
};
@@ -141,6 +125,10 @@ private:
LinuxDmabufClientBufferIntegration *m_clientBufferIntegration = nullptr;
std::array<EGLImageKHR, MaxDmabufPlanes> m_eglImages = { {EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR} };
std::array<QOpenGLTexture *, MaxDmabufPlanes> m_textures = { {nullptr, nullptr, nullptr, nullptr} };
+ std::array<QOpenGLContext *, MaxDmabufPlanes> m_texturesContext = { {nullptr, nullptr, nullptr, nullptr} };
+ std::array<QMetaObject::Connection, MaxDmabufPlanes> m_texturesAboutToBeDestroyedConnection = { {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()} };
+ QMutex m_texturesLock;
+
void freeResources();
void buffer_destroy(Resource *resource) override;
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
index 4f01f855e..205f25d1f 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
@@ -1,41 +1,17 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "linuxdmabufclientbufferintegration.h"
#include "linuxdmabuf.h"
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <qpa/qplatformnativeinterface.h>
+#include <QtOpenGL/QOpenGLTexture>
+#include <QtCore/QVarLengthArray>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -89,7 +65,7 @@ static QWaylandBufferRef::BufferFormatEgl formatFromDrmFormat(EGLint format) {
case DRM_FORMAT_YUYV:
return QWaylandBufferRef::BufferFormatEgl_Y_XUXV;
default:
- qCDebug(qLcWaylandCompositorHardwareIntegration) << "Buffer format" << hex << format << "not supported";
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Buffer format" << Qt::hex << format << "not supported";
return QWaylandBufferRef::BufferFormatEgl_Null;
}
}
@@ -105,6 +81,11 @@ static QOpenGLTexture::TextureFormat openGLFormatFromBufferFormat(QWaylandBuffer
}
}
+// Initialize the EGLImage for a dmabuf buffer which conceptually consists of a
+// single plane. Note that depending on the modifiers, the buffer may be actually
+// transported as multiple dmabuf planes which must be combined into a single
+// EGLImage. For formats where the buffer needs to be represented as multiple
+// EGLImages (e.g., various YUV formats) a different approach is required.
bool LinuxDmabufClientBufferIntegration::initSimpleTexture(LinuxDmabufWlBuffer *dmabufBuffer)
{
bool success = true;
@@ -118,79 +99,67 @@ bool LinuxDmabufClientBufferIntegration::initSimpleTexture(LinuxDmabufWlBuffer *
success = false;
}
- for (uint32_t i = 0; i < dmabufBuffer->planesNumber(); ++i) {
- QVarLengthArray<EGLint, 17> attribs;
- switch (i) {
- case 0:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE0_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE0_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE0_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 1:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE1_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE1_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE1_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 2:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE2_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE2_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE2_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 3:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE3_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE3_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE3_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
+ // 6 entries for the common attribs plus 10 per possible plane, plus 1 for
+ // the final EGL_NONE sentinel.
+ QVarLengthArray<EGLint, 6 + 10 * 4 + 1> attribs;
+
+ attribs.append(EGL_WIDTH);
+ attribs.append(dmabufBuffer->size().width());
+ attribs.append(EGL_HEIGHT);
+ attribs.append(dmabufBuffer->size().height());
+ attribs.append(EGL_LINUX_DRM_FOURCC_EXT);
+ attribs.append(EGLint(dmabufBuffer->drmFormat()));
+
+#define ADD_PLANE_ATTRIBS(plane_idx) { \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _FD_EXT); \
+ attribs.append(dmabufBuffer->plane(plane_idx).fd); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _OFFSET_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).offset)); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _PITCH_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).stride)); \
+ if (dmabufBuffer->plane(plane_idx).modifiers != DRM_FORMAT_MOD_INVALID) { \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_LO_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).modifiers & 0xffffffff)); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_HI_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).modifiers >> 32)); \
+ } \
+}
+
+ switch (dmabufBuffer->planesNumber()) {
+ case 4:
+ ADD_PLANE_ATTRIBS(3);
+ Q_FALLTHROUGH();
+ case 3:
+ ADD_PLANE_ATTRIBS(2);
+ Q_FALLTHROUGH();
+ case 2:
+ ADD_PLANE_ATTRIBS(1);
+ Q_FALLTHROUGH();
+ case 1:
+ ADD_PLANE_ATTRIBS(0);
break;
- default:
- return false;
- }
+ default:
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Buffer uses invalid number of planes:" << dmabufBuffer->planesNumber();
+ return false;
+ }
- // note: EGLImageKHR does NOT take ownership of the file descriptors
- EGLImageKHR image = egl_create_image(m_eglDisplay,
- EGL_NO_CONTEXT,
- EGL_LINUX_DMA_BUF_EXT,
- (EGLClientBuffer) nullptr,
- attribs.constData());
+ attribs.append(EGL_NONE);
- if (image == EGL_NO_IMAGE_KHR) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "failed to create EGL image for plane" << i;
- success = false;
- }
+ // note: EGLImageKHR does NOT take ownership of the file descriptors
+ EGLImageKHR image = egl_create_image(m_eglDisplay,
+ EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer) nullptr,
+ attribs.constData());
- dmabufBuffer->initImage(i, image);
+ if (image == EGL_NO_IMAGE_KHR) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "failed to create EGL image from" <<
+ dmabufBuffer->planesNumber() << "plane(s)";
+ success = false;
}
+
+ dmabufBuffer->initImage(0, image);
+
return success;
}
@@ -273,9 +242,15 @@ LinuxDmabufClientBufferIntegration::LinuxDmabufClientBufferIntegration()
LinuxDmabufClientBufferIntegration::~LinuxDmabufClientBufferIntegration()
{
m_importedBuffers.clear();
+
+ if (egl_unbind_wayland_display != nullptr && m_displayBound) {
+ Q_ASSERT(m_wlDisplay != nullptr);
+ if (!egl_unbind_wayland_display(m_eglDisplay, m_wlDisplay))
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed";
+ }
}
-bool LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
+void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
{
m_linuxDmabuf.reset(new LinuxDmabuf(display, this));
@@ -286,107 +261,94 @@ bool LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display
egl_query_dmabuf_formats_ext = reinterpret_cast<PFNEGLQUERYDMABUFFORMATSEXTPROC>(eglGetProcAddress("eglQueryDmaBufFormatsEXT"));
if (!egl_query_dmabuf_modifiers_ext || !egl_query_dmabuf_formats_ext) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglQueryDmaBufModifiersEXT and eglQueryDmaBufFormatsEXT.";
- return false;
+ return;
}
egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));
if ((!egl_bind_wayland_display || !egl_unbind_wayland_display) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.";
- return false;
+ return;
}
egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!egl_create_image || !egl_destroy_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.";
- return false;
+ return;
}
// initialize EGL display
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. No native platform interface available.";
- return false;
+ return;
}
m_eglDisplay = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!m_eglDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not get EglDisplay for window.";
- return false;
+ return;
}
const char *extensionString = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_EXT_image_dma_buf_import")) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. There is no EGL_EXT_image_dma_buf_import extension.";
- return false;
+ return;
}
if (strstr(extensionString, "EGL_EXT_image_dma_buf_import_modifiers"))
m_supportsDmabufModifiers = true;
if (egl_bind_wayland_display && egl_unbind_wayland_display) {
m_displayBound = egl_bind_wayland_display(m_eglDisplay, display);
- if (!m_displayBound) {
- if (ignoreBindDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not bind Wayland display. Ignoring.";
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not bind Wayland display.";
- return false;
- }
- }
+ if (!m_displayBound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
+ m_wlDisplay = display;
}
// request and sent formats/modifiers only after egl_display is bound
- QHash<uint32_t, QVector<uint64_t>> modifiers;
+ QHash<uint32_t, QList<uint64_t>> modifiers;
for (const auto &format : supportedDrmFormats()) {
modifiers[format] = supportedDrmModifiers(format);
}
m_linuxDmabuf->setSupportedModifiers(modifiers);
- return true;
}
-QVector<uint32_t> LinuxDmabufClientBufferIntegration::supportedDrmFormats()
+QList<uint32_t> LinuxDmabufClientBufferIntegration::supportedDrmFormats()
{
if (!egl_query_dmabuf_formats_ext)
- return QVector<uint32_t>();
+ return QList<uint32_t>();
// request total number of formats
EGLint count = 0;
EGLBoolean success = egl_query_dmabuf_formats_ext(m_eglDisplay, 0, nullptr, &count);
if (success && count > 0) {
- QVector<uint32_t> drmFormats(count);
+ QList<uint32_t> drmFormats(count);
if (egl_query_dmabuf_formats_ext(m_eglDisplay, count, (EGLint *) drmFormats.data(), &count))
return drmFormats;
}
- return QVector<uint32_t>();
+ return QList<uint32_t>();
}
-QVector<uint64_t> LinuxDmabufClientBufferIntegration::supportedDrmModifiers(uint32_t format)
+QList<uint64_t> LinuxDmabufClientBufferIntegration::supportedDrmModifiers(uint32_t format)
{
if (!egl_query_dmabuf_modifiers_ext)
- return QVector<uint64_t>();
+ return QList<uint64_t>();
// request total number of formats
EGLint count = 0;
EGLBoolean success = egl_query_dmabuf_modifiers_ext(m_eglDisplay, format, 0, nullptr, nullptr, &count);
if (success && count > 0) {
- QVector<uint64_t> modifiers(count);
+ QList<uint64_t> modifiers(count);
if (egl_query_dmabuf_modifiers_ext(m_eglDisplay, format, count, modifiers.data(), nullptr, &count)) {
return modifiers;
}
}
- return QVector<uint64_t>();
-}
-
-void LinuxDmabufClientBufferIntegration::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(m_orphanedTextures);
- m_orphanedTextures.clear();
+ return QList<uint64_t>();
}
void LinuxDmabufClientBufferIntegration::deleteImage(EGLImageKHR image)
@@ -396,16 +358,12 @@ void LinuxDmabufClientBufferIntegration::deleteImage(EGLImageKHR image)
QtWayland::ClientBuffer *LinuxDmabufClientBufferIntegration::createBufferFor(wl_resource *resource)
{
- // fallback for shared memory buffers
- if (wl_shm_buffer_get(resource))
- return nullptr;
-
auto it = m_importedBuffers.find(resource);
if (it != m_importedBuffers.end()) {
m_importedBuffers.value(resource);
return new LinuxDmabufClientBuffer(this, it.value()->resource()->handle, m_importedBuffers.value(resource));
}
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not create client buffer for dmabuf buffer";
+
return nullptr;
}
@@ -439,7 +397,7 @@ LinuxDmabufClientBuffer::LinuxDmabufClientBuffer(LinuxDmabufClientBufferIntegrat
QOpenGLTexture *LinuxDmabufClientBuffer::toOpenGlTexture(int plane)
{
// At this point we should have a valid OpenGL context, so it's safe to destroy textures
- m_integration->deleteOrphanedTextures();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
@@ -457,6 +415,7 @@ QOpenGLTexture *LinuxDmabufClientBuffer::toOpenGlTexture(int plane)
}
if (m_textureDirty) {
+ m_textureDirty = false;
texture->bind();
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
m_integration->gl_egl_image_target_texture_2d(target, d->image(plane));
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
index 8909fa89f..b72a24d5d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 LINUXDMABUFCLIENTBUFFERINTEGRATION_H
#define LINUXDMABUFCLIENTBUFFERINTEGRATION_H
@@ -35,6 +9,7 @@
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/QMutex>
#include <drm_fourcc.h>
@@ -67,13 +42,11 @@ public:
LinuxDmabufClientBufferIntegration();
~LinuxDmabufClientBufferIntegration() override;
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *resource) override;
bool importBuffer(wl_resource *resource, LinuxDmabufWlBuffer *linuxDmabufBuffer);
void removeBuffer(wl_resource *resource);
- void deleteOrphanedTextures();
void deleteImage(EGLImageKHR image);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { m_orphanedTextures << texture; }
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d = nullptr;
private:
@@ -88,12 +61,13 @@ private:
bool initSimpleTexture(LinuxDmabufWlBuffer *dmabufBuffer);
bool initYuvTexture(LinuxDmabufWlBuffer *dmabufBuffer);
- QVector<uint32_t> supportedDrmFormats();
- QVector<uint64_t> supportedDrmModifiers(uint32_t format);
+ QList<uint32_t> supportedDrmFormats();
+ QList<uint64_t> supportedDrmModifiers(uint32_t format);
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ ::wl_display *m_wlDisplay = nullptr;
bool m_displayBound = false;
- QVector<QOpenGLTexture *> m_orphanedTextures;
+
QHash<EGLint, YuvFormatConversion> m_yuvFormats;
bool m_supportsDmabufModifiers = false;
QHash<struct ::wl_resource *, LinuxDmabufWlBuffer *> m_importedBuffers;
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
index 7d7efee36..6dc99e193 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 "shmserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtCore/QSharedMemory>
#include <QtCore/QDebug>
@@ -59,7 +33,8 @@ ShmServerBuffer::ShmServerBuffer(ShmServerBufferIntegration *integration, const
}
QString key = "qt_shm_emulation_" + QString::number(qimage.cacheKey());
- m_shm = new QSharedMemory(key);
+ // ### Use proper native keys the next time we can break protocol compatibility
+ QT_IGNORE_DEPRECATIONS(m_shm = new QSharedMemory(key);)
qsizetype shm_size = qimage.sizeInBytes();
bool ok = m_shm->create(shm_size) && m_shm->lock();
if (ok) {
@@ -86,7 +61,8 @@ struct ::wl_resource *ShmServerBuffer::resourceForClient(struct ::wl_client *cli
}
struct ::wl_resource *shm_integration_resource = integrationResource->handle;
Resource *resource = add(client, 1);
- m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, m_shm->key(), m_width, m_height, m_bpl, m_shm_format);
+ QT_IGNORE_DEPRECATIONS(const QString shmKey = m_shm->key();)
+ m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, shmKey, m_width, m_height, m_bpl, m_shm_format);
return resource->handle;
}
return bufferResource->handle;
@@ -94,7 +70,7 @@ struct ::wl_resource *ShmServerBuffer::resourceForClient(struct ::wl_client *cli
bool ShmServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
QOpenGLTexture *ShmServerBuffer::toOpenGlTexture()
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
index 95439f080..527e65cb7 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
@@ -1,31 +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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SHMSERVERBUFFERINTEGRATION_H
#define SHMSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri b/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
index 63a96ad0f..9a457a173 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
@@ -1,8 +1,7 @@
INCLUDEPATH += $$PWD $$PWD/../../../3rdparty/util
-QT += vulkan_support-private
-
QMAKE_USE_PRIVATE += wayland-server
+QT += opengl-private
SOURCES += \
$$PWD/vulkanserverbufferintegration.cpp \
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
index 602e25f73..1b5aea29a 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
@@ -1,38 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "vulkanserverbufferintegration.h"
#include "vulkanwrapper.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
#include <QtGui/qopengl.h>
@@ -42,7 +16,7 @@
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
-static constexpr bool extraDebug = false;
+static constexpr bool vsbiExtraDebug = false;
#define DECL_GL_FUNCTION(name, type) \
type name
@@ -205,7 +179,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
return nullptr;
funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
- if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
int dupfd = fcntl(m_fd, F_DUPFD_CLOEXEC, 0);
@@ -215,7 +189,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
}
funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, dupfd);
- if (extraDebug) qDebug() << "glImportMemoryFdEXT" << hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
if (!m_texture)
@@ -223,13 +197,13 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
m_texture->create();
GLuint texId = m_texture->textureId();
- if (extraDebug) qDebug() << "created texture" << texId << hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "created texture" << texId << Qt::hex << glGetError();
m_texture->bind();
- if (extraDebug) qDebug() << "bound texture" << texId << hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "bound texture" << texId << Qt::hex << glGetError();
funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_glInternalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
- if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << hex << glGetError();
- if (extraDebug) qDebug() << "format" << hex << m_glInternalFormat << GL_RGBA8;
+ if (vsbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "format" << Qt::hex << m_glInternalFormat << GL_RGBA8;
return m_texture;
@@ -248,7 +222,7 @@ void VulkanServerBuffer::releaseOpenGlTexture()
bool VulkanServerBuffer::bufferInUse()
{
- return (m_texture && m_texture->isCreated()) || resourceMap().count() > 0;
+ return (m_texture && m_texture->isCreated()) || resourceMap().size() > 0;
}
void VulkanServerBuffer::server_buffer_release(Resource *resource)
@@ -294,14 +268,17 @@ QtWayland::ServerBuffer *VulkanServerBufferIntegration::createServerBufferFromIm
return new VulkanServerBuffer(this, qimage, format);
}
-QtWayland::ServerBuffer *VulkanServerBufferIntegration::createServerBufferFromData(const QByteArray &data, const QSize &size, uint glInternalFormat)
+QtWayland::ServerBuffer *
+VulkanServerBufferIntegration::createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat)
{
if (!m_vulkanWrapper) {
CurrentContext current;
m_vulkanWrapper = new VulkanWrapper(current.context());
}
- auto *vImage = m_vulkanWrapper->createTextureImageFromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), size, glInternalFormat);
+ auto *vImage = m_vulkanWrapper->createTextureImageFromData(
+ reinterpret_cast<const uchar *>(view.constData()), view.size(), size, glInternalFormat);
if (vImage)
return new VulkanServerBuffer(this, vImage, glInternalFormat, size);
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
index 6e2c51dd4..ab1899fb2 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 VULKANSERVERBUFFERINTEGRATION_H
#define VULKANSERVERBUFFERINTEGRATION_H
@@ -90,7 +64,8 @@ public:
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
- QtWayland::ServerBuffer *createServerBufferFromData(const QByteArray &data, const QSize &size, uint glInternalFormat) override;
+ QtWayland::ServerBuffer *createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat) override;
private:
VulkanWrapper *m_vulkanWrapper = nullptr;
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
index 608609d6c..bf3700aec 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// NOTE: Some of the code below is adapted from the public domain code at https://vulkan-tutorial.com/
@@ -34,9 +8,10 @@
#include "vulkanwrapper.h"
#include <QImage>
+#include <QVarLengthArray>
#include <QOpenGLContext>
#include <QtGui/qopengl.h>
-#include <QtVulkanSupport/private/qvkconvenience_p.h>
+#include <QtOpenGL/private/qvkconvenience_p.h>
#include <set>
@@ -46,7 +21,7 @@
QT_BEGIN_NAMESPACE
-static constexpr bool extraDebug = false;
+static constexpr bool vwExtraDebug = false;
#define DECL_VK_FUNCTION(name) \
PFN_ ## name name = nullptr;
@@ -225,7 +200,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
return nullptr;
}
- QScopedPointer<VulkanImageWrapper> imageWrapper(new VulkanImageWrapper);
+ std::unique_ptr imageWrapper = std::make_unique<VulkanImageWrapper>();
imageWrapper->textureImage = image;
imageWrapper->imgMemSize = memSize;
imageWrapper->imgSize = size;
@@ -253,7 +228,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
int res = vkBindImageMemory(m_device, image, imageWrapper->textureImageMemory, 0);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "vkBindImageMemory res" << res;
+ if (vwExtraDebug) qDebug() << "vkBindImageMemory res" << res;
VkMemoryGetFdInfoKHR memoryFdInfo = {};
memoryFdInfo.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR;
@@ -261,9 +236,9 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
memoryFdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
res = vkGetMemoryFdKHR(m_device, &memoryFdInfo, &imageWrapper->imgFd);
- if (extraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd;
+ if (vwExtraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd;
- return imageWrapper.take();
+ return imageWrapper.release();
}
@@ -356,19 +331,19 @@ VkCommandBuffer VulkanWrapperPrivate::beginSingleTimeCommands()
allocInfo.commandPool = m_commandPool;
allocInfo.commandBufferCount = 1;
- if (extraDebug) qDebug() << "allocating...";
+ if (vwExtraDebug) qDebug() << "allocating...";
VkCommandBuffer commandBuffer;
int res = vkAllocateCommandBuffers(m_device, &allocInfo, &commandBuffer);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "vkAllocateCommandBuffers res" << res;
+ if (vwExtraDebug) qDebug() << "vkAllocateCommandBuffers res" << res;
VkCommandBufferBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
res = vkBeginCommandBuffer(commandBuffer, &beginInfo);
- if (extraDebug) qDebug() << "BEGIN res" << res;
+ if (vwExtraDebug) qDebug() << "BEGIN res" << res;
return commandBuffer;
}
@@ -377,7 +352,7 @@ void VulkanWrapperPrivate::endSingleTimeCommands(VkCommandBuffer commandBuffer)
{
int res = vkEndCommandBuffer(commandBuffer);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "END res" << res;
+ if (vwExtraDebug) qDebug() << "END res" << res;
VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
@@ -434,7 +409,7 @@ QueueFamilyIndices VulkanWrapperPrivate::findQueueFamilies(VkPhysicalDevice devi
uint32_t queueFamilyCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, nullptr);
- if (extraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount;
+ if (vwExtraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount;
std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
@@ -507,7 +482,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
int texWidth = size.width();
int texHeight = size.height();
bool ok;
- if (extraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight);
+ if (vwExtraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight);
if (!pixels) {
qCritical("VulkanWrapper: failed to load texture image!");
return nullptr;
@@ -522,17 +497,17 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
void* data;
vkMapMemory(m_device, stagingBufferMemory, 0, bufferSize, 0, &data);
- if (extraDebug) qDebug() << "mapped" << data << bufferSize;
+ if (vwExtraDebug) qDebug() << "mapped" << data << bufferSize;
memcpy(data, pixels, static_cast<size_t>(bufferSize));
vkUnmapMemory(m_device, stagingBufferMemory);
- if (extraDebug) qDebug() << "creating image...";
+ if (vwExtraDebug) qDebug() << "creating image...";
- QScopedPointer<VulkanImageWrapper> imageWrapper(createImage(vkFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size, bufferSize));
- if (imageWrapper.isNull())
+ std::unique_ptr<VulkanImageWrapper> imageWrapper(createImage(vkFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size, bufferSize));
+ if (!imageWrapper)
return nullptr;
- if (extraDebug) qDebug() << "transition...";
+ if (vwExtraDebug) qDebug() << "transition...";
const VkImage textureImage = imageWrapper->textureImage;
@@ -541,14 +516,14 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
if (!ok)
return nullptr;
- if (extraDebug) qDebug() << "copyBufferToImage...";
+ if (vwExtraDebug) qDebug() << "copyBufferToImage...";
copyBufferToImage(stagingBuffer, textureImage, static_cast<uint32_t>(texWidth), static_cast<uint32_t>(texHeight));
transitionImageLayout(textureImage, vkFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
vkDestroyBuffer(m_device, stagingBuffer, nullptr);
vkFreeMemory(m_device, stagingBufferMemory, nullptr);
- return imageWrapper.take();
+ return imageWrapper.release();
}
void VulkanWrapperPrivate::freeTextureImage(VulkanImageWrapper *imageWrapper)
@@ -566,7 +541,7 @@ void VulkanWrapperPrivate::freeTextureImage(VulkanImageWrapper *imageWrapper)
VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
{
- if (extraDebug) qDebug("Creating Vulkan instance");
+ if (vwExtraDebug) qDebug("Creating Vulkan instance");
VkApplicationInfo applicationInfo = {};
applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
applicationInfo.pNext = nullptr;
@@ -598,7 +573,7 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
VkResult instanceCreationResult = vkCreateInstance(&instanceCreateInfo, nullptr, &m_instance);
- if (extraDebug) qDebug() << "result" << instanceCreationResult;
+ if (vwExtraDebug) qDebug() << "result" << instanceCreationResult;
if (instanceCreationResult != VK_SUCCESS) {
qCritical() << "VulkanWrapper: Failed to create Vulkan instance: Error "
@@ -610,12 +585,12 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
uint32_t devCount;
auto res = vkEnumeratePhysicalDevices(m_instance, &devCount, nullptr);
- if (extraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount;
+ if (vwExtraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount;
QVarLengthArray<VkPhysicalDevice, 5> dev(devCount);
res = vkEnumeratePhysicalDevices(m_instance, &devCount, dev.data());
- if (extraDebug) qDebug() << "...devs res =" << res << "count =" << devCount;
+ if (vwExtraDebug) qDebug() << "...devs res =" << res << "count =" << devCount;
#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG
VkPhysicalDeviceProperties props;
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
index 159e3ac84..a2f55fd75 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 VULKANWRAPPER_H
#define VULKANWRAPPER_H
diff --git a/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt b/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..f31928550
--- /dev/null
+++ b/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## WaylandEglCompositorHwIntegrationPrivate Module:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_module(WaylandEglCompositorHwIntegrationPrivate
+ CONFIG_MODULE_NAME wayland_egl_compositor_hw_integration
+ INTERNAL_MODULE
+ SOURCES
+ waylandeglclientbufferintegration.cpp waylandeglclientbufferintegration_p.h
+ INCLUDE_DIRECTORIES
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ LIBRARIES
+ EGL::EGL
+ Wayland::Egl
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_extend_target(WaylandEglCompositorHwIntegrationPrivate CONDITION NOT QT_FEATURE_egl_x11
+ DEFINES
+ QT_EGL_NO_X11
+)
diff --git a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
index e20c6802c..23615f316 100644
--- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
@@ -2,10 +2,8 @@ INCLUDEPATH += $$PWD
QMAKE_USE_PRIVATE += egl wayland-server wayland-egl
-QT += egl_support-private
-
SOURCES += \
$$PWD/waylandeglclientbufferintegration.cpp
HEADERS += \
- $$PWD/waylandeglclientbufferintegration.h
+ $$PWD/waylandeglclientbufferintegration_p.h
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index dd23f6f9c..c8819ba1f 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -1,39 +1,14 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "waylandeglclientbufferintegration.h"
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "waylandeglclientbufferintegration_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <qpa/qplatformnativeinterface.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
#include <qpa/qplatformscreen.h>
#include <QtGui/QWindow>
@@ -42,8 +17,9 @@
#include <QMutex>
#include <QMutexLocker>
+#include <QVarLengthArray>
#include <QtCore/private/qcore_unix_p.h>
-#include <QtEglSupport/private/qeglstreamconvenience_p.h>
+#include <QtGui/private/qeglstreamconvenience_p.h>
#ifndef GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
@@ -151,7 +127,11 @@ struct BufferState
EGLint egl_format = EGL_TEXTURE_RGBA;
QVarLengthArray<EGLImageKHR, 3> egl_images;
- QOpenGLTexture *textures[3] = {};
+ QOpenGLTexture *textures[3] = {nullptr, nullptr, nullptr};
+ QOpenGLContext *texturesContext[3] = {nullptr, nullptr, nullptr};
+ QMetaObject::Connection texturesAboutToBeDestroyedConnection[3] = {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()};
+ QMutex texturesLock;
+
EGLStreamKHR egl_stream = EGL_NO_STREAM_KHR;
bool isYInverted = true;
@@ -168,17 +148,15 @@ public:
void initEglTexture(WaylandEglClientBuffer *buffer, EGLint format);
bool ensureContext();
bool initEglStream(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle);
+ void setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane);
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 display_bound = false;
::wl_display *wlDisplay = nullptr;
QOffscreenSurface *offscreenSurface = nullptr;
QOpenGLContext *localContext = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display = nullptr;
PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display = nullptr;
@@ -259,7 +237,14 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu
}
for (int i = 0; i < planes; i++) {
- const EGLint attribs[] = { EGL_WAYLAND_PLANE_WL, i, EGL_NONE };
+ EGLint attribs[5] = { EGL_WAYLAND_PLANE_WL, i, EGL_NONE };
+#ifdef EGL_EXT_protected_content
+ if (buffer->isProtected()) {
+ attribs[2] = EGL_PROTECTED_CONTENT_EXT;
+ attribs[3] = EGL_TRUE;
+ attribs[4] = EGL_NONE;
+ }
+#endif
EGLImageKHR image = egl_create_image(egl_display,
EGL_NO_CONTEXT,
EGL_WAYLAND_BUFFER_WL,
@@ -272,6 +257,8 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu
}
state.egl_images << image;
+
+ QMutexLocker locker(&state.texturesLock);
state.textures[i] = nullptr;
}
}
@@ -298,6 +285,50 @@ bool WaylandEglClientBufferIntegrationPrivate::ensureContext()
return localContextNeeded;
}
+
+void WaylandEglClientBufferIntegrationPrivate::setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane)
+{
+ QMutexLocker locker(&bs->texturesLock);
+
+ bs->textures[plane] = texture;
+ bs->texturesContext[plane] = QOpenGLContext::currentContext();
+
+ Q_ASSERT(bs->texturesContext[plane] != nullptr);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "(egl) creating a cleanup-lambda for QOpenGLContext::aboutToBeDestroyed!"
+ << ", texture: " << bs->textures[plane]
+ << ", ctx: " << (void*)bs->texturesContext[plane];
+
+ bs->texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(bs->texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ bs->texturesContext[plane], [bs, plane]() {
+
+ QMutexLocker locker(&bs->texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (bs->textures[plane] == nullptr)
+ return;
+
+ delete bs->textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(bs->textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(bs->texturesContext[plane]);
+
+ bs->textures[plane] = nullptr;
+ bs->texturesContext[plane] = nullptr;
+
+ QObject::disconnect(bs->texturesAboutToBeDestroyedConnection[plane]);
+ bs->texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
+}
+
bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle)
{
BufferState &state = *buffer->d;
@@ -331,14 +362,18 @@ bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuf
auto texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(GL_TEXTURE_EXTERNAL_OES));
texture->create();
- state.textures[0] = texture; // TODO: support multiple planes for the streaming case
+ setupBufferAndCleanup(buffer->d, texture, 0);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << " NEW texture! It's pointer and ctx pointer: "
+ << (void*)state.textures[0] << "; " << (void*)state.texturesContext[0];
texture->bind();
auto newStream = funcs->stream_consumer_gltexture(egl_display, state.egl_stream);
if (!newStream) {
EGLint code = eglGetError();
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not initialize EGLStream:" << egl_error_string(code) << hex << (long)code;
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not initialize EGLStream:" << egl_error_string(code) << Qt::hex << (long)code;
funcs->destroy_stream(egl_display, state.egl_stream);
state.egl_stream = EGL_NO_STREAM_KHR;
return false;
@@ -375,13 +410,6 @@ void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEgl
localContext->doneCurrent();
}
-void WaylandEglClientBufferIntegrationPrivate::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(orphanedTextures);
- orphanedTextures.clear();
-}
-
WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration()
: d_ptr(new WaylandEglClientBufferIntegrationPrivate)
{
@@ -398,7 +426,7 @@ WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration()
}
}
-bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display)
+void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display)
{
Q_D(WaylandEglClientBufferIntegration);
@@ -408,21 +436,21 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if (!nativeInterface) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. No native platform interface available.";
- return false;
+ return;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not get EglDisplay for window.";
- return false;
+ return;
}
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.";
- return false;
+ return;
}
d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
@@ -430,14 +458,14 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.";
- return false;
+ return;
}
d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.";
- return false;
+ return;
}
d->egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
@@ -445,32 +473,26 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if (!d->egl_create_image || !d->egl_destroy_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.";
- return false;
+ return;
}
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) {
- qCWarning(qLcWaylandCompositorHardwareIntegration)
- << "Failed to initialize EGL display. Could not bind Wayland display.";
- return false;
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "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->funcs = new QEGLStreamConvenience;
d->funcs->initialize(d->egl_display);
-
- return true;
}
QtWayland::ClientBuffer *WaylandEglClientBufferIntegration::createBufferFor(wl_resource *buffer)
{
- if (wl_shm_buffer_get(buffer))
+ Q_D(WaylandEglClientBufferIntegration);
+ int w = -1;
+ bool q = d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_WIDTH, &w);
+ if (!q || w <= 0)
return nullptr;
return new WaylandEglClientBuffer(this, buffer);
}
@@ -503,9 +525,29 @@ WaylandEglClientBuffer::~WaylandEglClientBuffer()
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
}
+
+ {
+ QMutexLocker locker(&d->texturesLock);
+
+ for (int i=0; i<3; i++) {
+ if (d->textures[i] != nullptr) {
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO << " handing over texture!"
+ << (void*)d->textures[i] << "; " << (void*)d->texturesContext[i]
+ << " ... current context might be the same: " << QOpenGLContext::currentContext();
+
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(
+ d->textures[i], d->texturesContext[i]);
+ d->textures[i] = nullptr; // in case the aboutToBeDestroyed lambda is called while we where here
+ d->texturesContext[i] = nullptr;
+ QObject::disconnect(d->texturesAboutToBeDestroyedConnection[i]);
+ d->texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
+ }
+ }
+ }
+
delete d;
}
@@ -548,7 +590,7 @@ 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();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
@@ -564,13 +606,18 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
texture->setFormat(openGLFormatFromEglFormat(d->egl_format));
texture->setSize(d->size.width(), d->size.height());
texture->create();
- d->textures[plane] = texture;
+ p->setupBufferAndCleanup(this->d, texture, plane);
}
if (m_textureDirty) {
+ m_textureDirty = false;
texture->bind();
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
p->gl_egl_image_target_texture_2d(target, d->egl_images[plane]);
+#ifdef GL_EXT_protected_textures
+ if (isProtected())
+ glTexParameteri(target, GL_TEXTURE_PROTECTED_EXT, GL_TRUE);
+#endif
}
return texture;
}
@@ -584,6 +631,15 @@ void WaylandEglClientBuffer::setCommitted(QRegion &damage)
}
}
+bool WaylandEglClientBuffer::isProtected()
+{
+ if (m_integration && m_buffer)
+ return m_integration->isProtected(m_buffer);
+
+ return false;
+}
+
+
QWaylandSurface::Origin WaylandEglClientBuffer::origin() const
{
return d->isYInverted ? QWaylandSurface::OriginTopLeft : QWaylandSurface::OriginBottomLeft;
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
deleted file mode 100644
index 3b9959e2f..000000000
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WAYLANDEGLINTEGRATION_H
-#define WAYLANDEGLINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-#include <QtCore/QScopedPointer>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class WaylandEglClientBufferIntegrationPrivate;
-
-class WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
- Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
-public:
- WaylandEglClientBufferIntegration();
- ~WaylandEglClientBufferIntegration() override;
-
- bool initializeHardware(struct ::wl_display *display) override;
-
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
-
-private:
- Q_DISABLE_COPY(WaylandEglClientBufferIntegration)
- QScopedPointer<WaylandEglClientBufferIntegrationPrivate> d_ptr;
-};
-
-struct BufferState;
-
-class WaylandEglClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- ~WaylandEglClientBuffer() override;
-
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- quintptr lockNativeBuffer() override;
- void unlockNativeBuffer(quintptr native_buffer) const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- void setCommitted(QRegion &damage) override;
-
-private:
- friend class WaylandEglClientBufferIntegration;
- friend class WaylandEglClientBufferIntegrationPrivate;
-
- WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
-
- BufferState *d = nullptr;
- WaylandEglClientBufferIntegration *m_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // WAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h
new file mode 100644
index 000000000..ca4dd3736
--- /dev/null
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h
@@ -0,0 +1,69 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+//
+// 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.
+//
+
+#ifndef WAYLANDEGLINTEGRATION_H
+#define WAYLANDEGLINTEGRATION_H
+
+#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtCore/QScopedPointer>
+#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class WaylandEglClientBufferIntegrationPrivate;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
+{
+ Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
+public:
+ WaylandEglClientBufferIntegration();
+ ~WaylandEglClientBufferIntegration() override;
+
+ void initializeHardware(struct ::wl_display *display) override;
+
+ QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
+
+private:
+ Q_DISABLE_COPY(WaylandEglClientBufferIntegration)
+ QScopedPointer<WaylandEglClientBufferIntegrationPrivate> d_ptr;
+};
+
+struct BufferState;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBuffer : public QtWayland::ClientBuffer
+{
+public:
+ WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
+ ~WaylandEglClientBuffer() override;
+
+ QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
+ QSize size() const override;
+ QWaylandSurface::Origin origin() const override;
+ quintptr lockNativeBuffer() override;
+ void unlockNativeBuffer(quintptr native_buffer) const override;
+ QOpenGLTexture *toOpenGlTexture(int plane) override;
+ void setCommitted(QRegion &damage) override;
+ bool isProtected() override;
+
+private:
+ friend class WaylandEglClientBufferIntegration;
+ friend class WaylandEglClientBufferIntegrationPrivate;
+
+ BufferState *d = nullptr;
+ WaylandEglClientBufferIntegration *m_integration = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // WAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri b/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
index 931475ef6..9d9228e29 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
@@ -5,8 +5,6 @@ QMAKE_USE_PRIVATE += egl wayland-server wayland-egl
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += $$PWD/../../../3rdparty/protocol/wl-eglstream-controller.xml
-QT += egl_support-private
-
SOURCES += \
$$PWD/waylandeglstreamintegration.cpp \
$$PWD/waylandeglstreamcontroller.cpp
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
index d2e0d52e7..c2689b2b2 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "waylandeglstreamcontroller.h"
#include "waylandeglstreamintegration.h"
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
index 5ce70b7fa..54db28250 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 WAYLANDEGLSTREAMCONTROLLER_H
#define WAYLANDEGLSTREAMCONTROLLER_H
@@ -35,11 +9,11 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QSize>
#include <QtCore/QTextStream>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
index 6c031aa89..0924f0fd7 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
@@ -1,46 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "waylandeglstreamintegration.h"
#include "waylandeglstreamcontroller.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
+#include <QtCore/QMutexLocker>
-#include <QtEglSupport/private/qeglstreamconvenience_p.h>
+#include <QtGui/private/qeglstreamconvenience_p.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwlbuffermanager_p.h>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -135,7 +111,11 @@ struct BufferState
BufferState() = default;
EGLint egl_format = EGL_TEXTURE_EXTERNAL_WL;
- QOpenGLTexture *textures[3] = {};
+ QOpenGLTexture *textures[3] = {nullptr, nullptr, nullptr};
+ QOpenGLContext *texturesContext[3] = {nullptr, nullptr, nullptr};
+ QMetaObject::Connection texturesAboutToBeDestroyedConnection[3] = {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()};
+ QMutex texturesLock;
+
EGLStreamKHR egl_stream = EGL_NO_STREAM_KHR;
bool isYInverted = false;
@@ -149,15 +129,14 @@ public:
bool ensureContext();
bool initEglStream(WaylandEglStreamClientBuffer *buffer, struct ::wl_resource *bufferHandle);
+ void setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane);
void handleEglstreamTexture(WaylandEglStreamClientBuffer *buffer);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { orphanedTextures << texture; }
- void deleteOrphanedTextures();
EGLDisplay egl_display = EGL_NO_DISPLAY;
bool display_bound = false;
+ ::wl_display *wlDisplay = nullptr;
QOffscreenSurface *offscreenSurface = nullptr;
QOpenGLContext *localContext = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
WaylandEglStreamController *eglStreamController = nullptr;
@@ -175,13 +154,6 @@ public:
bool WaylandEglStreamClientBufferIntegrationPrivate::shuttingDown = false;
-void WaylandEglStreamClientBufferIntegrationPrivate::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(orphanedTextures);
- orphanedTextures.clear();
-}
-
bool WaylandEglStreamClientBufferIntegrationPrivate::ensureContext()
{
bool localContextNeeded = false;
@@ -205,6 +177,49 @@ bool WaylandEglStreamClientBufferIntegrationPrivate::ensureContext()
}
+void WaylandEglStreamClientBufferIntegrationPrivate::setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane)
+{
+ QMutexLocker locker(&bs->texturesLock);
+
+ bs->textures[plane] = texture;
+ bs->texturesContext[plane] = QOpenGLContext::currentContext();
+
+ Q_ASSERT(bs->texturesContext[plane] != nullptr);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "(eglstream) creating a cleanup-lambda for QOpenGLContext::aboutToBeDestroyed!"
+ << ", texture: " << bs->textures[plane]
+ << ", ctx: " << (void*)bs->texturesContext[plane];
+
+ bs->texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(bs->texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ bs->texturesContext[plane], [bs, plane]() {
+
+ QMutexLocker locker(&bs->texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (bs->textures[plane] == nullptr)
+ return;
+
+ delete bs->textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(bs->textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(bs->texturesContext[plane]);
+
+ bs->textures[plane] = nullptr;
+ bs->texturesContext[plane] = nullptr;
+
+ QObject::disconnect(bs->texturesAboutToBeDestroyedConnection[plane]);
+ bs->texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
+}
+
bool WaylandEglStreamClientBufferIntegrationPrivate::initEglStream(WaylandEglStreamClientBuffer *buffer, wl_resource *bufferHandle)
{
BufferState &state = *buffer->d;
@@ -235,7 +250,7 @@ bool WaylandEglStreamClientBufferIntegrationPrivate::initEglStream(WaylandEglStr
auto texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(GL_TEXTURE_EXTERNAL_OES));
texture->create();
- state.textures[0] = texture; // TODO: support multiple planes
+ setupBufferAndCleanup(buffer->d, texture, 0);
texture->bind();
@@ -245,7 +260,7 @@ bool WaylandEglStreamClientBufferIntegrationPrivate::initEglStream(WaylandEglStr
if (!newStream) {
EGLint code = eglGetError();
- qWarning() << "Could not initialize EGLStream:" << egl_error_string(code) << hex << (long)code;
+ qWarning() << "Could not initialize EGLStream:" << egl_error_string(code) << Qt::hex << (long)code;
funcs->destroy_stream(egl_display, state.egl_stream);
state.egl_stream = EGL_NO_STREAM_KHR;
return false;
@@ -282,7 +297,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)
@@ -290,15 +311,14 @@ void WaylandEglStreamClientBufferIntegration::attachEglStreamConsumer(struct ::w
Q_D(WaylandEglStreamClientBufferIntegration);
Q_UNUSED(wl_surface);
- // NOTE: must use getBuffer to create the buffer here, so the buffer will end up in the buffer manager's hash
-
+ auto *clientBuffer = new WaylandEglStreamClientBuffer(this, wl_buffer);
auto *bufferManager = QWaylandCompositorPrivate::get(m_compositor)->bufferManager();
- auto *clientBuffer = static_cast<WaylandEglStreamClientBuffer*>(bufferManager->getBuffer(wl_buffer));
+ bufferManager->registerBuffer(wl_buffer, clientBuffer);
d->initEglStream(clientBuffer, wl_buffer);
}
-bool WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
+void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
{
Q_D(WaylandEglStreamClientBufferIntegration);
@@ -307,56 +327,46 @@ bool WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available.");
- return false;
+ return;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window.");
- return false;
+ return;
}
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 false;
+ return;
}
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 false;
+ return;
}
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 false;
+ return;
}
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 false;
- } 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);
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)
@@ -389,10 +399,29 @@ WaylandEglStreamClientBuffer::~WaylandEglStreamClientBuffer()
if (p) {
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
+ }
+
+ {
+ QMutexLocker locker(&d->texturesLock);
+
+ for (int i=0; i<3; i++) {
+ if (d->textures[i] != nullptr) {
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO << " handing over texture!"
+ << (void*)d->textures[i] << "; " << (void*)d->texturesContext[i]
+ << " ... current context might be the same: " << QOpenGLContext::currentContext();
+
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(
+ d->textures[i], d->texturesContext[i]);
+ d->textures[i] = nullptr; // in case the aboutToBeDestroyed lambda is called while we where here
+ d->texturesContext[i] = nullptr;
+ QObject::disconnect(d->texturesAboutToBeDestroyedConnection[i]);
+ d->texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
+ }
+ }
}
+
delete d;
}
@@ -415,9 +444,8 @@ QWaylandSurface::Origin WaylandEglStreamClientBuffer::origin() const
QOpenGLTexture *WaylandEglStreamClientBuffer::toOpenGlTexture(int plane)
{
- auto *p = WaylandEglStreamClientBufferIntegrationPrivate::get(m_integration);
// At this point we should have a valid OpenGL context, so it's safe to destroy textures
- p->deleteOrphanedTextures();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
index 35d2c80d3..3f4f7f27a 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-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 WAYLANDEGLSTREAMINTEGRATION_H
#define WAYLANDEGLSTREAMINTEGRATION_H
@@ -44,7 +18,7 @@ public:
WaylandEglStreamClientBufferIntegration();
~WaylandEglStreamClientBufferIntegration() override;
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri
deleted file mode 100644
index 6d0f81659..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE_PRIVATE += egl wayland-server x11
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/xcompositeeglintegration.h
-
-SOURCES += \
- $$PWD/xcompositeeglintegration.cpp
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
deleted file mode 100644
index 3c302c7f6..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositeeglintegration.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtGui/QGuiApplication>
-#include <QtGui/QOpenGLTexture>
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformopenglcontext.h>
-
-#include "xcompositebuffer.h"
-#include "xcompositehandler.h"
-#include <X11/extensions/Xcomposite.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QVector<EGLint> eglbuildSpec()
-{
- QVector<EGLint> spec;
-
- spec.append(EGL_SURFACE_TYPE); spec.append(EGL_WINDOW_BIT | EGL_PIXMAP_BIT);
- spec.append(EGL_RENDERABLE_TYPE); spec.append(EGL_OPENGL_ES2_BIT);
- spec.append(EGL_BIND_TO_TEXTURE_RGBA); spec.append(EGL_TRUE);
- spec.append(EGL_ALPHA_SIZE); spec.append(8);
- spec.append(EGL_NONE);
- return spec;
-}
-
-XCompositeEglClientBufferIntegration::XCompositeEglClientBufferIntegration()
-{
-
-}
-
-bool XCompositeEglClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve Display from platform integration";
- return false;
- }
- mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay"));
- if (!mEglDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve EGLDisplay from platform integration";
- return false;
- }
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Platform integration doesn't have native interface";
- return false;
- }
- new XCompositeHandler(m_compositor, mDisplay);
- return true;
-}
-
-QtWayland::ClientBuffer *XCompositeEglClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (wl_shm_buffer_get(buffer))
- return nullptr;
- return new XCompositeEglClientBuffer(this, buffer);
-}
-
-
-XCompositeEglClientBuffer::XCompositeEglClientBuffer(XCompositeEglClientBufferIntegration *integration, wl_resource *bufferResource)
- : QtWayland::ClientBuffer(bufferResource)
- , m_integration(integration)
-{
-}
-
-QOpenGLTexture *XCompositeEglClientBuffer::toOpenGlTexture(int plane)
-{
- Q_UNUSED(plane);
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- Pixmap pixmap = XCompositeNameWindowPixmap(m_integration->xDisplay(), compositorBuffer->window());
-
- QVector<EGLint> eglConfigSpec = eglbuildSpec();
-
- EGLint matching = 0;
- EGLConfig config;
- bool matched = eglChooseConfig(m_integration->eglDisplay(),eglConfigSpec.constData(),&config,1,&matching);
- if (!matched || !matching) {
- qWarning("Could not retrieve a suitable EGL config");
- return nullptr;
- }
-
- QVector<EGLint> attribList;
-
- attribList.append(EGL_TEXTURE_FORMAT);
- attribList.append(EGL_TEXTURE_RGBA);
- attribList.append(EGL_TEXTURE_TARGET);
- attribList.append(EGL_TEXTURE_2D);
- attribList.append(EGL_NONE);
-
- EGLSurface surface = eglCreatePixmapSurface(m_integration->eglDisplay(), config, reinterpret_cast<EGLNativePixmapType>(pixmap), attribList.constData());
- if (surface == EGL_NO_SURFACE) {
- qDebug() << "Failed to create eglsurface" << pixmap << compositorBuffer->window();
- }
-
- compositorBuffer->setOrigin(QWaylandSurface::OriginTopLeft);
-
- if (!m_texture) {
- m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
- m_texture->create();
- }
- m_texture->bind();
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- if (!eglBindTexImage(m_integration->eglDisplay(),surface,EGL_BACK_BUFFER)) {
- qWarning() << "Failed to bind";
- }
-
- // eglDestroySurface(mEglDisplay,surface);
- return m_texture;
-}
-
-
-QWaylandSurface::Origin XCompositeEglClientBuffer::origin() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- return compositorBuffer->origin();
-}
-
-QSize XCompositeEglClientBuffer::size() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
-
- return compositorBuffer->size();
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
deleted file mode 100644
index 2c3116df1..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEEGLINTEGRATION_H
-#define XCOMPOSITEEGLINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-#include "xlibinclude.h"
-
-#include <EGL/egl.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
-public:
- XCompositeEglClientBufferIntegration();
-
- bool initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
- inline Display *xDisplay() const { return mDisplay; }
- inline EGLDisplay eglDisplay() const { return mEglDisplay; }
-
-private:
- Display *mDisplay = nullptr;
- EGLDisplay mEglDisplay = EGL_NO_DISPLAY;
-};
-
-class XCompositeEglClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- XCompositeEglClientBuffer(XCompositeEglClientBufferIntegration *integration, wl_resource *bufferResource);
-
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override {
- return QWaylandBufferRef::BufferFormatEgl_RGBA;
- }
-
-private:
- QOpenGLTexture *m_texture = nullptr;
- XCompositeEglClientBufferIntegration *m_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri
deleted file mode 100644
index 423ae1815..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE_PRIVATE += wayland-server glx
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/xcompositeglxintegration.h
-
-SOURCES += \
- $$PWD/xcompositeglxintegration.cpp
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
deleted file mode 100644
index db4390252..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositeglxintegration.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformintegration.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
-
-#include "xcompositebuffer.h"
-#include "xcompositehandler.h"
-#include <X11/extensions/Xcomposite.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QVector<int> qglx_buildSpec()
-{
- QVector<int> spec(48);
- int i = 0;
-
- spec[i++] = GLX_LEVEL;
- spec[i++] = 0;
- spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_PIXMAP_BIT | GLX_WINDOW_BIT;
- spec[i++] = GLX_BIND_TO_TEXTURE_TARGETS_EXT; spec[i++] = GLX_TEXTURE_2D_BIT_EXT;
- spec[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT; spec[i++] = true;
-
- spec[i++] = 0;
- return spec;
-}
-
-
-XCompositeGLXClientBufferIntegration::XCompositeGLXClientBufferIntegration()
-{
- qDebug() << "Loading GLX integration";
-}
-
-XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration()
-{
- delete mHandler;
-}
-
-bool XCompositeGLXClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- qDebug() << "Initializing GLX integration";
- QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve Display from platform integration";
- return false;
- }
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Platform integration doesn't have native interface";
- return false;
- }
- mScreen = XDefaultScreen(mDisplay);
-
- mHandler = new XCompositeHandler(m_compositor, mDisplay);
-
- QOpenGLContext *glContext = new QOpenGLContext();
- glContext->create();
-
- m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
- if (!m_glxBindTexImageEXT) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Did not find glxBindTexImageExt, everything will FAIL!";
- return false;
- }
- m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
- if (!m_glxReleaseTexImageEXT) {
- qDebug() << "Did not find glxReleaseTexImageExt";
- }
-
- delete glContext;
- return true;
-}
-
-QtWayland::ClientBuffer *XCompositeGLXClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (wl_shm_buffer_get(buffer))
- return nullptr;
- return new XCompositeGLXClientBuffer(this, buffer);
-}
-
-XCompositeGLXClientBuffer::XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource)
- : QtWayland::ClientBuffer(bufferResource)
- , m_integration(integration)
-{
-}
-
-
-QOpenGLTexture *XCompositeGLXClientBuffer::toOpenGlTexture(int plane)
-{
- Q_UNUSED(plane);
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- Pixmap pixmap = XCompositeNameWindowPixmap(m_integration->xDisplay(), compositorBuffer->window());
-
- QVector<int> glxConfigSpec = qglx_buildSpec();
- int numberOfConfigs;
- GLXFBConfig *configs = glXChooseFBConfig(m_integration->xDisplay(),m_integration->xScreen(),glxConfigSpec.constData(),&numberOfConfigs);
-
- QVector<int> attribList;
- attribList.append(GLX_TEXTURE_FORMAT_EXT);
- attribList.append(GLX_TEXTURE_FORMAT_RGB_EXT);
- attribList.append(GLX_TEXTURE_TARGET_EXT);
- attribList.append(GLX_TEXTURE_2D_EXT);
- attribList.append(0);
-
- if (!m_glxPixmap)
- m_glxPixmap = glXCreatePixmap(m_integration->xDisplay(), *configs, pixmap, attribList.constData());
-
- uint inverted = 0;
- glXQueryDrawable(m_integration->xDisplay(), m_glxPixmap, GLX_Y_INVERTED_EXT,&inverted);
- compositorBuffer->setOrigin(inverted ? QWaylandSurface::OriginBottomLeft : QWaylandSurface::OriginTopLeft);
-
- XFree(configs);
- auto tex = m_texture;
- if (!m_texture) {
- tex = new QOpenGLTexture(QOpenGLTexture::Target2D);
- tex->create();
- m_texture = tex;
- }
- tex->bind();
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- m_integration->m_glxBindTexImageEXT(m_integration->xDisplay(),m_glxPixmap,GLX_FRONT_EXT, nullptr);
-
- // TODO: release in the destructor?
- // m_glxReleaseTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT);
- return tex;
-}
-
-
-QWaylandSurface::Origin XCompositeGLXClientBuffer::origin() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- return compositorBuffer->origin();
-}
-
-QSize XCompositeGLXClientBuffer::size() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
-
- return compositorBuffer->size();
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
deleted file mode 100644
index 6763d5916..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEGLXINTEGRATION_H
-#define XCOMPOSITEGLXINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-#include "xlibinclude.h"
-
-#define GLX_GLXEXT_PROTOTYPES
-#include <GL/glx.h>
-#include <GL/glxext.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeHandler;
-
-class XCompositeGLXClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
-public:
- XCompositeGLXClientBufferIntegration();
- ~XCompositeGLXClientBufferIntegration() override;
-
- bool initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
-
- inline Display *xDisplay() const { return mDisplay; }
- inline int xScreen() const { return mScreen; }
-
- PFNGLXBINDTEXIMAGEEXTPROC m_glxBindTexImageEXT;
- PFNGLXRELEASETEXIMAGEEXTPROC m_glxReleaseTexImageEXT;
-
-private:
- Display *mDisplay = nullptr;
- int mScreen;
- XCompositeHandler *mHandler = nullptr;
-};
-
-class XCompositeGLXClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource);
-
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override {
- return QWaylandBufferRef::BufferFormatEgl_RGBA;
- }
-
-private:
- QOpenGLTexture *m_texture = nullptr;
- XCompositeGLXClientBufferIntegration *m_integration = nullptr;
- GLXPixmap m_glxPixmap = 0;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEGLXINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
deleted file mode 100644
index 69ab6aa10..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-
-QMAKE_USE += xcomposite
-CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += $$PWD/../../../extensions/xcomposite.xml $$PWD/../../../3rdparty/protocol/wayland.xml
-
-HEADERS += \
- $$PWD/xcompositebuffer.h \
- $$PWD/xcompositehandler.h \
- $$PWD/xlibinclude.h
-
-SOURCES += \
- $$PWD/xcompositebuffer.cpp \
- $$PWD/xcompositehandler.cpp
-
-QT += gui-private
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
deleted file mode 100644
index 67cef0049..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositebuffer.h"
-
-QT_BEGIN_NAMESPACE
-
-XCompositeBuffer::XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id)
- : QtWaylandServer::wl_buffer(client, id, 1)
- , mWindow(window)
- , mOrigin(QWaylandSurface::OriginBottomLeft)
- , mSize(size)
-{
-}
-
-void XCompositeBuffer::buffer_destroy_resource(Resource *)
-{
- delete this;
-}
-
-void XCompositeBuffer::buffer_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-Window XCompositeBuffer::window()
-{
- return mWindow;
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
deleted file mode 100644
index 4bf035f24..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEBUFFER_H
-#define XCOMPOSITEBUFFER_H
-
-#include <qwayland-server-wayland.h>
-
-#include <QtWaylandCompositor/private/qwaylandutils_p.h>
-
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include <QtCore/QSize>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-
-#include <X11/X.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeBuffer : public QtWaylandServer::wl_buffer
-{
-public:
- XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id);
-
- Window window();
-
- QWaylandSurface::Origin origin() const { return mOrigin; }
- void setOrigin(QWaylandSurface::Origin origin) { mOrigin = origin; }
-
- QSize size() const { return mSize; }
-
- static XCompositeBuffer *fromResource(struct ::wl_resource *resource) { return QtWayland::fromResource<XCompositeBuffer *>(resource); }
-
-protected:
- void buffer_destroy_resource(Resource *) override;
- void buffer_destroy(Resource *) override;
-
-private:
- Window mWindow;
- QWaylandSurface::Origin mOrigin;
- QSize mSize;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITORBUFFER_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp b/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
deleted file mode 100644
index 1e43c033a..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositehandler.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include "xcompositebuffer.h"
-#include <X11/extensions/Xcomposite.h>
-
-QT_BEGIN_NAMESPACE
-
-XCompositeHandler::XCompositeHandler(QWaylandCompositor *compositor, Display *display)
- : QtWaylandServer::qt_xcomposite(compositor->display(), 1)
-{
- mFakeRootWindow = new QWindow();
- mFakeRootWindow->setGeometry(QRect(-1,-1,1,1));
- mFakeRootWindow->create();
- mFakeRootWindow->show();
-
- int composite_event_base, composite_error_base;
- if (!XCompositeQueryExtension(display, &composite_event_base, &composite_error_base))
- qFatal("XComposite required");
-
- mDisplayString = QString::fromLocal8Bit(XDisplayString(display));
-}
-
-void XCompositeHandler::xcomposite_bind_resource(Resource *resource)
-{
- send_root(resource->handle, mDisplayString, mFakeRootWindow->winId());
-}
-
-void XCompositeHandler::xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t window,
- int32_t width, int32_t height)
-{
- new XCompositeBuffer(Window(window), QSize(width, height), resource->client(), id);
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h b/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
deleted file mode 100644
index 5ff72e265..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEHANDLER_H
-#define XCOMPOSITEHANDLER_H
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include "xlibinclude.h"
-
-#include "qwayland-server-xcomposite.h"
-#include <wayland-server-core.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeHandler : public QtWaylandServer::qt_xcomposite
-{
-public:
- XCompositeHandler(QWaylandCompositor *compositor, Display *display);
-
-private:
- QWindow *mFakeRootWindow = nullptr;
-
- QString mDisplayString;
-
- void xcomposite_bind_resource(Resource *resource) override;
- void xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t x_window,
- int32_t width, int32_t height) override;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEHANDLER_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h b/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h
deleted file mode 100644
index ca3542aaa..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) 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.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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XLIBINCLUDE_H
-#define XLIBINCLUDE_H
-
-#include <QtCore/QEvent>
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QCursor>
-#include <QtGui/private/qguiapplication_p.h>
-
-#include <X11/Xlib.h>
-#include "X11/extensions/Xcomposite.h"
-
-enum {
- XFocusOut = FocusOut,
- XFocusIn = FocusIn,
- XKeyPress = KeyPress,
- XKeyRelease = KeyRelease,
- XNone = None,
- XRevertToParent = RevertToParent,
- XGrayScale = GrayScale,
- XCursorShape = CursorShape
-};
-#undef FocusOut
-#undef FocusIn
-#undef KeyPress
-#undef KeyRelease
-#undef None
-#undef RevertToParent
-#undef GrayScale
-#undef CursorShape
-
-#ifdef FontChange
-#undef FontChange
-#endif
-
-#endif //XLIBINCLUDE_H