summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2013-02-01 00:40:44 +0100
committerAndy Nichols <andy.nichols@digia.com>2013-02-06 14:19:45 +0100
commit2e0efd201aa75121f4dd4049598f4d120811d784 (patch)
treea33026b8cc3b4f9add79b5a8ebd703fa3eeb6644
parent4cbc411f60d17a6d4f4e9d4156146537d5dc2f16 (diff)
downloadqtwayland-2e0efd201aa75121f4dd4049598f4d120811d784.tar.gz
QtCompositor hardware integrations as plugins
Rather than defining which hardware integration should be used at compile time, we should build each hardware integration as a plugin, and load the one we want at runtime. The default hardware integration is wayland-egl, but you are able to override this using the environment variable QT_WAYLAND_HARDWARE_INTEGRATION Backends tested: wayland-egl xcomposite-egl Backends untested: xcomposite-glx brcm-egl Change-Id: Idee66574d232a9236898f68ca64145f471b1bb80 Reviewed-by: Andy Nichols <andy.nichols@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@gmail.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
-rw-r--r--src/compositor/hardware_integration/brcm_egl/brcm_egl.pri11
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegration.cpp4
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegration.h12
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegrationfactory.cpp92
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegrationfactory.h57
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegrationplugin.cpp52
-rw-r--r--src/compositor/hardware_integration/graphicshardwareintegrationplugin.h64
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri39
-rw-r--r--src/compositor/hardware_integration/wayland_egl/wayland_egl.pri13
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.cpp25
-rw-r--r--src/plugins/plugins.pro5
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcm-egl.json3
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro22
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp (renamed from src/compositor/hardware_integration/brcm_egl/brcmbuffer.cpp)0
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h (renamed from src/compositor/hardware_integration/brcm_egl/brcmbuffer.h)2
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp (renamed from src/compositor/hardware_integration/brcm_egl/brcmeglintegration.cpp)10
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h (renamed from src/compositor/hardware_integration/brcm_egl/brcmeglintegration.h)4
-rw-r--r--src/plugins/waylandcompositors/brcm-egl/main.cpp70
-rw-r--r--src/plugins/waylandcompositors/wayland-egl/main.cpp70
-rw-r--r--src/plugins/waylandcompositors/wayland-egl/wayland-egl.json3
-rw-r--r--src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro20
-rw-r--r--src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp (renamed from src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp)16
-rw-r--r--src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h (renamed from src/compositor/hardware_integration/wayland_egl/waylandeglintegration.h)4
-rw-r--r--src/plugins/waylandcompositors/waylandcompositors.pro17
-rw-r--r--src/plugins/waylandcompositors/xcomposite-egl/main.cpp70
-rw-r--r--src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json3
-rw-r--r--src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro (renamed from src/compositor/hardware_integration/xcomposite_egl/xcomposite_egl.pri)12
-rw-r--r--src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp (renamed from src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.cpp)20
-rw-r--r--src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h (renamed from src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.h)4
-rw-r--r--src/plugins/waylandcompositors/xcomposite-glx/main.cpp70
-rw-r--r--src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json3
-rw-r--r--src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro (renamed from src/compositor/hardware_integration/xcomposite_glx/xcomposite_glx.pri)12
-rw-r--r--src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp (renamed from src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.cpp)28
-rw-r--r--src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h (renamed from src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.h)4
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri (renamed from src/compositor/hardware_integration/xcomposite_share/xcomposite_share.pri)0
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp (renamed from src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.cpp)0
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h (renamed from src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.h)2
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp (renamed from src/compositor/hardware_integration/xcomposite_share/xcompositehandler.cpp)0
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h (renamed from src/compositor/hardware_integration/xcomposite_share/xcompositehandler.h)2
-rw-r--r--src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h (renamed from src/compositor/hardware_integration/xcomposite_share/xlibinclude.h)0
-rw-r--r--src/src.pro5
41 files changed, 726 insertions, 124 deletions
diff --git a/src/compositor/hardware_integration/brcm_egl/brcm_egl.pri b/src/compositor/hardware_integration/brcm_egl/brcm_egl.pri
deleted file mode 100644
index 1b753645..00000000
--- a/src/compositor/hardware_integration/brcm_egl/brcm_egl.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-LIBS += -lEGL
-
-SOURCES += \
- $$PWD/brcmeglintegration.cpp \
- $$PWD/brcmbuffer.cpp
-
-HEADERS += \
- $$PWD/brcmeglintegration.h \
- $$PWD/brcmbuffer.h
-
-WAYLANDSOURCES += $$PWD/../../../extensions/brcm.xml
diff --git a/src/compositor/hardware_integration/graphicshardwareintegration.cpp b/src/compositor/hardware_integration/graphicshardwareintegration.cpp
index 6a5f1fb4..13b460d7 100644
--- a/src/compositor/hardware_integration/graphicshardwareintegration.cpp
+++ b/src/compositor/hardware_integration/graphicshardwareintegration.cpp
@@ -40,7 +40,7 @@
#include "graphicshardwareintegration.h"
-GraphicsHardwareIntegration::GraphicsHardwareIntegration(WaylandCompositor *compositor)
- : m_compositor(compositor)
+GraphicsHardwareIntegration::GraphicsHardwareIntegration()
+ : m_compositor(0)
{
}
diff --git a/src/compositor/hardware_integration/graphicshardwareintegration.h b/src/compositor/hardware_integration/graphicshardwareintegration.h
index ac4ec99d..f6c46deb 100644
--- a/src/compositor/hardware_integration/graphicshardwareintegration.h
+++ b/src/compositor/hardware_integration/graphicshardwareintegration.h
@@ -45,15 +45,17 @@
#include <QtGui/QOpenGLContext>
#include <wayland-server.h>
-#include "waylandcompositor.h"
-#include "wayland_wrapper/wldisplay.h"
+#include <QtCompositor/waylandcompositor.h>
+#include <QtCompositor/wldisplay.h>
-class GraphicsHardwareIntegration
+class Q_COMPOSITOR_EXPORT GraphicsHardwareIntegration
{
public:
- GraphicsHardwareIntegration(WaylandCompositor *compositor);
+ GraphicsHardwareIntegration();
virtual ~GraphicsHardwareIntegration() { }
+ void setCompositor(WaylandCompositor *compositor) { m_compositor = compositor; }
+
virtual void initializeHardware(Wayland::Display *waylandDisplay) = 0;
/** Bind the Wayland buffer to the textureId. The correct context is the current context,
@@ -67,8 +69,6 @@ public:
virtual void *lockNativeBuffer(struct wl_buffer *, QOpenGLContext *) const { return 0; }
virtual void unlockNativeBuffer(void *, QOpenGLContext *) const { return; }
- static GraphicsHardwareIntegration *createGraphicsHardwareIntegration(WaylandCompositor *compositor);
-
protected:
WaylandCompositor *m_compositor;
};
diff --git a/src/compositor/hardware_integration/graphicshardwareintegrationfactory.cpp b/src/compositor/hardware_integration/graphicshardwareintegrationfactory.cpp
new file mode 100644
index 00000000..d8337c6e
--- /dev/null
+++ b/src/compositor/hardware_integration/graphicshardwareintegrationfactory.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "graphicshardwareintegrationfactory.h"
+#include "graphicshardwareintegrationplugin.h"
+#include "graphicshardwareintegration.h"
+#include <QtCore/private/qfactoryloader_p.h>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+
+#ifndef QT_NO_LIBRARY
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (GraphicsHardwareIntegrationFactoryInterface_iid, QLatin1String("/waylandcompositors"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
+ (GraphicsHardwareIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+#endif
+
+QStringList GraphicsHardwareIntegrationFactory::keys(const QString &pluginPath)
+{
+#ifndef QT_NO_LIBRARY
+ QStringList list;
+ if (!pluginPath.isEmpty()) {
+ QCoreApplication::addLibraryPath(pluginPath);
+ list = directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QStringLiteral(" (from ")
+ + QDir::toNativeSeparators(pluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
+ }
+ }
+ list.append(loader()->keyMap().values());
+ return list;
+#else
+ return QStringList();
+#endif
+}
+
+GraphicsHardwareIntegration *GraphicsHardwareIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+{
+#ifndef QT_NO_LIBRARY
+ // Try loading the plugin from platformPluginPath first:
+ if (!pluginPath.isEmpty()) {
+ QCoreApplication::addLibraryPath(pluginPath);
+ if (GraphicsHardwareIntegration *ret = qLoadPlugin1<GraphicsHardwareIntegration, GraphicsHardwareIntegrationPlugin>(directLoader(), name, args))
+ return ret;
+ }
+ if (GraphicsHardwareIntegration *ret = qLoadPlugin1<GraphicsHardwareIntegration, GraphicsHardwareIntegrationPlugin>(loader(), name, args))
+ return ret;
+#endif
+ return 0;
+}
diff --git a/src/compositor/hardware_integration/graphicshardwareintegrationfactory.h b/src/compositor/hardware_integration/graphicshardwareintegrationfactory.h
new file mode 100644
index 00000000..22bcd09c
--- /dev/null
+++ b/src/compositor/hardware_integration/graphicshardwareintegrationfactory.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRAPHICSHARDWAREINTEGRATIONFACTORY_H
+#define GRAPHICSHARDWAREINTEGRATIONFACTORY_H
+
+#include "waylandexport.h"
+#include <QtCore/QStringList>
+
+class GraphicsHardwareIntegration;
+
+class Q_COMPOSITOR_EXPORT GraphicsHardwareIntegrationFactory
+{
+public:
+ static QStringList keys(const QString &pluginPath = QString());
+ static GraphicsHardwareIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+};
+
+#endif // GRAPHICSHARDWAREINTEGRATIONFACTORY_H
diff --git a/src/compositor/hardware_integration/graphicshardwareintegrationplugin.cpp b/src/compositor/hardware_integration/graphicshardwareintegrationplugin.cpp
new file mode 100644
index 00000000..3bde8e8a
--- /dev/null
+++ b/src/compositor/hardware_integration/graphicshardwareintegrationplugin.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "graphicshardwareintegrationplugin.h"
+
+GraphicsHardwareIntegrationPlugin::GraphicsHardwareIntegrationPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+GraphicsHardwareIntegrationPlugin::~GraphicsHardwareIntegrationPlugin()
+{
+}
+
diff --git a/src/compositor/hardware_integration/graphicshardwareintegrationplugin.h b/src/compositor/hardware_integration/graphicshardwareintegrationplugin.h
new file mode 100644
index 00000000..51f60516
--- /dev/null
+++ b/src/compositor/hardware_integration/graphicshardwareintegrationplugin.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
+#define GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
+
+#include "waylandexport.h"
+
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
+
+class GraphicsHardwareIntegration;
+
+#define GraphicsHardwareIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.GraphicsHardwareIntegrationFactoryInterface.5.1"
+
+class Q_COMPOSITOR_EXPORT GraphicsHardwareIntegrationPlugin : public QObject
+{
+ Q_OBJECT
+public:
+ explicit GraphicsHardwareIntegrationPlugin(QObject *parent = 0);
+ ~GraphicsHardwareIntegrationPlugin();
+
+ virtual GraphicsHardwareIntegration *create(const QString &key, const QStringList &paramList) = 0;
+};
+
+#endif // GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index c008521a..352dbaee 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -1,3 +1,5 @@
+QT += core
+
isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
!isEqual(QT_WAYLAND_GL_CONFIG,nogl) {
@@ -8,36 +10,15 @@ isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
$$PWD/graphicshardwareintegration.cpp
DEFINES += QT_COMPOSITOR_WAYLAND_GL
-
- isEqual(QT_WAYLAND_GL_CONFIG, custom) {
- QT_WAYLAND_GL_INTEGRATION = $$QT_WAYLAND_GL_CONFIG
- } else {
- equals(QT_WAYLAND_GL_CONFIG, brcm_egl) {
- CONFIG -= config_wayland_egl config_xcomposite
- }
-
- equals(QT_WAYLAND_GL_CONFIG, xcomposite) {
- CONFIG -= config_wayland_egl config_brcm_egl
- }
-
- config_wayland_egl {
- include (wayland_egl/wayland_egl.pri)
- QT_WAYLAND_GL_INTEGRATION = wayland_egl
- }else:config_brcm_egl {
- include (brcm_egl/brcm_egl.pri)
- QT_WAYLAND_GL_INTEGRATION = brcm_egl
- }else:config_xcomposite{
- config_egl{
- include (xcomposite_egl/xcomposite_egl.pri)
- QT_WAYLAND_GL_INTEGRATION = xcomposite_egl
- }else:config_glx{
- include (xcomposite_glx/xcomposite_glx.pri)
- QT_WAYLAND_GL_INTEGRATION = xcomposite_glx
- }
- }
- }
- system(echo "Qt-Compositor configured with openGL integration: $$QT_WAYLAND_GL_INTEGRATION")
} else {
system(echo "Qt-Compositor configured as raster only compositor")
}
+HEADERS += \
+ hardware_integration/graphicshardwareintegrationplugin.h \
+ hardware_integration/graphicshardwareintegrationfactory.h
+
+SOURCES += \
+ hardware_integration/graphicshardwareintegrationplugin.cpp \
+ hardware_integration/graphicshardwareintegrationfactory.cpp
+
diff --git a/src/compositor/hardware_integration/wayland_egl/wayland_egl.pri b/src/compositor/hardware_integration/wayland_egl/wayland_egl.pri
deleted file mode 100644
index d1e389da..00000000
--- a/src/compositor/hardware_integration/wayland_egl/wayland_egl.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-
-!contains(QT_CONFIG, no-pkg-config) {
- CONFIG += link_pkgconfig
- PKGCONFIG += wayland-egl egl
-} else {
- LIBS += -lwayland-egl -lEGL
-}
-
-SOURCES += \
- $$PWD/waylandeglintegration.cpp
-
-HEADERS += \
- $$PWD/waylandeglintegration.h
diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp
index 9266bc67..a0716f3b 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/wlcompositor.cpp
@@ -83,6 +83,8 @@
#include "hardware_integration/graphicshardwareintegration.h"
#include "waylandwindowmanagerintegration.h"
+#include "hardware_integration/graphicshardwareintegrationfactory.h"
+
namespace Wayland {
static Compositor *compositor;
@@ -141,8 +143,27 @@ Compositor::Compositor(WaylandCompositor *qt_compositor)
#if defined (QT_COMPOSITOR_WAYLAND_GL)
QWindow *window = qt_compositor->window();
- if (window && window->surfaceType() != QWindow::RasterSurface)
- m_graphics_hw_integration = GraphicsHardwareIntegration::createGraphicsHardwareIntegration(qt_compositor);
+ if (window && window->surfaceType() != QWindow::RasterSurface) {
+ QStringList keys = GraphicsHardwareIntegrationFactory::keys();
+ QString targetKey;
+ QByteArray hardwareIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION");
+ if (keys.contains(QString::fromLocal8Bit(hardwareIntegration.constData()))) {
+ targetKey = QString::fromLocal8Bit(hardwareIntegration.constData());
+ } else if (keys.contains(QString::fromLatin1("wayland-egl"))) {
+ targetKey = QString::fromLatin1("wayland-egl");
+ } else if (!keys.isEmpty()) {
+ targetKey = keys.first();
+ }
+
+ if (!targetKey.isEmpty()) {
+ m_graphics_hw_integration = GraphicsHardwareIntegrationFactory::create(targetKey, QStringList());
+ if (m_graphics_hw_integration) {
+ m_graphics_hw_integration->setCompositor(qt_compositor);
+ }
+ }
+ //BUG: if there is no hw_integration, bad things will probably happen
+
+ }
#endif
m_windowManagerIntegration = new WindowManagerServerIntegration(qt_compositor, this);
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 3dd6c024..9613979b 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,2 +1,7 @@
TEMPLATE=subdirs
SUBDIRS += platforms
+
+#The compositor plugins are only useful with QtCompositor
+contains(CONFIG, wayland-compositor) {
+ SUBDIRS += waylandcompositors
+}
diff --git a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.json b/src/plugins/waylandcompositors/brcm-egl/brcm-egl.json
new file mode 100644
index 00000000..48611c6a
--- /dev/null
+++ b/src/plugins/waylandcompositors/brcm-egl/brcm-egl.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "wayland-brcm" ]
+}
diff --git a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro b/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro
new file mode 100644
index 00000000..58568224
--- /dev/null
+++ b/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro
@@ -0,0 +1,22 @@
+PLUGIN_TYPE = waylandcompositors
+load(qt_plugin)
+
+QT = compositor core-private gui-private
+
+OTHER_FILES += wayland_egl.json
+
+LIBS += -lEGL
+
+SOURCES += \
+ brcmeglintegration.cpp \
+ brcmbuffer.cpp \
+ main.cpp
+
+
+HEADERS += \
+ brcmeglintegration.h \
+ brcmbuffer.h
+
+OTHER_FILES += brcm-egl.json
+
+WAYLANDSOURCES += $$PWD/../../../extensions/brcm.xml
diff --git a/src/compositor/hardware_integration/brcm_egl/brcmbuffer.cpp b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp
index c9a71172..c9a71172 100644
--- a/src/compositor/hardware_integration/brcm_egl/brcmbuffer.cpp
+++ b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp
diff --git a/src/compositor/hardware_integration/brcm_egl/brcmbuffer.h b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h
index 0f409801..a06469da 100644
--- a/src/compositor/hardware_integration/brcm_egl/brcmbuffer.h
+++ b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h
@@ -42,7 +42,7 @@
#define BRCMBUFFER_H
#include "waylandobject.h"
-#include "wayland_wrapper/wlcompositor.h"
+#include <QtCompositor/wlcompositor.h>
#include <QtCore/QSize>
#include <QtCore/QVector>
diff --git a/src/compositor/hardware_integration/brcm_egl/brcmeglintegration.cpp b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp
index 23179471..14699f8a 100644
--- a/src/compositor/hardware_integration/brcm_egl/brcmeglintegration.cpp
+++ b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp
@@ -40,9 +40,9 @@
#include "brcmeglintegration.h"
#include "brcmbuffer.h"
-#include "wayland_wrapper/wlcompositor.h"
-#include "wayland_wrapper/wlsurface.h"
-#include "compositor_api/waylandsurface.h"
+#include <QtCompositor/wlsurface.h>
+#include <QtCompositor/wlcompositor.h>
+#include <QtCompositor/waylandsurface.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
@@ -80,8 +80,8 @@ public:
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
};
-BrcmEglIntegration::BrcmEglIntegration(WaylandCompositor *compositor)
- : GraphicsHardwareIntegration(compositor)
+BrcmEglIntegration::BrcmEglIntegration()
+ : GraphicsHardwareIntegration()
, d_ptr(new BrcmEglIntegrationPrivate)
{
}
diff --git a/src/compositor/hardware_integration/brcm_egl/brcmeglintegration.h b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h
index adc64ec1..3fde839d 100644
--- a/src/compositor/hardware_integration/brcm_egl/brcmeglintegration.h
+++ b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h
@@ -41,7 +41,7 @@
#ifndef BRCMEGLINTEGRATION_H
#define BRCMEGLINTEGRATION_H
-#include "hardware_integration/graphicshardwareintegration.h"
+#include <QtCompositor/graphicshardwareintegration.h>
#include <QtCore/QScopedPointer>
class BrcmEglIntegrationPrivate;
@@ -50,7 +50,7 @@ class BrcmEglIntegration : public GraphicsHardwareIntegration
{
Q_DECLARE_PRIVATE(BrcmEglIntegration)
public:
- BrcmEglIntegration(WaylandCompositor *compositor);
+ BrcmEglIntegration();
void initializeHardware(Wayland::Display *waylandDisplay);
diff --git a/src/plugins/waylandcompositors/brcm-egl/main.cpp b/src/plugins/waylandcompositors/brcm-egl/main.cpp
new file mode 100644
index 00000000..d742a2ee
--- /dev/null
+++ b/src/plugins/waylandcompositors/brcm-egl/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCompositor/graphicshardwareintegrationplugin.h>
+#include "brcmeglintegration.h"
+
+class QWaylandIntegrationPlugin : public GraphicsHardwareIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.GraphicsHardwareIntegrationFactoryInterface.5.1" FILE "brcm-egl.json")
+public:
+ QStringList keys() const;
+ GraphicsHardwareIntegration *create(const QString&, const QStringList&);
+};
+
+QStringList QWaylandIntegrationPlugin::keys() const
+{
+ QStringList list;
+ list << "wayland-brcm";
+ return list;
+}
+
+GraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (system.toLower() == "wayland-brcm")
+ return new BrcmEglIntegration();
+
+ return 0;
+}
+
+#include "main.moc"
diff --git a/src/plugins/waylandcompositors/wayland-egl/main.cpp b/src/plugins/waylandcompositors/wayland-egl/main.cpp
new file mode 100644
index 00000000..ee546dad
--- /dev/null
+++ b/src/plugins/waylandcompositors/wayland-egl/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCompositor/graphicshardwareintegrationplugin.h>
+#include "waylandeglintegration.h"
+
+class QWaylandIntegrationPlugin : public GraphicsHardwareIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.GraphicsHardwareIntegrationFactoryInterface.5.1" FILE "wayland-egl.json")
+public:
+ QStringList keys() const;
+ GraphicsHardwareIntegration *create(const QString&, const QStringList&);
+};
+
+QStringList QWaylandIntegrationPlugin::keys() const
+{
+ QStringList list;
+ list << "wayland-egl";
+ return list;
+}
+
+GraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (system.toLower() == "wayland-egl")
+ return new WaylandEglIntegration();
+
+ return 0;
+}
+
+#include "main.moc"
diff --git a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.json b/src/plugins/waylandcompositors/wayland-egl/wayland-egl.json
new file mode 100644
index 00000000..4ea5bab9
--- /dev/null
+++ b/src/plugins/waylandcompositors/wayland-egl/wayland-egl.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "wayland-egl" ]
+}
diff --git a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro b/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro
new file mode 100644
index 00000000..991bacee
--- /dev/null
+++ b/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro
@@ -0,0 +1,20 @@
+PLUGIN_TYPE = waylandcompositors
+load(qt_plugin)
+
+QT = compositor core-private gui-private
+
+OTHER_FILES += wayland-egl.json
+
+!contains(QT_CONFIG, no-pkg-config) {
+ CONFIG += link_pkgconfig
+ PKGCONFIG += wayland-egl egl
+} else {
+ LIBS += -lwayland-egl -lEGL
+}
+
+SOURCES += \
+ waylandeglintegration.cpp \
+ main.cpp
+
+HEADERS += \
+ waylandeglintegration.h
diff --git a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp
index fdb64554..728776bb 100644
--- a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp
+++ b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp
@@ -39,9 +39,9 @@
****************************************************************************/
#include "waylandeglintegration.h"
-#include "wayland_wrapper/wlcompositor.h"
-#include "wayland_wrapper/wlsurface.h"
-#include "compositor_api/waylandsurface.h"
+
+#include <QtCompositor/wlcompositor.h>
+#include <QtCompositor/wlsurface.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
@@ -57,12 +57,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-
-GraphicsHardwareIntegration * GraphicsHardwareIntegration::createGraphicsHardwareIntegration(WaylandCompositor *compositor)
-{
- return new WaylandEglIntegration(compositor);
-}
-
#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);
@@ -108,8 +102,8 @@ public:
QPlatformNativeInterface::NativeResourceForContextFunction get_egl_context;
};
-WaylandEglIntegration::WaylandEglIntegration(WaylandCompositor *compositor)
- : GraphicsHardwareIntegration(compositor)
+WaylandEglIntegration::WaylandEglIntegration()
+ : GraphicsHardwareIntegration()
, d_ptr(new WaylandEglIntegrationPrivate)
{
}
diff --git a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.h b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h
index 552acb5c..de5529e2 100644
--- a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.h
+++ b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h
@@ -41,7 +41,7 @@
#ifndef WAYLANDEGLINTEGRATION_H
#define WAYLANDEGLINTEGRATION_H
-#include "hardware_integration/graphicshardwareintegration.h"
+#include <QtCompositor/graphicshardwareintegration.h>
#include <QtCore/QScopedPointer>
class WaylandEglIntegrationPrivate;
@@ -50,7 +50,7 @@ class WaylandEglIntegration : public GraphicsHardwareIntegration
{
Q_DECLARE_PRIVATE(WaylandEglIntegration)
public:
- WaylandEglIntegration(WaylandCompositor *compositor);
+ WaylandEglIntegration();
void initializeHardware(Wayland::Display *waylandDisplay);
diff --git a/src/plugins/waylandcompositors/waylandcompositors.pro b/src/plugins/waylandcompositors/waylandcompositors.pro
new file mode 100644
index 00000000..8a4d9b04
--- /dev/null
+++ b/src/plugins/waylandcompositors/waylandcompositors.pro
@@ -0,0 +1,17 @@
+TEMPLATE = subdirs
+
+!isEqual(QT_WAYLAND_GL_CONFIG,nogl) {
+ config_wayland_egl {
+ SUBDIRS += wayland-egl
+ }
+ config_brcm_egl {
+ SUBDIRS += brcm-egl
+ }
+ config_xcomposite {
+ config_egl {
+ SUBDIRS += xcomposite-egl
+ } else:config_glx {
+ SUBDIRS += xcomposite-glx
+ }
+ }
+}
diff --git a/src/plugins/waylandcompositors/xcomposite-egl/main.cpp b/src/plugins/waylandcompositors/xcomposite-egl/main.cpp
new file mode 100644
index 00000000..6a913e27
--- /dev/null
+++ b/src/plugins/waylandcompositors/xcomposite-egl/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCompositor/graphicshardwareintegrationplugin.h>
+#include "xcompositeeglintegration.h"
+
+class QWaylandIntegrationPlugin : public GraphicsHardwareIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.GraphicsHardwareIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json")
+public:
+ QStringList keys() const;
+ GraphicsHardwareIntegration *create(const QString&, const QStringList&);
+};
+
+QStringList QWaylandIntegrationPlugin::keys() const
+{
+ QStringList list;
+ list << "wayland-xcomposite";
+ return list;
+}
+
+GraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (system.toLower() == "wayland-xcomposite")
+ return new XCompositeEglIntegration();
+
+ return 0;
+}
+
+#include "main.moc"
diff --git a/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json b/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json
new file mode 100644
index 00000000..8ccd5b46
--- /dev/null
+++ b/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "wayland-xcomposite" ]
+}
diff --git a/src/compositor/hardware_integration/xcomposite_egl/xcomposite_egl.pri b/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro
index 1004fe39..e42d37a3 100644
--- a/src/compositor/hardware_integration/xcomposite_egl/xcomposite_egl.pri
+++ b/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro
@@ -1,3 +1,10 @@
+PLUGIN_TYPE = waylandcompositors
+load(qt_plugin)
+
+QT = compositor core-private gui-private
+
+OTHER_FILES += xcomposite-egl.json
+
include (../xcomposite_share/xcomposite_share.pri)
!contains(QT_CONFIG, no-pkg-config) {
@@ -8,7 +15,8 @@ include (../xcomposite_share/xcomposite_share.pri)
}
HEADERS += \
- $$PWD/xcompositeeglintegration.h
+ xcompositeeglintegration.h
SOURCES += \
- $$PWD/xcompositeeglintegration.cpp
+ xcompositeeglintegration.cpp \
+ main.cpp
diff --git a/src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.cpp b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp
index 84905499..e403cc8e 100644
--- a/src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.cpp
+++ b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp
@@ -41,9 +41,9 @@
#include "xcompositeeglintegration.h"
#include "waylandobject.h"
-#include "wayland_wrapper/wlcompositor.h"
#include "wayland-xcomposite-server-protocol.h"
+#include <QtCompositor/wlcompositor.h>
#include <QtGui/QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformopenglcontext.h>
@@ -71,14 +71,14 @@ struct wl_xcomposite_interface XCompositeHandler::xcomposite_interface = {
XCompositeHandler::create_buffer
};
-GraphicsHardwareIntegration *GraphicsHardwareIntegration::createGraphicsHardwareIntegration(WaylandCompositor *compositor)
+XCompositeEglIntegration::XCompositeEglIntegration()
+ : GraphicsHardwareIntegration()
+ , mDisplay(0)
{
- return new XCompositeEglIntegration(compositor);
+
}
-XCompositeEglIntegration::XCompositeEglIntegration(WaylandCompositor *compositor)
- : GraphicsHardwareIntegration(compositor)
- , mDisplay(0)
+void XCompositeEglIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (nativeInterface) {
@@ -87,15 +87,11 @@ XCompositeEglIntegration::XCompositeEglIntegration(WaylandCompositor *compositor
qFatal("could not retireve Display from platform integration");
mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWindow("EGLDisplay",m_compositor->window()));
if (!mEglDisplay)
- qFatal("could not retrieve EGLDisplay from plaform integration");
+ qFatal("could not retrieve EGLDisplay from platform integration");
} else {
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
-}
-
-void XCompositeEglIntegration::initializeHardware(Wayland::Display *waylandDisplay)
-{
XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
wl_display_add_global(waylandDisplay->handle(),&wl_xcomposite_interface,handler,XCompositeHandler::xcomposite_bind_func);
}
@@ -128,7 +124,7 @@ GLuint XCompositeEglIntegration::createTextureFromBuffer(wl_buffer *buffer, QOpe
qDebug() << "Failed to create eglsurface" << pixmap << compositorBuffer->window();
}
- compositorBuffer->setInvertedY(false);
+ compositorBuffer->setInvertedY(true);
GLuint textureId;
glGenTextures(1,&textureId);
diff --git a/src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.h b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h
index 61f21afb..7bcbfc73 100644
--- a/src/compositor/hardware_integration/xcomposite_egl/xcompositeeglintegration.h
+++ b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h
@@ -41,7 +41,7 @@
#ifndef XCOMPOSITEEGLINTEGRATION_H
#define XCOMPOSITEEGLINTEGRATION_H
-#include "hardware_integration/graphicshardwareintegration.h"
+#include <QtCompositor/graphicshardwareintegration.h>
#include "xlibinclude.h"
@@ -50,7 +50,7 @@
class XCompositeEglIntegration : public GraphicsHardwareIntegration
{
public:
- XCompositeEglIntegration(WaylandCompositor *compositor);
+ XCompositeEglIntegration();
void initializeHardware(Wayland::Display *waylandDisplay);
diff --git a/src/plugins/waylandcompositors/xcomposite-glx/main.cpp b/src/plugins/waylandcompositors/xcomposite-glx/main.cpp
new file mode 100644
index 00000000..dfd72716
--- /dev/null
+++ b/src/plugins/waylandcompositors/xcomposite-glx/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCompositor/graphicshardwareintegrationplugin.h>
+#include "xcompositeglxintegration.h"
+
+class QWaylandIntegrationPlugin : public GraphicsHardwareIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.GraphicsHardwareIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json")
+public:
+ QStringList keys() const;
+ GraphicsHardwareIntegration *create(const QString&, const QStringList&);
+};
+
+QStringList QWaylandIntegrationPlugin::keys() const
+{
+ QStringList list;
+ list << "wayland-xcomposite";
+ return list;
+}
+
+GraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (system.toLower() == "wayland-xcomposite")
+ return new XCompositeGLXIntegration();
+
+ return 0;
+}
+
+#include "main.moc"
diff --git a/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json b/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json
new file mode 100644
index 00000000..8ccd5b46
--- /dev/null
+++ b/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "wayland-xcomposite" ]
+}
diff --git a/src/compositor/hardware_integration/xcomposite_glx/xcomposite_glx.pri b/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro
index 26281cc6..c14a9f63 100644
--- a/src/compositor/hardware_integration/xcomposite_glx/xcomposite_glx.pri
+++ b/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro
@@ -1,3 +1,10 @@
+PLUGIN_TYPE = waylandcompositors
+load(qt_plugin)
+
+QT = compositor core-private gui-private
+
+OTHER_FILES += xcomposite-glx.json
+
include (../xcomposite_share/xcomposite_share.pri)
!contains(QT_CONFIG, no-pkg-config) {
@@ -8,7 +15,8 @@ include (../xcomposite_share/xcomposite_share.pri)
}
HEADERS += \
- $$PWD/xcompositeglxintegration.h
+ xcompositeglxintegration.h
SOURCES += \
- $$PWD/xcompositeglxintegration.cpp
+ xcompositeglxintegration.cpp \
+ main.cpp
diff --git a/src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.cpp b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp
index 1c4ad394..c6cc8a56 100644
--- a/src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.cpp
+++ b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp
@@ -41,7 +41,7 @@
#include "xcompositeglxintegration.h"
#include "waylandobject.h"
-#include "wayland_wrapper/wlcompositor.h"
+#include <QtCompositor/wlcompositor.h>
#include "wayland-xcomposite-server-protocol.h"
#include <qpa/qplatformnativeinterface.h>
@@ -63,7 +63,7 @@ QVector<int> qglx_buildSpec()
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++] = GLX_BIND_TO_TEXTURE_RGB_EXT; spec[i++] = true;
spec[i++] = 0;
return spec;
@@ -74,15 +74,19 @@ struct wl_xcomposite_interface XCompositeHandler::xcomposite_interface = {
XCompositeHandler::create_buffer
};
-GraphicsHardwareIntegration *GraphicsHardwareIntegration::createGraphicsHardwareIntegration(WaylandCompositor *compositor)
+XCompositeGLXIntegration::XCompositeGLXIntegration()
+ : GraphicsHardwareIntegration()
+ , mDisplay(0)
+ , mHandler(0)
{
- return new XCompositeGLXIntegration(compositor);
}
-XCompositeGLXIntegration::XCompositeGLXIntegration(WaylandCompositor *compositor)
- : GraphicsHardwareIntegration(compositor)
- , mDisplay(0)
- , mHandler(0)
+XCompositeGLXIntegration::~XCompositeGLXIntegration()
+{
+ delete mHandler;
+}
+
+void XCompositeGLXIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
@@ -93,15 +97,7 @@ XCompositeGLXIntegration::XCompositeGLXIntegration(WaylandCompositor *compositor
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
-}
-XCompositeGLXIntegration::~XCompositeGLXIntegration()
-{
- delete mHandler;
-}
-
-void XCompositeGLXIntegration::initializeHardware(Wayland::Display *waylandDisplay)
-{
mHandler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
wl_display_add_global(waylandDisplay->handle(),&wl_xcomposite_interface,mHandler,XCompositeHandler::xcomposite_bind_func);
diff --git a/src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.h b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h
index 308d6c88..c17e1ac9 100644
--- a/src/compositor/hardware_integration/xcomposite_glx/xcompositeglxintegration.h
+++ b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h
@@ -41,7 +41,7 @@
#ifndef XCOMPOSITEGLXINTEGRATION_H
#define XCOMPOSITEGLXINTEGRATION_H
-#include "hardware_integration/graphicshardwareintegration.h"
+#include <QtCompositor/graphicshardwareintegration.h>
#include "xlibinclude.h"
@@ -54,7 +54,7 @@ class XCompositeHandler;
class XCompositeGLXIntegration : public GraphicsHardwareIntegration
{
public:
- XCompositeGLXIntegration(WaylandCompositor *compositor);
+ XCompositeGLXIntegration();
~XCompositeGLXIntegration();
void initializeHardware(Wayland::Display *waylandDisplay);
diff --git a/src/compositor/hardware_integration/xcomposite_share/xcomposite_share.pri b/src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri
index 631ddaf2..631ddaf2 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xcomposite_share.pri
+++ b/src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri
diff --git a/src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.cpp b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp
index 9e6c4e64..9e6c4e64 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.cpp
+++ b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp
diff --git a/src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.h b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h
index 7a815f0c..bc04ca0c 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xcompositebuffer.h
+++ b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h
@@ -42,7 +42,7 @@
#define XCOMPOSITEBUFFER_H
#include "waylandobject.h"
-#include "wayland_wrapper/wlcompositor.h"
+#include <QtCompositor/wlcompositor.h>
#include <QtCore/QSize>
diff --git a/src/compositor/hardware_integration/xcomposite_share/xcompositehandler.cpp b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp
index 7bb63e2b..7bb63e2b 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xcompositehandler.cpp
+++ b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp
diff --git a/src/compositor/hardware_integration/xcomposite_share/xcompositehandler.h b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h
index e2c85ef0..59f7ab1b 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xcompositehandler.h
+++ b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h
@@ -41,7 +41,7 @@
#ifndef XCOMPOSITEHANDLER_H
#define XCOMPOSITEHANDLER_H
-#include "wayland_wrapper/wlcompositor.h"
+#include <QtCompositor/wlcompositor.h>
#include "waylandobject.h"
#include "xlibinclude.h"
diff --git a/src/compositor/hardware_integration/xcomposite_share/xlibinclude.h b/src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h
index 733fd6fd..733fd6fd 100644
--- a/src/compositor/hardware_integration/xcomposite_share/xlibinclude.h
+++ b/src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h
diff --git a/src/src.pro b/src/src.pro
index c4d03afb..a12622d5 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,8 +1,9 @@
TEMPLATE=subdirs
-
-SUBDIRS = plugins
+CONFIG+=ordered
#Don't build QtCompositor API unless explicitly enabled
contains(CONFIG, wayland-compositor) {
SUBDIRS += compositor
}
+
+SUBDIRS += plugins