diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2019-01-30 10:33:55 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2019-03-28 14:40:19 +0000 |
commit | 80001cbf0451f4ba2a971fb20b80dc8e25ac604d (patch) | |
tree | 69c965b678b8bb8533e7bb7355b24f5fbef424eb /src/imports/texture-sharing/texturesharingextension.h | |
parent | fde6362edc6ecadbcca8872f71c111bd7c896801 (diff) | |
download | qtwayland-80001cbf0451f4ba2a971fb20b80dc8e25ac604d.tar.gz |
New texture sharing protocol and infrastructure
This adds a higher level protocol on top of the server buffer extension,
providing an easy way for Qt Quick applications to use the shared
textures.
[ChangeLog] Added protocol and Qt Quick image provider for sharing
textures in graphics memory between compositor and multiple clients.
Task-number: QTBUG-73822
Change-Id: Idc41b3479d6ca37be35d9ccd7b89e9994ff17f8f
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/imports/texture-sharing/texturesharingextension.h')
-rw-r--r-- | src/imports/texture-sharing/texturesharingextension.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/imports/texture-sharing/texturesharingextension.h b/src/imports/texture-sharing/texturesharingextension.h new file mode 100644 index 00000000..7b864fbc --- /dev/null +++ b/src/imports/texture-sharing/texturesharingextension.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TEXTURESHARINGEXTENSION_H +#define TEXTURESHARINGEXTENSION_H + +#include <qpa/qwindowsysteminterface.h> +#include <QtWaylandClient/private/qwayland-wayland.h> +#include <QtWaylandClient/qwaylandclientextension.h> +#include "qwayland-qt-texture-sharing-unstable-v1.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + class QWaylandServerBuffer; + class QWaylandServerBufferIntegration; +}; + +class TextureSharingExtension : public QWaylandClientExtensionTemplate<TextureSharingExtension> + , public QtWayland::zqt_texture_sharing_v1 +{ + Q_OBJECT +public: + TextureSharingExtension(); + +public slots: + void requestImage(const QString &key); + void abandonImage(const QString &key); + +signals: + void bufferReceived(QtWaylandClient::QWaylandServerBuffer *buffer, const QString &key); + +private: + void zqt_texture_sharing_v1_provide_buffer(struct ::qt_server_buffer *buffer, const QString &key) override; + void zqt_texture_sharing_v1_image_failed(const QString &key, const QString &message) override; + QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration = nullptr; +}; + +QT_END_NAMESPACE + +#endif // TEXTURESHARINGEXTENSION_H |