1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3#ifndef WAYLANDEGLSTREAMINTEGRATION_H
4#define WAYLANDEGLSTREAMINTEGRATION_H
5
6#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
7#include <QtCore/QScopedPointer>
8#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
9
10QT_BEGIN_NAMESPACE
11
12class WaylandEglStreamClientBufferIntegrationPrivate;
13
14class WaylandEglStreamClientBufferIntegration : public QtWayland::ClientBufferIntegration
15{
16 Q_DECLARE_PRIVATE(WaylandEglStreamClientBufferIntegration)
17public:
18 WaylandEglStreamClientBufferIntegration();
19 ~WaylandEglStreamClientBufferIntegration() override;
20
21 void initializeHardware(struct ::wl_display *display) override;
22
23 QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
24
25 void attachEglStreamConsumer(struct ::wl_resource *wl_surface, struct ::wl_resource *wl_buffer);
26
27private:
28 Q_DISABLE_COPY(WaylandEglStreamClientBufferIntegration)
29 QScopedPointer<WaylandEglStreamClientBufferIntegrationPrivate> d_ptr;
30};
31
32struct BufferState;
33
34class WaylandEglStreamClientBuffer : public QtWayland::ClientBuffer
35{
36public:
37 ~WaylandEglStreamClientBuffer() override;
38
39 QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
40 QSize size() const override;
41 QWaylandSurface::Origin origin() const override;
42 QOpenGLTexture *toOpenGlTexture(int plane) override;
43 void setCommitted(QRegion &damage) override;
44
45private:
46 friend class WaylandEglStreamClientBufferIntegration;
47 friend class WaylandEglStreamClientBufferIntegrationPrivate;
48
49 WaylandEglStreamClientBuffer(WaylandEglStreamClientBufferIntegration* integration, wl_resource *bufferResource);
50
51 BufferState *d = nullptr;
52 WaylandEglStreamClientBufferIntegration *m_integration = nullptr;
53};
54
55QT_END_NAMESPACE
56
57#endif // WAYLANDEGLSTREAMINTEGRATION_H
58

source code of qtwayland/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h