diff options
10 files changed, 410 insertions, 9 deletions
diff --git a/src/client/hardwareintegration/hardwareintegration.pri b/src/client/hardwareintegration/hardwareintegration.pri index 2ed95368f..0ace4777e 100644 --- a/src/client/hardwareintegration/hardwareintegration.pri +++ b/src/client/hardwareintegration/hardwareintegration.pri @@ -1,10 +1,19 @@ +WAYLANDCLIENTSOURCES += \ + $$PWD/../../extensions/server-buffer-extension.xml + SOURCES += \ $$PWD/qwaylandclientbufferintegration.cpp \ $$PWD/qwaylandclientbufferintegrationplugin.cpp \ - $$PWD/qwaylandclientbufferintegrationfactory.cpp + $$PWD/qwaylandclientbufferintegrationfactory.cpp \ + $$PWD/qwaylandserverbufferintegration.cpp \ + $$PWD/qwaylandserverbufferintegrationplugin.cpp \ + $$PWD/qwaylandserverbufferintegrationfactory.cpp HEADERS += \ $$PWD/qwaylandclientbufferintegration.h \ $$PWD/qwaylandclientbufferintegrationplugin.h \ - $$PWD/qwaylandclientbufferintegrationfactory.h + $$PWD/qwaylandclientbufferintegrationfactory.h \ + $$PWD/qwaylandserverbufferintegration.h \ + $$PWD/qwaylandserverbufferintegrationplugin.h \ + $$PWD/qwaylandserverbufferintegrationfactory.h diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp new file mode 100644 index 000000000..66fec00ea --- /dev/null +++ b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -0,0 +1,9 @@ +#include "qwaylandserverbufferintegration.h" + +QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() +{ +} +QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration() +{ +} + diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration.h b/src/client/hardwareintegration/qwaylandserverbufferintegration.h new file mode 100644 index 000000000..0bb8a6ebc --- /dev/null +++ b/src/client/hardwareintegration/qwaylandserverbufferintegration.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 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$ +** +****************************************************************************/ + +#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H +#define QWAYLANDSERVERBUFFERINTEGRATION_H + +#include <QtGui/qopengl.h> + +#include <QtWaylandClient/private/qwayland-server-buffer-extension.h> +#include <QtWaylandClient/qwaylandclientexport.h> + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration +{ +public: + QWaylandServerBufferIntegration(); + virtual ~QWaylandServerBufferIntegration(); + + virtual void initialize(QWaylandDisplay *display) = 0; + + //creates new texture for buffer + virtual GLuint createTextureFor(struct qt_server_buffer *buffer) = 0; + + //does not clean up textures. Just lets server know that it does + //not intend to use the buffer anymore. Textures should have been + //deleted prior to calling this function + virtual void release(struct qt_server_buffer *buffer) = 0; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp new file mode 100644 index 000000000..e36de7e72 --- /dev/null +++ b/src/client/hardwareintegration/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 <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/client"), 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/client/hardwareintegration/qwaylandserverbufferintegrationfactory.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.h new file mode 100644 index 000000000..5e48e7b51 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** 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 <QtWaylandClient/qwaylandclientexport.h> +#include <QtCore/QStringList> + +QT_BEGIN_NAMESPACE + +class QWaylandServerBufferIntegration; + +class Q_WAYLAND_CLIENT_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/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp new file mode 100644 index 000000000..2bb3eb216 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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/client/hardwareintegration/qwaylandserverbufferintegrationplugin.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.h new file mode 100644 index 000000000..c3605dc70 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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 <QtWaylandClient/qwaylandclientexport.h> + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> +#include <QtCore/QObject> + +QT_BEGIN_NAMESPACE + +class QWaylandServerBufferIntegration; + +#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = 0); + ~QWaylandServerBufferIntegrationPlugin(); + + virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 32045bc86..70a09b2ed 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -68,6 +68,8 @@ #include "qwaylandclientbufferintegration.h" #include "qwaylandclientbufferintegrationfactory.h" +#include "qwaylandserverbufferintegration.h" +#include "qwaylandserverbufferintegrationfactory.h" QT_BEGIN_NAMESPACE @@ -110,6 +112,7 @@ QWaylandIntegration::QWaylandIntegration() , mAccessibility(0) #endif , mClientBufferIntegrationInitialized(false) + , mServerBufferIntegrationInitialized(false) { mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); @@ -240,12 +243,20 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { if (!mClientBufferIntegrationInitialized) - const_cast<QWaylandIntegration *>(this)->initializeBufferIntegration(); + const_cast<QWaylandIntegration *>(this)->initializeClientBufferIntegration(); return mClientBufferIntegration; } -void QWaylandIntegration::initializeBufferIntegration() +QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() const +{ + if (!mServerBufferIntegrationInitialized) + const_cast<QWaylandIntegration *>(this)->initializeServerBufferIntegration(); + + return mServerBufferIntegration; +} + +void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; @@ -262,4 +273,21 @@ void QWaylandIntegration::initializeBufferIntegration() mClientBufferIntegration->initialize(mDisplay); } +void QWaylandIntegration::initializeServerBufferIntegration() +{ + mServerBufferIntegrationInitialized = true; + + QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); + if (serverBufferIntegrationName.isEmpty()) + serverBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + + QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); + QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + if (keys.contains(targetKey)) { + mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); + } + if (mServerBufferIntegration) + mServerBufferIntegration->initialize(mDisplay); +} + QT_END_NAMESPACE diff --git a/src/client/qwaylandintegration.h b/src/client/qwaylandintegration.h index bbc3c928a..bc51c23bb 100644 --- a/src/client/qwaylandintegration.h +++ b/src/client/qwaylandintegration.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; class QWaylandClientBufferIntegration; +class QWaylandServerBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -88,10 +89,13 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; + virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; protected: QWaylandClientBufferIntegration *mClientBufferIntegration; + QWaylandServerBufferIntegration *mServerBufferIntegration; private: - void initializeBufferIntegration(); + void initializeClientBufferIntegration(); + void initializeServerBufferIntegration(); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; @@ -100,6 +104,7 @@ private: QScopedPointer<QPlatformInputContext> mInputContext; QPlatformAccessibility *mAccessibility; bool mClientBufferIntegrationInitialized; + bool mServerBufferIntegrationInitialized; }; QT_END_NAMESPACE diff --git a/src/extensions/server-buffer-extension.xml b/src/extensions/server-buffer-extension.xml index 28271c67a..370a80137 100644 --- a/src/extensions/server-buffer-extension.xml +++ b/src/extensions/server-buffer-extension.xml @@ -38,7 +38,7 @@ $QT_END_LICENSE$ </copyright> - <interface name="qt_server_buffer_extension" version="1"> + <interface name="qt_server_buffer" 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 @@ -47,9 +47,6 @@ Server buffers main purpose is to help implement caches </description> - <event name="destroy" type="destructor"> - </event> - <request name="release"> </request> </interface> |