1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2019 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 or (at your option) any later version |
20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
22 | ** included in the packaging of this file. Please review the following |
23 | ** information to ensure the GNU General Public License requirements will |
24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
25 | ** |
26 | ** $QT_END_LICENSE$ |
27 | ** |
28 | ****************************************************************************/ |
29 | #ifndef WAYLANDEGLSTREAMINTEGRATION_H |
30 | #define WAYLANDEGLSTREAMINTEGRATION_H |
31 | |
32 | #include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h> |
33 | #include <QtCore/QScopedPointer> |
34 | #include <QtWaylandCompositor/private/qwlclientbuffer_p.h> |
35 | |
36 | QT_BEGIN_NAMESPACE |
37 | |
38 | class WaylandEglStreamClientBufferIntegrationPrivate; |
39 | |
40 | class WaylandEglStreamClientBufferIntegration : public QtWayland::ClientBufferIntegration |
41 | { |
42 | Q_DECLARE_PRIVATE(WaylandEglStreamClientBufferIntegration) |
43 | public: |
44 | WaylandEglStreamClientBufferIntegration(); |
45 | ~WaylandEglStreamClientBufferIntegration() override; |
46 | |
47 | void initializeHardware(struct ::wl_display *display) override; |
48 | |
49 | QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override; |
50 | |
51 | void attachEglStreamConsumer(struct ::wl_resource *wl_surface, struct ::wl_resource *wl_buffer); |
52 | |
53 | private: |
54 | Q_DISABLE_COPY(WaylandEglStreamClientBufferIntegration) |
55 | QScopedPointer<WaylandEglStreamClientBufferIntegrationPrivate> d_ptr; |
56 | }; |
57 | |
58 | struct BufferState; |
59 | |
60 | class WaylandEglStreamClientBuffer : public QtWayland::ClientBuffer |
61 | { |
62 | public: |
63 | ~WaylandEglStreamClientBuffer() override; |
64 | |
65 | QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override; |
66 | QSize size() const override; |
67 | QWaylandSurface::Origin origin() const override; |
68 | QOpenGLTexture *toOpenGlTexture(int plane) override; |
69 | void setCommitted(QRegion &damage) override; |
70 | |
71 | private: |
72 | friend class WaylandEglStreamClientBufferIntegration; |
73 | friend class WaylandEglStreamClientBufferIntegrationPrivate; |
74 | |
75 | WaylandEglStreamClientBuffer(WaylandEglStreamClientBufferIntegration* integration, wl_resource *bufferResource); |
76 | |
77 | BufferState *d = nullptr; |
78 | WaylandEglStreamClientBufferIntegration *m_integration = nullptr; |
79 | }; |
80 | |
81 | QT_END_NAMESPACE |
82 | |
83 | #endif // WAYLANDEGLSTREAMINTEGRATION_H |
84 |