Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qvivantetextureimporter_p.h
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
#
ifndef
QVIVANTETEXTUREIMPORTER_P_H
4
#
define
QVIVANTETEXTUREIMPORTER_P_H
5
6
//
7
// W A R N I N G
8
// -------------
9
//
10
// This file is not part of the Qt API. It exists purely as an
11
// implementation detail. This header file may change from version to
12
// version without notice, or even be removed.
13
//
14
// We mean it.
15
//
16
17
#
include
"qhwvideobuffer_p.h"
18
19
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
20
#
include
<
QtMultimedia
/
private
/
qdmabuftextureimporter_p
.
h
>
21
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
22
23
#
include
<
QtGui
/
qopenglfunctions
.
h
>
24
25
#
include
<
QtCore
/
qsize
.
h
>
26
#
include
<
QtCore
/
private
/
qexpected_p
.
h
>
27
28
#
include
<
EGL
/
egl
.
h
>
29
30
#
include
<
memory
>
31
32
static_assert
(QT_CONFIG(gpu_vivante));
33
34
#
ifndef
GL_VIV_YV12
35
#
define
GL_VIV_YV12
0x8FC0
36
#
endif
37
#
ifndef
GL_VIV_NV12
38
#
define
GL_VIV_NV12
0x8FC1
39
#
endif
40
#
ifndef
GL_VIV_YUY2
41
#
define
GL_VIV_YUY2
0x8FC2
42
#
endif
43
#
ifndef
GL_VIV_UYVY
44
#
define
GL_VIV_UYVY
0x8FC3
45
#
endif
46
#
ifndef
GL_VIV_NV21
47
#
define
GL_VIV_NV21
0x8FC4
48
#
endif
49
#
ifndef
GL_VIV_I420
50
#
define
GL_VIV_I420
0x8FC5
51
#
endif
52
53
static_assert
(
GL_VIV_YV12
== 0x8FC0);
54
static_assert
(
GL_VIV_NV12
== 0x8FC1);
55
static_assert
(
GL_VIV_YUY2
== 0x8FC2);
56
static_assert
(
GL_VIV_UYVY
== 0x8FC3);
57
static_assert
(
GL_VIV_NV21
== 0x8FC4);
58
static_assert
(
GL_VIV_I420
== 0x8FC5);
59
60
QT_BEGIN_NAMESPACE
61
62
class
QRhi;
63
class
QOpenGLContext;
64
65
namespace
QtMultimediaPrivate
{
66
67
class
Q_MULTIMEDIA_EXPORT
QVivanteGLFunctions
68
{
69
QVivanteGLFunctions
();
70
71
public
:
72
static
const
QVivanteGLFunctions
&
instance
();
73
74
bool
isValid
()
const
;
75
76
void
glTexDirectVIVMap
(GLenum target, GLsizei width, GLsizei height, GLenum format,
77
GLvoid **logical,
const
GLuint *physical)
const
;
78
void
glTexDirectInvalidateVIV
(GLenum target)
const
;
79
80
private
:
81
typedef
void
(
QOPENGLF_APIENTRYP
PFNGLTEXDIRECTVIVMAPPROC
)(
GLenum
Target
,
GLsizei
Width
,
82
GLsizei
Height
,
GLenum
Format
,
83
GLvoid
**
Logical
,
84
const
GLuint
*
Physical
);
85
typedef
void
(QOPENGLF_APIENTRYP PFNGLTEXDIRECTINVALIDATEVIVPROC)(GLenum Target);
86
87
PFNGLTEXDIRECTVIVMAPPROC m_glTexDirectVIVMap =
nullptr
;
88
PFNGLTEXDIRECTINVALIDATEVIVPROC m_glTexDirectInvalidateVIV =
nullptr
;
89
};
90
91
class
Q_MULTIMEDIA_EXPORT
VivanteContext
92
{
93
public
:
94
explicit
VivanteContext(QRhi *);
95
96
bool
isValid()
const
{
return
m_valid; }
97
98
QOpenGLContext *glContext()
const
{
return
m_glContext; }
99
100
private
:
101
QOpenGLContext *m_glContext =
nullptr
;
102
bool
m_valid =
false
;
103
};
104
105
// Owns exactly one GL texture id. Unlike DMA-BUF import (one EGLImage-backed
106
// texture per plane), glTexDirectVIVMap produces a single combined texture
107
// per frame: the format token tells the driver how to interpret/convert the
108
// (possibly planar) memory, and the result is expected to already be
109
// sampleable as plain RGB, with YUV->RGB conversion done by the driver, not
110
// a downstream shader. textureHandle() returns that one texture regardless
111
// of plane index; downstream code should treat this as single-plane RGB.
112
class
Q_MULTIMEDIA_EXPORT VivanteTextureHandles final :
public
QVideoFrameTexturesHandles
113
{
114
public
:
115
VivanteTextureHandles(QRhi &, QOpenGLContext *glContext, GLuint texture,
116
std::shared_ptr<
void
> parentKeepAlive = {});
117
118
~VivanteTextureHandles() override;
119
120
quint64 textureHandle(QRhi &,
int
/*plane*/
) override {
return
m_texture; }
121
122
private
:
123
void
release(QRhi &rhi);
124
125
const
std::shared_ptr<
void
> m_parentKeepAlive;
// keep the backend alive
126
QRhi& m_rhi;
127
QOpenGLContext *
const
m_glContext;
128
const
GLuint m_texture;
129
bool
m_released =
false
;
130
};
131
132
// physicalAddress is the actual 32-bit hardware address of the mapped
133
// memory (e.g. from gst_phys_memory_get_phys_addr()), not a host pointer --
134
// glTexDirectVIVMap's "Physical" parameter takes an array of such
135
// addresses. logicalAddr must be a valid CPU-virtual mapping of the same
136
// memory, kept mapped for as long as the texture exists (e.g. via
137
// parentKeepAlive).
138
Q_MULTIMEDIA_EXPORT q23::expected<QVideoFrameTexturesHandlesUPtr, FailureSeverity>
139
importVivanteTexture(QRhi &,
const
VivanteContext &context, quint32 physicalAddress,
140
void
*logicalAddr, QSize, GLenum vivFormatToken,
141
std::shared_ptr<
void
> parentKeepAlive = {});
142
143
}
// namespace QtMultimediaPrivate
144
145
QT_END_NAMESPACE
146
147
#
endif
// QVIVANTETEXTUREIMPORTER_P_H
QtMultimediaPrivate::QEglImageFunctions::isValid
bool isValid() const
Definition
qeglimagefunctions.cpp:107
QtMultimediaPrivate::QVivanteGLFunctions
Definition
qvivantetextureimporter_p.h:68
QtMultimediaPrivate::QVivanteGLFunctions::glTexDirectVIVMap
void glTexDirectVIVMap(GLenum target, GLsizei width, GLsizei height, GLenum format, GLvoid **logical, const GLuint *physical) const
Definition
qvivantetextureimporter.cpp:41
QtMultimediaPrivate::QVivanteGLFunctions::glTexDirectInvalidateVIV
void glTexDirectInvalidateVIV(GLenum target) const
Definition
qvivantetextureimporter.cpp:48
QtMultimediaPrivate::VivanteContext
Definition
qvivantetextureimporter_p.h:92
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QtMultimediaPrivate::importVivanteTexture
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importVivanteTexture(QRhi &rhi, const VivanteContext &context, quint32 physicalAddress, void *logicalAddr, QSize size, GLenum vivFormatToken, std::shared_ptr< void > parentKeepAlive)
Definition
qvivantetextureimporter.cpp:105
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
GL_VIV_I420
#define GL_VIV_I420
Definition
qvivantetextureimporter_p.h:50
GL_VIV_YUY2
#define GL_VIV_YUY2
Definition
qvivantetextureimporter_p.h:41
GL_VIV_NV12
#define GL_VIV_NV12
Definition
qvivantetextureimporter_p.h:38
GL_VIV_UYVY
#define GL_VIV_UYVY
Definition
qvivantetextureimporter_p.h:44
GL_VIV_YV12
#define GL_VIV_YV12
Definition
qvivantetextureimporter_p.h:35
GL_VIV_NV21
#define GL_VIV_NV21
Definition
qvivantetextureimporter_p.h:47
qtmultimedia
src
multimedia
video
qvivantetextureimporter_p.h
Generated on
for Qt by
1.18.0