diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/hardwareintegration/hardwareintegration.pri | 9 | ||||
-rw-r--r-- | src/client/hardwareintegration/qwaylandhardwareintegration.cpp | 72 | ||||
-rw-r--r-- | src/client/hardwareintegration/qwaylandhardwareintegration.h | 71 | ||||
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 5 | ||||
-rw-r--r-- | src/client/qwaylanddisplay.h | 3 | ||||
-rw-r--r-- | src/client/qwaylandintegration.cpp | 44 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.h | 3 | ||||
-rw-r--r-- | src/compositor/hardware_integration/hardware_integration.pri | 11 | ||||
-rw-r--r-- | src/compositor/hardware_integration/qwlhwintegration.cpp | 72 | ||||
-rw-r--r-- | src/compositor/hardware_integration/qwlhwintegration_p.h | 73 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlcompositor.cpp | 36 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlcompositor_p.h | 6 | ||||
-rw-r--r-- | src/extensions/hardware-integration.xml | 54 |
13 files changed, 423 insertions, 36 deletions
diff --git a/src/client/hardwareintegration/hardwareintegration.pri b/src/client/hardwareintegration/hardwareintegration.pri index 0ace4777e..1588ca977 100644 --- a/src/client/hardwareintegration/hardwareintegration.pri +++ b/src/client/hardwareintegration/hardwareintegration.pri @@ -1,5 +1,6 @@ WAYLANDCLIENTSOURCES += \ - $$PWD/../../extensions/server-buffer-extension.xml + $$PWD/../../extensions/server-buffer-extension.xml \ + $$PWD/../../extensions/hardware-integration.xml SOURCES += \ $$PWD/qwaylandclientbufferintegration.cpp \ @@ -7,7 +8,8 @@ SOURCES += \ $$PWD/qwaylandclientbufferintegrationfactory.cpp \ $$PWD/qwaylandserverbufferintegration.cpp \ $$PWD/qwaylandserverbufferintegrationplugin.cpp \ - $$PWD/qwaylandserverbufferintegrationfactory.cpp + $$PWD/qwaylandserverbufferintegrationfactory.cpp \ + $$PWD/qwaylandhardwareintegration.cpp HEADERS += \ $$PWD/qwaylandclientbufferintegration.h \ @@ -15,5 +17,6 @@ HEADERS += \ $$PWD/qwaylandclientbufferintegrationfactory.h \ $$PWD/qwaylandserverbufferintegration.h \ $$PWD/qwaylandserverbufferintegrationplugin.h \ - $$PWD/qwaylandserverbufferintegrationfactory.h + $$PWD/qwaylandserverbufferintegrationfactory.h \ + $$PWD/qwaylandhardwareintegration.h diff --git a/src/client/hardwareintegration/qwaylandhardwareintegration.cpp b/src/client/hardwareintegration/qwaylandhardwareintegration.cpp new file mode 100644 index 000000000..67c951eac --- /dev/null +++ b/src/client/hardwareintegration/qwaylandhardwareintegration.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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: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 "qwaylandhardwareintegration.h" + +#include "qwaylanddisplay.h" +QT_BEGIN_NAMESPACE + +QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id) + : qt_hardware_integration(registry, id) +{ +} + +QString QWaylandHardwareIntegration::clientBufferIntegration() +{ + return m_client_buffer; +} + +QString QWaylandHardwareIntegration::serverBufferIntegration() +{ + return m_server_buffer; +} + +void QWaylandHardwareIntegration::hardware_integration_client_backend(const QString &name) +{ + m_client_buffer = name; +} + +void QWaylandHardwareIntegration::hardware_integration_server_backend(const QString &name) +{ + m_server_buffer = name; +} + +QT_END_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandhardwareintegration.h b/src/client/hardwareintegration/qwaylandhardwareintegration.h new file mode 100644 index 000000000..faa578567 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandhardwareintegration.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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: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 QWAYLANDHARDWAREINTEGRATION_H +#define QWAYLANDHARDWAREINTEGRATION_H + +#include <QtWaylandClient/private/qwayland-hardware-integration.h> +#include <QtWaylandClient/qwaylandclientexport.h> + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration +{ +public: + QWaylandHardwareIntegration(struct ::wl_registry *registry, int id); + + QString clientBufferIntegration(); + QString serverBufferIntegration(); + +protected: + void hardware_integration_client_backend(const QString &name); + void hardware_integration_server_backend(const QString &name); + +private: + QString m_client_buffer; + QString m_server_buffer; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index e6981ed52..3f771f1df 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -49,8 +49,8 @@ #include "qwaylandinputdevice.h" #include "qwaylandclipboard.h" #include "qwaylanddatadevicemanager.h" +#include "qwaylandhardwareintegration.h" -#include "qwaylandclientbufferintegration.h" #include "qwaylandwindowmanagerintegration.h" @@ -110,6 +110,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mTouchExtension(0) , mQtKeyExtension(0) , mTextInputManager(0) + , mHardwareIntegration(0) { display = this; qRegisterMetaType<uint32_t>("uint32_t"); @@ -232,6 +233,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mQtKeyExtension = new QWaylandQtKeyExtension(this, id); } else if (interface == QStringLiteral("wl_text_input_manager")) { mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); + } else if (interface == QStringLiteral("qt_hardware_integration")) { + mHardwareIntegration = new QWaylandHardwareIntegration(registry, id); } foreach (Listener l, mRegistryListeners) diff --git a/src/client/qwaylanddisplay.h b/src/client/qwaylanddisplay.h index 4e76de256..dd62aa16b 100644 --- a/src/client/qwaylanddisplay.h +++ b/src/client/qwaylanddisplay.h @@ -70,6 +70,7 @@ class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandEventThread; class QWaylandIntegration; +class QWaylandHardwareIntegration; namespace QtWayland { class qt_output_extension; @@ -127,6 +128,7 @@ public: QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension; } QWaylandTouchExtension *touchExtension() const { return mTouchExtension; } QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager; } + QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration; } /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ @@ -170,6 +172,7 @@ private: QWaylandQtKeyExtension *mQtKeyExtension; QWaylandWindowManagerIntegration *mWindowManagerIntegration; QtWayland::wl_text_input_manager *mTextInputManager; + QWaylandHardwareIntegration *mHardwareIntegration; QSocketNotifier *mReadNotifier; int mFd; diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 70a09b2ed..9acda2107 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -65,6 +65,7 @@ #include <qpa/qplatformaccessibility.h> #include <qpa/qplatforminputcontext.h> +#include "qwaylandhardwareintegration.h" #include "qwaylandclientbufferintegration.h" #include "qwaylandclientbufferintegrationfactory.h" @@ -260,34 +261,61 @@ void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; - QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); - if (clientBufferIntegrationName.isEmpty()) - clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); + if (clientBufferIntegrationName.isEmpty()) + clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what client buffer integration to use"); + return; + } QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); if (keys.contains(targetKey)) { mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); } if (mClientBufferIntegration) mClientBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load client buffer intgration: %s\n", qPrintable(targetKey)); } void QWaylandIntegration::initializeServerBufferIntegration() { mServerBufferIntegrationInitialized = true; - QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); - if (serverBufferIntegrationName.isEmpty()) - serverBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); + QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what server buffer integration to use"); + return; + } QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); if (keys.contains(targetKey)) { mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); } if (mServerBufferIntegration) mServerBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); } QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index fc53d3bc2..40a151c55 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -73,8 +73,9 @@ public: TouchExtension = 0x10, SubSurfaceExtension = 0x20, TextInputExtension = 0x40, + HardwareIntegrationExtension = 0x80, - DefaultExtensions = WindowManagerExtension | OutputExtension | SurfaceExtension | QtKeyExtension | TouchExtension + DefaultExtensions = WindowManagerExtension | OutputExtension | SurfaceExtension | QtKeyExtension | TouchExtension | HardwareIntegrationExtension }; Q_DECLARE_FLAGS(ExtensionFlags, ExtensionFlag) diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri index 402a3f6bd..999434d93 100644 --- a/src/compositor/hardware_integration/hardware_integration.pri +++ b/src/compositor/hardware_integration/hardware_integration.pri @@ -1,11 +1,10 @@ -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/server-buffer-extension.xml \ + ../extensions/hardware-integration.xml HEADERS += \ hardware_integration/qwaylandclientbufferintegration.h \ @@ -13,7 +12,8 @@ isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG) hardware_integration/qwaylandclientbufferintegrationplugin.h \ hardware_integration/qwaylandserverbufferintegration.h \ hardware_integration/qwaylandserverbufferintegrationfactory.h \ - hardware_integration/qwaylandserverbufferintegrationplugin.h + hardware_integration/qwaylandserverbufferintegrationplugin.h \ + hardware_integration/qwlhwintegration_p.h SOURCES += \ hardware_integration/qwaylandclientbufferintegration.cpp \ @@ -21,7 +21,8 @@ isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG) hardware_integration/qwaylandclientbufferintegrationplugin.cpp \ hardware_integration/qwaylandserverbufferintegration.cpp \ hardware_integration/qwaylandserverbufferintegrationfactory.cpp \ - hardware_integration/qwaylandserverbufferintegrationplugin.cpp + hardware_integration/qwaylandserverbufferintegrationplugin.cpp \ + hardware_integration/qwlhwintegration.cpp DEFINES += QT_COMPOSITOR_WAYLAND_GL } else { 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 diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp index 206155a4a..3c606d217 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor.cpp +++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp @@ -84,6 +84,7 @@ #include <wayland-server.h> +#include "hardware_integration/qwlhwintegration_p.h" #include "hardware_integration/qwaylandclientbufferintegration.h" #include "hardware_integration/qwaylandserverbufferintegration.h" #include "waylandwindowmanagerintegration.h" @@ -140,6 +141,7 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex , m_directRenderContext(0) , m_directRenderActive(false) #if defined (QT_COMPOSITOR_WAYLAND_GL) + , m_hw_integration(0) , m_client_buffer_integration(0) , m_server_buffer_integration(0) #endif @@ -156,14 +158,6 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex m_timer.start(); compositor = this; -#if defined (QT_COMPOSITOR_WAYLAND_GL) - QWindow *window = qt_compositor->window(); - if (window && window->surfaceType() != QWindow::RasterSurface) { - loadClientBufferIntegration(); - loadServerBufferIntegration(); - } -#endif - if (extensions & QWaylandCompositor::WindowManagerExtension) m_windowManagerIntegration = new WindowManagerServerIntegration(qt_compositor, this); @@ -178,6 +172,16 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::Ex m_shell = new Shell(); wl_display_add_global(m_display->handle(), &wl_shell_interface, m_shell, Shell::bind_func); +#if defined (QT_COMPOSITOR_WAYLAND_GL) + if (extensions & QWaylandCompositor::HardwareIntegrationExtension) + m_hw_integration.reset(new HardwareIntegration(this)); + QWindow *window = qt_compositor->window(); + if (window && window->surfaceType() != QWindow::RasterSurface) { + loadClientBufferIntegration(); + loadServerBufferIntegration(); + } +#endif + if (extensions & QWaylandCompositor::OutputExtension) m_outputExtension = new OutputExtensionGlobal(this); if (extensions & QWaylandCompositor::SurfaceExtension) @@ -224,10 +228,6 @@ Compositor::~Compositor() delete m_default_wayland_input_device; delete m_data_device_manager; -#ifdef QT_COMPOSITOR_WAYLAND_GL - delete m_client_buffer_integration; - delete m_server_buffer_integration; -#endif delete m_output_global; delete m_display; } @@ -321,7 +321,7 @@ QWindow *Compositor::window() const QWaylandClientBufferIntegration * Compositor::clientBufferIntegration() const { #ifdef QT_COMPOSITOR_WAYLAND_GL - return m_client_buffer_integration; + return m_client_buffer_integration.data(); #else return 0; #endif @@ -330,7 +330,7 @@ QWaylandClientBufferIntegration * Compositor::clientBufferIntegration() const QWaylandServerBufferIntegration * Compositor::serverBufferIntegration() const { #ifdef QT_COMPOSITOR_WAYLAND_GL - return m_server_buffer_integration; + return m_server_buffer_integration.data(); #else return 0; #endif @@ -569,9 +569,11 @@ void Compositor::loadClientBufferIntegration() } if (!targetKey.isEmpty()) { - m_client_buffer_integration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); + m_client_buffer_integration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList())); if (m_client_buffer_integration) { m_client_buffer_integration->setCompositor(m_qt_compositor); + if (m_hw_integration) + m_hw_integration->setClientBufferIntegration(targetKey); } } //BUG: if there is no client buffer integration, bad things will when opengl is used @@ -586,7 +588,9 @@ void Compositor::loadServerBufferIntegration() targetKey = QString::fromLocal8Bit(serverBufferIntegration.constData()); } if (!targetKey.isEmpty()) { - m_server_buffer_integration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); + m_server_buffer_integration.reset(QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList())); + if (m_hw_integration) + m_hw_integration->setServerBufferIntegration(targetKey); } } diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h index 0d7bf0246..e223b03fc 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor_p.h +++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h @@ -79,6 +79,7 @@ class TouchExtensionGlobal; class QtKeyExtensionGlobal; class TextInputManager; class InputPanel; +class HardwareIntegration; class Q_COMPOSITOR_EXPORT Compositor : public QObject { @@ -205,8 +206,9 @@ private: bool m_directRenderActive; #ifdef QT_COMPOSITOR_WAYLAND_GL - QWaylandClientBufferIntegration *m_client_buffer_integration; - QWaylandServerBufferIntegration *m_server_buffer_integration; + QScopedPointer<HardwareIntegration> m_hw_integration; + QScopedPointer<QWaylandClientBufferIntegration> m_client_buffer_integration; + QScopedPointer<QWaylandServerBufferIntegration> m_server_buffer_integration; #endif //extensions diff --git a/src/extensions/hardware-integration.xml b/src/extensions/hardware-integration.xml new file mode 100644 index 000000000..ad505c9d7 --- /dev/null +++ b/src/extensions/hardware-integration.xml @@ -0,0 +1,54 @@ +<protocol name="hardware_integration"> + + <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_hardware_integration" version="1"> + <description summary="compostors communicates supported buffer sharing extensions"> + Using this protocol the compositor can signal to clients which buffer sharing extensions + the client should use + </description> + <event name="client_backend"> + <arg name="name" type="string"/> + </event> + <event name="server_backend"> + <arg name="name" type="string"/> + </event> + </interface> +</protocol> + |