summaryrefslogtreecommitdiffstats
path: root/src/compositor/hardware_integration
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2014-01-09 15:10:43 +0100
committerAndy Nichols <andy.nichols@digia.com>2014-01-09 16:10:23 +0100
commit1c70431808ca2d0797fda05bb9ee3640bff800bb (patch)
tree6bbf1333b7da5afea2e163263820d5c40dbc1ea3 /src/compositor/hardware_integration
parent3e02c41cc43a20c8af41730934ae7bbac02ab861 (diff)
parentc9734e76ce03ebba63e34b60b16a9cca3efa3569 (diff)
Merge remote-tracking branch stable into dev
Conflicts: .qmake.conf src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp src/plugins/platforms/qwayland-brcm-egl/main.cpp src/plugins/platforms/qwayland-egl/main.cpp src/plugins/platforms/qwayland-generic/main.cpp src/plugins/platforms/qwayland-xcomposite-egl/main.cpp src/plugins/platforms/qwayland-xcomposite-glx/main.cpp Change-Id: I957c9bee893a9e19fc8c93f0e51292007fb3a4a8
Diffstat (limited to 'src/compositor/hardware_integration')
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri27
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegration.cpp (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.cpp)4
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegration.h (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.h)24
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.cpp (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.cpp)18
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.h (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.h)12
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.cpp (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.cpp)6
-rw-r--r--src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h (renamed from src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.h)18
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp75
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegration.h99
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.cpp96
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.h62
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.cpp56
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.h68
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration.cpp72
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration_p.h73
15 files changed, 663 insertions, 47 deletions
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index 8477243fe..999434d93 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -1,17 +1,28 @@
-QT += core
-
isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
!isEqual(QT_WAYLAND_GL_CONFIG,nogl) {
+ CONFIG += wayland-scanner
+ WAYLANDSERVERSOURCES += \
+ ../extensions/server-buffer-extension.xml \
+ ../extensions/hardware-integration.xml
+
HEADERS += \
- hardware_integration/qwaylandgraphicshardwareintegration.h \
- hardware_integration/qwaylandgraphicshardwareintegrationfactory.h \
- hardware_integration/qwaylandgraphicshardwareintegrationplugin.h
+ hardware_integration/qwaylandclientbufferintegration.h \
+ hardware_integration/qwaylandclientbufferintegrationfactory.h \
+ hardware_integration/qwaylandclientbufferintegrationplugin.h \
+ hardware_integration/qwaylandserverbufferintegration.h \
+ hardware_integration/qwaylandserverbufferintegrationfactory.h \
+ hardware_integration/qwaylandserverbufferintegrationplugin.h \
+ hardware_integration/qwlhwintegration_p.h
SOURCES += \
- hardware_integration/qwaylandgraphicshardwareintegration.cpp \
- hardware_integration/qwaylandgraphicshardwareintegrationfactory.cpp \
- hardware_integration/qwaylandgraphicshardwareintegrationplugin.cpp
+ hardware_integration/qwaylandclientbufferintegration.cpp \
+ hardware_integration/qwaylandclientbufferintegrationfactory.cpp \
+ hardware_integration/qwaylandclientbufferintegrationplugin.cpp \
+ hardware_integration/qwaylandserverbufferintegration.cpp \
+ hardware_integration/qwaylandserverbufferintegrationfactory.cpp \
+ hardware_integration/qwaylandserverbufferintegrationplugin.cpp \
+ hardware_integration/qwlhwintegration.cpp
DEFINES += QT_COMPOSITOR_WAYLAND_GL
} else {
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.cpp b/src/compositor/hardware_integration/qwaylandclientbufferintegration.cpp
index 7b213bfa5..ff463429f 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.cpp
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegration.cpp
@@ -38,11 +38,11 @@
**
****************************************************************************/
-#include "qwaylandgraphicshardwareintegration.h"
+#include "qwaylandclientbufferintegration.h"
QT_BEGIN_NAMESPACE
-QWaylandGraphicsHardwareIntegration::QWaylandGraphicsHardwareIntegration()
+QWaylandClientBufferIntegration::QWaylandClientBufferIntegration()
: m_compositor(0)
{
}
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.h b/src/compositor/hardware_integration/qwaylandclientbufferintegration.h
index b8cc90fb4..b3f305001 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegration.h
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegration.h
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#ifndef GRAPHICSHARDWAREINTEGRATION_H
-#define GRAPHICSHARDWAREINTEGRATION_H
+#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H
+#define QWAYLANDCLIENTBUFFERINTEGRATION_H
#include <QtGui/qopengl.h>
#include <QtGui/QOpenGLContext>
@@ -53,20 +53,24 @@ namespace QtWayland {
class Display;
}
-class Q_COMPOSITOR_EXPORT QWaylandGraphicsHardwareIntegration
+class Q_COMPOSITOR_EXPORT QWaylandClientBufferIntegration
{
public:
- QWaylandGraphicsHardwareIntegration();
- virtual ~QWaylandGraphicsHardwareIntegration() { }
+ QWaylandClientBufferIntegration();
+ virtual ~QWaylandClientBufferIntegration() { }
void setCompositor(QWaylandCompositor *compositor) { m_compositor = compositor; }
virtual void initializeHardware(QtWayland::Display *waylandDisplay) = 0;
- /** Bind the Wayland buffer to the textureId. The correct context is the current context,
- so there is no need to do makeCurrent in this function.
- **/
- virtual GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) = 0;
+ // Used when the hardware integration wants to provide its own texture for a given buffer.
+ // In most cases the compositor creates and manages the texture so this is not needed.
+ virtual GLuint textureForBuffer(struct ::wl_resource *buffer) { Q_UNUSED(buffer); return 0; }
+ virtual void destroyTextureForBuffer(struct ::wl_resource *buffer) { Q_UNUSED(buffer); }
+
+ // Called with the texture bound.
+ virtual void bindTextureToBuffer(struct ::wl_resource *buffer) = 0;
+
virtual bool isYInverted(struct ::wl_resource *) const { return true; }
virtual bool setDirectRenderSurface(QWaylandSurface *) {return false;}
@@ -82,4 +86,4 @@ protected:
QT_END_NAMESPACE
-#endif // GRAPHICSHARDWAREINTEGRATION_H
+#endif // QWAYLANDCLIENTBUFFERINTEGRATION_H
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.cpp b/src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.cpp
index 17e2dbdbe..71ea9ec4d 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qwaylandgraphicshardwareintegrationfactory.h"
-#include "qwaylandgraphicshardwareintegrationplugin.h"
-#include "qwaylandgraphicshardwareintegration.h"
+#include "qwaylandclientbufferintegrationfactory.h"
+#include "qwaylandclientbufferintegrationplugin.h"
+#include "qwaylandclientbufferintegration.h"
#include <QtCore/private/qfactoryloader_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QWaylandGraphicsHardwareIntegrationFactoryInterface_iid, QLatin1String("/waylandcompositors"), Qt::CaseInsensitive))
+ (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/server"), Qt::CaseInsensitive))
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandGraphicsHardwareIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+ (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
-QStringList QWaylandGraphicsHardwareIntegrationFactory::keys(const QString &pluginPath)
+QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath)
{
#ifndef QT_NO_LIBRARY
QStringList list;
@@ -78,16 +78,16 @@ QStringList QWaylandGraphicsHardwareIntegrationFactory::keys(const QString &plug
#endif
}
-QWaylandGraphicsHardwareIntegration *QWaylandGraphicsHardwareIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::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 (QWaylandGraphicsHardwareIntegration *ret = qLoadPlugin1<QWaylandGraphicsHardwareIntegration, QWaylandGraphicsHardwareIntegrationPlugin>(directLoader(), name, args))
+ if (QWaylandClientBufferIntegration *ret = qLoadPlugin1<QWaylandClientBufferIntegration, QWaylandClientBufferIntegrationPlugin>(directLoader(), name, args))
return ret;
}
- if (QWaylandGraphicsHardwareIntegration *ret = qLoadPlugin1<QWaylandGraphicsHardwareIntegration, QWaylandGraphicsHardwareIntegrationPlugin>(loader(), name, args))
+ if (QWaylandClientBufferIntegration *ret = qLoadPlugin1<QWaylandClientBufferIntegration, QWaylandClientBufferIntegrationPlugin>(loader(), name, args))
return ret;
#endif
return 0;
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.h b/src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.h
index 74e5dda0c..c9d95f8f7 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationfactory.h
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegrationfactory.h
@@ -39,23 +39,23 @@
**
****************************************************************************/
-#ifndef GRAPHICSHARDWAREINTEGRATIONFACTORY_H
-#define GRAPHICSHARDWAREINTEGRATIONFACTORY_H
+#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
+#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
#include <QtCompositor/qwaylandexport.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
-class QWaylandGraphicsHardwareIntegration;
+class QWaylandClientBufferIntegration;
-class Q_COMPOSITOR_EXPORT QWaylandGraphicsHardwareIntegrationFactory
+class Q_COMPOSITOR_EXPORT QWaylandClientBufferIntegrationFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
- static QWaylandGraphicsHardwareIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
};
QT_END_NAMESPACE
-#endif // GRAPHICSHARDWAREINTEGRATIONFACTORY_H
+#endif // QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.cpp b/src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.cpp
index 66e07352e..58bb26d19 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.cpp
@@ -39,16 +39,16 @@
**
****************************************************************************/
-#include "qwaylandgraphicshardwareintegrationplugin.h"
+#include "qwaylandclientbufferintegrationplugin.h"
QT_BEGIN_NAMESPACE
-QWaylandGraphicsHardwareIntegrationPlugin::QWaylandGraphicsHardwareIntegrationPlugin(QObject *parent) :
+QWaylandClientBufferIntegrationPlugin::QWaylandClientBufferIntegrationPlugin(QObject *parent) :
QObject(parent)
{
}
-QWaylandGraphicsHardwareIntegrationPlugin::~QWaylandGraphicsHardwareIntegrationPlugin()
+QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin()
{
}
diff --git a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.h b/src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h
index 2deb3a6c4..2296b9df6 100644
--- a/src/compositor/hardware_integration/qwaylandgraphicshardwareintegrationplugin.h
+++ b/src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
-#define GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
+#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
+#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
#include <QtCompositor/qwaylandexport.h>
@@ -49,20 +49,20 @@
QT_BEGIN_NAMESPACE
-class QWaylandGraphicsHardwareIntegration;
+class QWaylandClientBufferIntegration;
-#define QWaylandGraphicsHardwareIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QWaylandGraphicsHardwareIntegrationFactoryInterface.5.3"
+#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QWaylandClientBufferIntegrationFactoryInterface.5.3"
-class Q_COMPOSITOR_EXPORT QWaylandGraphicsHardwareIntegrationPlugin : public QObject
+class Q_COMPOSITOR_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
- explicit QWaylandGraphicsHardwareIntegrationPlugin(QObject *parent = 0);
- ~QWaylandGraphicsHardwareIntegrationPlugin();
+ explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = 0);
+ ~QWaylandClientBufferIntegrationPlugin();
- virtual QWaylandGraphicsHardwareIntegration *create(const QString &key, const QStringList &paramList) = 0;
+ virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList &paramList) = 0;
};
QT_END_NAMESPACE
-#endif // GRAPHICSHARDWAREINTEGRATIONPLUGIN_H
+#endif // QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp
new file mode 100644
index 000000000..520f9307b
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandserverbufferintegration.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandServerBuffer::QWaylandServerBuffer(const QSize &size, QWaylandServerBuffer::Format format)
+ : m_size(size)
+ , m_format(format)
+{ }
+QWaylandServerBuffer::~QWaylandServerBuffer()
+{ }
+
+
+bool QWaylandServerBuffer::isYInverted() const
+{
+ return false;
+}
+
+QSize QWaylandServerBuffer::size() const
+{ return m_size; }
+
+QWaylandServerBuffer::Format QWaylandServerBuffer::format() const
+{ return m_format; }
+
+QWaylandServerBufferIntegration::QWaylandServerBufferIntegration()
+{ }
+
+QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration()
+{ }
+
+void QWaylandServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+{
+ Q_UNUSED(compositor);
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.h b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h
new file mode 100644
index 000000000..7033cd753
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H
+#define QWAYLANDSERVERBUFFERINTEGRATION_H
+
+#include <QtCore/qglobal.h>
+#include <QtCore/QSize>
+#include <QtGui/qopengl.h>
+
+#include <QtCompositor/qwaylandexport.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandCompositor;
+class QOpenGLContext;
+struct wl_client;
+struct wl_resource;
+
+namespace QtWayland {
+ class Display;
+}
+
+class Q_COMPOSITOR_EXPORT QWaylandServerBuffer
+{
+public:
+ enum Format {
+ RGBA32,
+ A8
+ };
+
+ QWaylandServerBuffer(const QSize &size, QWaylandServerBuffer::Format format);
+ virtual ~QWaylandServerBuffer();
+
+ virtual struct ::wl_resource *resourceForClient(struct ::wl_client *) = 0;
+
+ virtual void bindTextureToBuffer() = 0;
+
+ virtual bool isYInverted() const;
+
+ QSize size() const;
+ Format format() const;
+protected:
+ QSize m_size;
+ Format m_format;
+};
+
+class Q_COMPOSITOR_EXPORT QWaylandServerBufferIntegration
+{
+public:
+ QWaylandServerBufferIntegration();
+ virtual ~QWaylandServerBufferIntegration();
+
+ virtual void initializeHardware(QWaylandCompositor *);
+
+ virtual bool supportsFormat(QWaylandServerBuffer::Format format) const = 0;
+ virtual QWaylandServerBuffer *createServerBuffer(const QSize &size, QWaylandServerBuffer::Format format) = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif //QWAYLANDSERVERBUFFERINTEGRATION_H
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.cpp
new file mode 100644
index 000000000..2a99bda98
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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 "qwaylandserverbufferintegrationfactory.h"
+#include "qwaylandserverbufferintegrationplugin.h"
+#include "qwaylandserverbufferintegration.h"
+#include <QtCore/private/qfactoryloader_p.h>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_LIBRARY
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/server"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
+ (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+#endif
+
+QStringList QWaylandServerBufferIntegrationFactory::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
+}
+
+QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::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 (QWaylandServerBufferIntegration *ret = qLoadPlugin1<QWaylandServerBufferIntegration, QWaylandServerBufferIntegrationPlugin>(directLoader(), name, args))
+ return ret;
+ }
+ if (QWaylandServerBufferIntegration *ret = qLoadPlugin1<QWaylandServerBufferIntegration, QWaylandServerBufferIntegrationPlugin>(loader(), name, args))
+ return ret;
+#endif
+ return 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.h b/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.h
new file mode 100644
index 000000000..c7fe384cd
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegrationfactory.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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 QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
+#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
+
+#include <QtCompositor/qwaylandexport.h>
+#include <QtCore/QStringList>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandServerBufferIntegration;
+
+class Q_COMPOSITOR_EXPORT QWaylandServerBufferIntegrationFactory
+{
+public:
+ static QStringList keys(const QString &pluginPath = QString());
+ static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+};
+
+QT_END_NAMESPACE
+
+#endif //QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
+
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.cpp
new file mode 100644
index 000000000..ebe860b4d
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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 "qwaylandserverbufferintegrationplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandServerBufferIntegrationPlugin::QWaylandServerBufferIntegrationPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QWaylandServerBufferIntegrationPlugin::~QWaylandServerBufferIntegrationPlugin()
+{
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.h b/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.h
new file mode 100644
index 000000000..6910880ea
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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 QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
+#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
+
+#include <QtCompositor/qwaylandexport.h>
+
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandServerBufferIntegration;
+
+#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QWaylandServerBufferIntegrationFactoryInterface.5.1"
+
+class Q_COMPOSITOR_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = 0);
+ ~QWaylandServerBufferIntegrationPlugin();
+
+ virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList &paramList) = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
diff --git a/src/compositor/hardware_integration/qwlhwintegration.cpp b/src/compositor/hardware_integration/qwlhwintegration.cpp
new file mode 100644
index 000000000..62614c4d4
--- /dev/null
+++ b/src/compositor/hardware_integration/qwlhwintegration.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwlhwintegration_p.h"
+
+#include "qwlcompositor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+HardwareIntegration::HardwareIntegration(Compositor *compositor)
+ : qt_hardware_integration(compositor->wl_display())
+{
+}
+void HardwareIntegration::setClientBufferIntegration(const QString &name)
+{
+ m_client_buffer_integration = name;
+}
+void HardwareIntegration::setServerBufferIntegration(const QString &name)
+{
+ m_server_buffer_integration = name;
+}
+
+void HardwareIntegration::hardware_integration_bind_resource(Resource *resource)
+{
+ if (m_client_buffer_integration.size())
+ send_client_backend(resource->handle, m_client_buffer_integration);
+ if (m_server_buffer_integration.size())
+ send_server_backend(resource->handle, m_server_buffer_integration);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/hardware_integration/qwlhwintegration_p.h b/src/compositor/hardware_integration/qwlhwintegration_p.h
new file mode 100644
index 000000000..70128eb0e
--- /dev/null
+++ b/src/compositor/hardware_integration/qwlhwintegration_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWLHWINTEGRATION_P_H
+#define QWLHWINTEGRATION_P_H
+
+#include <QtCompositor/private/qwayland-server-hardware-integration.h>
+
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+class Compositor;
+
+class HardwareIntegration : public QtWaylandServer::qt_hardware_integration
+{
+public:
+ HardwareIntegration(Compositor *compositor);
+
+ void setClientBufferIntegration(const QString &name);
+ void setServerBufferIntegration(const QString &name);
+
+protected:
+ void hardware_integration_bind_resource(Resource *resource);
+
+private:
+ QString m_client_buffer_integration;
+ QString m_server_buffer_integration;
+};
+
+}
+
+QT_END_NAMESPACE
+#endif