summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorgen Lind <jorgen.lind@digia.com>2013-11-13 16:30:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-27 15:32:39 +0100
commit543e34f643efd7fdd3126244a8a6b2596fb21da4 (patch)
treedb2f5f1d050ad407e44570cc5bcc853a8422c15f
parent434dcf63a5753c56bcc94185d1af381ae94efeb5 (diff)
downloadqtwayland-543e34f643efd7fdd3126244a8a6b2596fb21da4.tar.gz
qtwayland-543e34f643efd7fdd3126244a8a6b2596fb21da4.tar.bz2
qtwayland-543e34f643efd7fdd3126244a8a6b2596fb21da4.zip
Add server buffer extension
Change-Id: I69b8f59eecf807179e5962e111f7096a6dfbd797 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri14
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp81
-rw-r--r--src/compositor/hardware_integration/qwaylandserverbufferintegration.h88
-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/wayland_wrapper/qwlcompositor.cpp86
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor_p.h9
-rw-r--r--src/extensions/server-buffer-extension.xml56
10 files changed, 588 insertions, 28 deletions
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index 351cb2e4..402a3f6b 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -3,15 +3,25 @@ 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
+
HEADERS += \
hardware_integration/qwaylandclientbufferintegration.h \
hardware_integration/qwaylandclientbufferintegrationfactory.h \
- hardware_integration/qwaylandclientbufferintegrationplugin.h
+ hardware_integration/qwaylandclientbufferintegrationplugin.h \
+ hardware_integration/qwaylandserverbufferintegration.h \
+ hardware_integration/qwaylandserverbufferintegrationfactory.h \
+ hardware_integration/qwaylandserverbufferintegrationplugin.h
SOURCES += \
hardware_integration/qwaylandclientbufferintegration.cpp \
hardware_integration/qwaylandclientbufferintegrationfactory.cpp \
- hardware_integration/qwaylandclientbufferintegrationplugin.cpp
+ hardware_integration/qwaylandclientbufferintegrationplugin.cpp \
+ hardware_integration/qwaylandserverbufferintegration.cpp \
+ hardware_integration/qwaylandserverbufferintegrationfactory.cpp \
+ hardware_integration/qwaylandserverbufferintegrationplugin.cpp
DEFINES += QT_COMPOSITOR_WAYLAND_GL
} else {
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp
new file mode 100644
index 00000000..df564416
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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"
+
+QWaylandServerBuffer::QWaylandServerBuffer()
+{ }
+QWaylandServerBuffer::~QWaylandServerBuffer()
+{ }
+
+void QWaylandServerBuffer::sendToClient(struct ::wl_client *)
+{ }
+
+GLuint QWaylandServerBuffer::createTexture(QOpenGLContext *)
+{
+ return 0;
+}
+
+bool QWaylandServerBuffer::isYInverted(struct ::wl_resource *) const
+{
+ return true;
+}
+
+QSize QWaylandServerBuffer::size() const
+{
+ return QSize();
+}
+
+QWaylandServerBufferIntegration::QWaylandServerBufferIntegration()
+{ }
+
+QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration()
+{ }
+
+void QWaylandServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+{
+ Q_UNUSED(compositor);
+}
+
+QWaylandServerBuffer *QWaylandServerBufferIntegration::createServerBuffer()
+{
+ return 0;
+}
+
diff --git a/src/compositor/hardware_integration/qwaylandserverbufferintegration.h b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h
new file mode 100644
index 00000000..8de51981
--- /dev/null
+++ b/src/compositor/hardware_integration/qwaylandserverbufferintegration.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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:
+ QWaylandServerBuffer();
+ virtual ~QWaylandServerBuffer();
+
+ virtual void sendToClient(struct ::wl_client *);
+
+ virtual GLuint createTexture(QOpenGLContext *);
+ virtual bool isYInverted(struct ::wl_resource *) const;
+
+ virtual QSize size() const;
+};
+
+class Q_COMPOSITOR_EXPORT QWaylandServerBufferIntegration
+{
+public:
+ QWaylandServerBufferIntegration();
+ virtual ~QWaylandServerBufferIntegration();
+
+ virtual void initializeHardware(QWaylandCompositor *);
+
+ virtual QWaylandServerBuffer *createServerBuffer();
+};
+
+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 00000000..ded6acb7
--- /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("/waylandcompositors"), 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 00000000..c7fe384c
--- /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 00000000..ebe860b4
--- /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 00000000..6910880e
--- /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/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index 9a321f0c..206155a4 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -85,9 +85,11 @@
#include <wayland-server.h>
#include "hardware_integration/qwaylandclientbufferintegration.h"
+#include "hardware_integration/qwaylandserverbufferintegration.h"
#include "waylandwindowmanagerintegration.h"
#include "hardware_integration/qwaylandclientbufferintegrationfactory.h"
+#include "hardware_integration/qwaylandserverbufferintegrationfactory.h"
QT_BEGIN_NAMESPACE
@@ -138,7 +140,8 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex
, m_directRenderContext(0)
, m_directRenderActive(false)
#if defined (QT_COMPOSITOR_WAYLAND_GL)
- , m_graphics_client_buffer_integration(0)
+ , m_client_buffer_integration(0)
+ , m_server_buffer_integration(0)
#endif
, m_windowManagerIntegration(0)
, m_outputExtension(0)
@@ -156,27 +159,11 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex
#if defined (QT_COMPOSITOR_WAYLAND_GL)
QWindow *window = qt_compositor->window();
if (window && window->surfaceType() != QWindow::RasterSurface) {
- QStringList keys = QWaylandClientBufferIntegrationFactory::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_client_buffer_integration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList());
- if (m_graphics_client_buffer_integration) {
- m_graphics_client_buffer_integration->setCompositor(qt_compositor);
- }
- }
- //BUG: if there is no hw_integration, bad things will probably happen
-
+ loadClientBufferIntegration();
+ loadServerBufferIntegration();
}
#endif
+
if (extensions & QWaylandCompositor::WindowManagerExtension)
m_windowManagerIntegration = new WindowManagerServerIntegration(qt_compositor, this);
@@ -238,7 +225,8 @@ Compositor::~Compositor()
delete m_data_device_manager;
#ifdef QT_COMPOSITOR_WAYLAND_GL
- delete m_graphics_client_buffer_integration;
+ delete m_client_buffer_integration;
+ delete m_server_buffer_integration;
#endif
delete m_output_global;
delete m_display;
@@ -333,7 +321,16 @@ QWindow *Compositor::window() const
QWaylandClientBufferIntegration * Compositor::clientBufferIntegration() const
{
#ifdef QT_COMPOSITOR_WAYLAND_GL
- return m_graphics_client_buffer_integration;
+ return m_client_buffer_integration;
+#else
+ return 0;
+#endif
+}
+
+QWaylandServerBufferIntegration * Compositor::serverBufferIntegration() const
+{
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+ return m_server_buffer_integration;
#else
return 0;
#endif
@@ -342,8 +339,10 @@ QWaylandClientBufferIntegration * Compositor::clientBufferIntegration() const
void Compositor::initializeHardwareIntegration()
{
#ifdef QT_COMPOSITOR_WAYLAND_GL
- if (m_graphics_client_buffer_integration)
- m_graphics_client_buffer_integration->initializeHardware(m_display);
+ if (m_client_buffer_integration)
+ m_client_buffer_integration->initializeHardware(m_display);
+ if (m_server_buffer_integration)
+ m_server_buffer_integration->initializeHardware(m_qt_compositor);
#endif
}
@@ -369,7 +368,7 @@ bool Compositor::setDirectRenderSurface(Surface *surface, QOpenGLContext *contex
if (!surface)
setDirectRenderingActive(false);
- if (m_graphics_client_buffer_integration && m_graphics_client_buffer_integration->setDirectRenderSurface(surface ? surface->waylandSurface() : 0)) {
+ if (m_client_buffer_integration && m_client_buffer_integration->setDirectRenderSurface(surface ? surface->waylandSurface() : 0)) {
m_directRenderSurface = surface;
m_directRenderContext = context;
return true;
@@ -554,6 +553,43 @@ void Compositor::sendDragEndEvent()
// Drag::instance()->dragEnd();
}
+void Compositor::loadClientBufferIntegration()
+{
+ QStringList keys = QWaylandClientBufferIntegrationFactory::keys();
+ QString targetKey;
+ QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION");
+ if (clientBufferIntegration.isEmpty())
+ clientBufferIntegration = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
+ if (keys.contains(QString::fromLocal8Bit(clientBufferIntegration.constData()))) {
+ targetKey = QString::fromLocal8Bit(clientBufferIntegration.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_client_buffer_integration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList());
+ if (m_client_buffer_integration) {
+ m_client_buffer_integration->setCompositor(m_qt_compositor);
+ }
+ }
+ //BUG: if there is no client buffer integration, bad things will when opengl is used
+}
+
+void Compositor::loadServerBufferIntegration()
+{
+ QStringList keys = QWaylandServerBufferIntegrationFactory::keys();
+ QString targetKey;
+ QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
+ if (keys.contains(QString::fromLocal8Bit(serverBufferIntegration.constData()))) {
+ targetKey = QString::fromLocal8Bit(serverBufferIntegration.constData());
+ }
+ if (!targetKey.isEmpty()) {
+ m_server_buffer_integration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList());
+ }
+}
+
} // namespace Wayland
QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h
index 2448dcb3..0d7bf024 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor_p.h
+++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h
@@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE
class QWaylandCompositor;
class QWaylandInputDevice;
class QWaylandClientBufferIntegration;
+class QWaylandServerBufferIntegration;
class WindowManagerServerIntegration;
class QMimeData;
class QPlatformScreenPageFlipper;
@@ -102,6 +103,7 @@ public:
QWindow *window() const;
QWaylandClientBufferIntegration *clientBufferIntegration() const;
+ QWaylandServerBufferIntegration *serverBufferIntegration() const;
void initializeHardwareIntegration();
void initializeDefaultInputDevice();
void initializeWindowManagerProtocol();
@@ -119,6 +121,7 @@ public:
QPointF mapToSurface(Surface *surface, const QPointF &globalPosition);
struct wl_display *wl_display() const { return m_display->handle(); }
+ Display *display() const { return m_display; }
static Compositor *instance();
@@ -165,6 +168,9 @@ private slots:
void processWaylandEvents();
private:
+ void loadClientBufferIntegration();
+ void loadServerBufferIntegration();
+
QWaylandCompositor::ExtensionFlags m_extensions;
Display *m_display;
@@ -199,7 +205,8 @@ private:
bool m_directRenderActive;
#ifdef QT_COMPOSITOR_WAYLAND_GL
- QWaylandClientBufferIntegration *m_graphics_client_buffer_integration;
+ QWaylandClientBufferIntegration *m_client_buffer_integration;
+ QWaylandServerBufferIntegration *m_server_buffer_integration;
#endif
//extensions
diff --git a/src/extensions/server-buffer-extension.xml b/src/extensions/server-buffer-extension.xml
new file mode 100644
index 00000000..28271c67
--- /dev/null
+++ b/src/extensions/server-buffer-extension.xml
@@ -0,0 +1,56 @@
+<protocol name="server_buffer_extension">
+
+ <copyright>
+ Copyright (C) 2013 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: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$
+ </copyright>
+
+ <interface name="qt_server_buffer_extension" version="1">
+ <description summary="buffers managed by the compositor">
+ Server buffer is an extension which makes it possible to share a
+ buffer created by the compositor to share it with arbitrary
+ clients. These types of buffers are intended to be read only
+ buffers for clients, but this is an implementation detail.
+
+ Server buffers main purpose is to help implement caches
+ </description>
+ <event name="destroy" type="destructor">
+ </event>
+
+ <request name="release">
+ </request>
+ </interface>
+</protocol>