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 QWaylandSurfaceTextureProvider;
33class QWaylandClientBufferIntegration;
34class QWaylandBufferRef;
35class QWaylandCompositor;
36class QOpenGLTexture;
37
38namespace QtWayland {
39
41{
42 struct wl_listener listener;
43 class ClientBuffer *surfaceBuffer = nullptr;
44};
45
46class Q_WAYLANDCOMPOSITOR_EXPORT ClientBuffer
47{
48public:
50
51 virtual ~ClientBuffer();
52
54 virtual QSize size() const = 0;
55 virtual QWaylandSurface::Origin origin() const = 0;
56
57 virtual quintptr lockNativeBuffer() { return 0; }
59
60 virtual QImage image() const { return QImage(); }
61
62 inline bool isCommitted() const { return m_committed; }
63 virtual void setCommitted(QRegion &damage);
64 bool isDestroyed() { return m_destroyed; }
65
66 virtual bool isProtected() { return false; }
67
68 inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
69
70 bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
71
72#if QT_CONFIG(opengl)
73 virtual QOpenGLTexture *toOpenGlTexture(int plane = 0) = 0;
74#endif
75
78
79protected:
80 void ref();
81 void deref();
82 void sendRelease();
83 virtual void setDestroyed();
84
85 struct ::wl_resource *m_buffer = nullptr;
87 bool m_textureDirty = false;
88
89private:
90 bool m_committed = false;
91 bool m_destroyed = false;
92
94
95 friend class ::QWaylandBufferRef;
96 friend class BufferManager;
98};
99
100class Q_WAYLANDCOMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer
101{
102public:
104
105 QSize size() const override;
107 QImage image() const override;
108
109#if QT_CONFIG(opengl)
111
112private:
114#endif
115};
116
117}
118
119QT_END_NAMESPACE
120
121#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()