diff options
author | Jorgen Lind <jorgen.lind@digia.com> | 2013-11-22 14:12:58 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-27 20:58:48 +0100 |
commit | 15f5eab1239d8269ea7f184bfd51deddd76900e2 (patch) | |
tree | a6ed6edd7c2000ed815b3b329f3cf09e0d72cd5a /src/client/hardwareintegration | |
parent | cdf039711561643a5048cea0e49a833e8baeb7b0 (diff) |
Add serverbufferintegration to the qpa plugin
Change-Id: I3802ec2c2b69fa56d6a64962590ebaa7314b3eea
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/client/hardwareintegration')
7 files changed, 373 insertions, 2 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 |