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
qvivantevideobuffer.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtMultimedia/private/qrhivaluemapper_p.h>
7#include <QtMultimedia/private/qvideotexturehelper_p.h>
8#include <QtMultimedia/private/qvivantetextureimporter_p.h>
9#include <QtGui/rhi/qrhi.h>
10#include <QtCore/qloggingcategory.h>
11
12static_assert(QT_CONFIG(gpu_vivante));
13
15
16Q_STATIC_LOGGING_CATEGORY(qLcVivanteVideoBuffer, "qt.multimedia.vivantevideobuffer");
17
18namespace QtMultimediaPrivate {
19
22{
23 return g_vivanteContexts.getOrCreate(rhi, [&] {
24 return VivanteContext(&rhi);
25 });
26}
27
41
46
48{
50
51 if (rhi.backend() != QRhi::OpenGLES2)
52 return {};
53
55
56 if (!context.isValid()) {
57 qCDebug(qLcVivanteVideoBuffer) << "VivanteContext is not valid, falling back to CPU path";
58 return {};
59 }
60
63 if (!handles) {
64 qCWarning(qLcVivanteVideoBuffer) << "Vivante direct-texture import failed";
65 return {};
66 }
67
69 m_size);
70}
71
73{
75
76 // The producer (VPU/driver) owns write access to the phys-mem buffer.
78 return mapData;
79
80 if (!m_cpuView.data) {
81 qCDebug(qLcVivanteVideoBuffer) << "No CPU-mapped view available for this buffer";
82 return mapData;
83 }
84
85 // The caller must have already CPU-mapped the phys-mem buffer (e.g. via gst_buffer_map())
86 // and passed the pointer in as VivanteCpuView; just hand that view back out.
91
93 return mapData;
94}
95
97{
98 // Nothing to release: the CPU-mapped view is owned by the caller (see
99 // VivanteCpuView / m_keepAlive), not by this object.
101}
102
103} // namespace QtMultimediaPrivate
104
105QT_END_NAMESPACE
static QRhiValueMapper< VivanteContext > g_vivanteContexts
VivanteContext & vivanteContextForRhi(QRhi &rhi)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)