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.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#if QT_CONFIG(opengl)
8#include "hardware_integration/qwlclientbufferintegration_p.h"
9#include <qpa/qplatformopenglcontext.h>
10#include <QOpenGLTexture>
11#endif
12
13#include <QtCore/QDebug>
14
15#include <QtWaylandCompositor/private/wayland-wayland-server-protocol.h>
16#include "qwaylandsharedmemoryformathelper_p.h"
17
18#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
19
21
22namespace QtWayland {
23
28
29
35
42
44{
45 m_destroyed = true;
46 m_committed = false;
47 m_buffer = nullptr;
48
50 delete this;
51}
52
54{
56}
57
59{
60 if (!m_refCount.deref()) {
61 if (isCommitted() && m_buffer && !m_destroyed)
63 if (m_destroyed)
64 delete this;
65 }
66}
67
74
79
85
95
100
101static void shmBufferCleanup(void *data)
102{
103 auto *pool = static_cast<struct wl_shm_pool *>(data);
104 wl_shm_pool_unref(pool);
105}
106
125
126#if QT_CONFIG(opengl)
128{
130 if (isSharedMemory()) {
131 if (!m_shmTexture) {
134 }
135 if (m_textureDirty) {
136 m_textureDirty = false;
139 // TODO: partial texture upload
140 QImage image = this->image();
142 if (image.hasAlphaChannel()) {
147 } else {
152 }
153 //we can release the buffer after uploading, since we have a copy
154 if (isCommitted())
155 sendRelease();
156 }
157 return m_shmTexture.data();
158 }
159 return nullptr;
160}
161#endif
162
163}
164
165QT_END_NAMESPACE
Combined button and popup list for selecting options.
static void shmBufferCleanup(void *data)