Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwlclientbuffer_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWLCLIENTBUFFER_P_H
5#define QWLCLIENTBUFFER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/QRect>
19#include <QtGui/qopengl.h>
20#include <QImage>
21#include <QAtomicInt>
22#include <QScopedPointer>
23
24#include <QtWaylandCompositor/QWaylandSurface>
25#include <QtWaylandCompositor/QWaylandBufferRef>
26#include <QtCore/private/qglobal_p.h>
27
28#include <wayland-server-core.h>
29
30QT_BEGIN_NAMESPACE
31
32class QWaylandClientBufferIntegration;
33class QWaylandBufferRef;
34class QWaylandCompositor;
35class QOpenGLTexture;
36
37namespace QtWayland {
38
40{
41 struct wl_listener listener;
42 class ClientBuffer *surfaceBuffer = nullptr;
43};
44
45class Q_WAYLANDCOMPOSITOR_EXPORT ClientBuffer
46{
47public:
49
50 virtual ~ClientBuffer();
51
53 virtual QSize size() const = 0;
54 virtual QWaylandSurface::Origin origin() const = 0;
55
56 virtual quintptr lockNativeBuffer() { return 0; }
58
59 virtual QImage image() const { return QImage(); }
60
61 inline bool isCommitted() const { return m_committed; }
62 virtual void setCommitted(QRegion &damage);
63 bool isDestroyed() { return m_destroyed; }
64
65 virtual bool isProtected() { return false; }
66
67 inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
68
69 bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
70
71#if QT_CONFIG(opengl)
72 virtual QOpenGLTexture *toOpenGlTexture(int plane = 0) = 0;
73#endif
74
77
78protected:
79 void ref();
80 void deref();
81 void sendRelease();
82 virtual void setDestroyed();
83
84 struct ::wl_resource *m_buffer = nullptr;
86 bool m_textureDirty = false;
87
88private:
89 bool m_committed = false;
90 bool m_destroyed = false;
91
93
94 friend class ::QWaylandBufferRef;
95 friend class BufferManager;
96};
97
98class Q_WAYLANDCOMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer
99{
100public:
102
103 QSize size() const override;
105 QImage image() const override;
106
107#if QT_CONFIG(opengl)
109
110private:
112#endif
113};
114
115}
116
117QT_END_NAMESPACE
118
119#endif // QWLCLIENTBUFFER_P_H
\inmodule QtWaylandCompositor
QWaylandSurfaceRole(const QByteArray &n)
Creates a QWaylandSurfaceRole and assigns it name.
const QByteArray name()
Returns the name of the QWaylandSurfaceRole.
\qmltype WaylandSurface \nativetype QWaylandSurface \inqmlmodule QtWayland.Compositor
FrameCallback(QWaylandSurface *surf, wl_resource *res)
static void destroyCallback(wl_resource *res)
static QRegion infiniteRegion()