Add hardware integration protocol
This sends to clients what HW integration is being used in the compositor. This is useful when the wayland clients are loading their buffer integrations with plugins since they then can pick the correct plugin automatically. Change-Id: Ib4eac3b855c6772ac1581b7f06aa929aeb1a1db0 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
parent
34720a996f
commit
d44fe6a530
54
src/3rdparty/wayland/extensions/hardware-integration.xml
vendored
Normal file
54
src/3rdparty/wayland/extensions/hardware-integration.xml
vendored
Normal file
@ -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>
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user