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// Qt-Security score:significant reason:default
4
5#ifndef QWLCLIENTBUFFER_P_H
6#define QWLCLIENTBUFFER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QRect>
20#include <QtGui/qopengl.h>
21#include <QImage>
22#include <QAtomicInt>
23#include <QScopedPointer>
24
25#include <QtWaylandCompositor/QWaylandSurface>
26#include <QtWaylandCompositor/QWaylandBufferRef>
27#include <QtCore/private/qglobal_p.h>
28
29#include <wayland-server-core.h>
30
31QT_BEGIN_NAMESPACE
32
33class QWaylandSurfaceTextureProvider;
34class QWaylandClientBufferIntegration;
35class QWaylandBufferRef;
36class QWaylandCompositor;
37class QOpenGLTexture;
38
39namespace QtWayland {
40
42{
43 struct wl_listener listener;
44 class ClientBuffer *surfaceBuffer = nullptr;
45};
46
47class Q_WAYLANDCOMPOSITOR_EXPORT ClientBuffer
48{
49public:
51
52 virtual ~ClientBuffer();
53
55 virtual QSize size() const = 0;
56 virtual QWaylandSurface::Origin origin() const = 0;
57
58 virtual quintptr lockNativeBuffer() { return 0; }
60
61 virtual QImage image() const { return QImage(); }
62
63 inline bool isCommitted() const { return m_committed; }
64 virtual void setCommitted(QRegion &damage);
65 bool isDestroyed() { return m_destroyed; }
66
67 virtual bool isProtected() { return false; }
68
69 inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
70
71 bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
72
73#if QT_CONFIG(opengl)
74 virtual QOpenGLTexture *toOpenGlTexture(int plane = 0) = 0;
75#endif
76
79
80protected:
81 void ref();
82 void deref();
83 void sendRelease();
84 virtual void setDestroyed();
85
86 struct ::wl_resource *m_buffer = nullptr;
88 bool m_textureDirty = false;
89
90private:
91 bool m_committed = false;
92 bool m_destroyed = false;
93
95
96 friend class ::QWaylandBufferRef;
97 friend class BufferManager;
99};
100
101class Q_WAYLANDCOMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer
102{
103public:
105
106 QSize size() const override;
108 QImage image() const override;
109
110#if QT_CONFIG(opengl)
112
113private:
115#endif
116};
117
118}
119
120QT_END_NAMESPACE
121
122#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)
Combined button and popup list for selecting options.
static QRegion infiniteRegion()