1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef WAYLANDEGLINTEGRATION_H
16#define WAYLANDEGLINTEGRATION_H
17
18#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
19#include <QtCore/QScopedPointer>
20#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class WaylandEglClientBufferIntegrationPrivate;
25
26class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
27{
28 Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
29public:
30 WaylandEglClientBufferIntegration();
31 ~WaylandEglClientBufferIntegration() override;
32
33 void initializeHardware(struct ::wl_display *display) override;
34
35 QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
36
37private:
38 Q_DISABLE_COPY(WaylandEglClientBufferIntegration)
39 QScopedPointer<WaylandEglClientBufferIntegrationPrivate> d_ptr;
40};
41
42struct BufferState;
43
44class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBuffer : public QtWayland::ClientBuffer
45{
46public:
47 WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
48 ~WaylandEglClientBuffer() override;
49
50 QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
51 QSize size() const override;
52 QWaylandSurface::Origin origin() const override;
53 quintptr lockNativeBuffer() override;
54 void unlockNativeBuffer(quintptr native_buffer) const override;
55 QOpenGLTexture *toOpenGlTexture(int plane) override;
56 void setCommitted(QRegion &damage) override;
57 bool isProtected() override;
58
59private:
60 friend class WaylandEglClientBufferIntegration;
61 friend class WaylandEglClientBufferIntegrationPrivate;
62
63 BufferState *d = nullptr;
64 WaylandEglClientBufferIntegration *m_integration = nullptr;
65};
66
67QT_END_NAMESPACE
68
69#endif // WAYLANDEGLINTEGRATION_H
70

source code of qtwayland/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h