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
qdmabufvulkanimporter_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
QDMABUFVULKANIMPORTER_P_H
4
#
define
QDMABUFVULKANIMPORTER_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
/
qdmabufimportfailure_p
.
h
>
21
#
include
<
QtMultimedia
/
private
/
qmultimedia_drm_support_p
.
h
>
22
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
23
24
#
include
<
QtGui
/
rhi
/
qrhi
.
h
>
25
#
include
<
QtGui
/
qvulkaninstance
.
h
>
// defines VK_NO_PROTOTYPES before pulling in vulkan.h
26
27
#
include
<
QtCore
/
qspan
.
h
>
28
#
include
<
QtCore
/
private
/
qexpected_p
.
h
>
29
30
#
include
<
array
>
31
#
include
<
memory
>
32
#
include
<
optional
>
33
34
static_assert
(QT_CONFIG(linux_dmabuf_vulkan));
35
36
QT_BEGIN_NAMESPACE
37
38
class
QRhi;
39
40
namespace
QtMultimediaPrivate
{
41
42
class
Q_MULTIMEDIA_EXPORT
DmaBufVulkanContext
43
{
44
public
:
45
explicit
DmaBufVulkanContext
(
QRhi
*
rhi
);
46
47
bool
isValid
()
const
{
return
m_valid
; }
48
void
invalidate
() {
m_valid
=
false
; }
49
50
VkPhysicalDevice
physicalDevice
()
const
{
return
m_physicalDevice
; }
51
VkDevice
device
()
const
{
return
m_device
; }
52
QVulkanFunctions
*
functions
()
const
{
return
m_functions
; }
53
QVulkanDeviceFunctions
*
deviceFunctions
()
const
{
return
m_deviceFunctions
; }
54
55
std
::
optional
<
VkResult
>
56
vkGetMemoryFdPropertiesKHR
(
VkExternalMemoryHandleTypeFlagBits
handleType
,
int
fd
,
57
VkMemoryFdPropertiesKHR
*
properties
)
const
58
{
59
if
(!
m_vkGetMemoryFdPropertiesKHR
)
60
return
std
::
nullopt
;
61
return
m_vkGetMemoryFdPropertiesKHR
(
m_device
,
handleType
,
fd
,
properties
);
62
}
63
64
private
:
65
VkPhysicalDevice
m_physicalDevice
=
VK_NULL_HANDLE
;
66
VkDevice
m_device
=
VK_NULL_HANDLE
;
67
QVulkanFunctions
*
m_functions
=
nullptr
;
68
QVulkanDeviceFunctions
*
m_deviceFunctions
=
nullptr
;
69
PFN_vkGetMemoryFdPropertiesKHR
m_vkGetMemoryFdPropertiesKHR
=
nullptr
;
70
bool
m_valid
=
false
;
71
};
72
73
class
Q_MULTIMEDIA_EXPORT VulkanDmaBufTextureHandles
final
:
public
QVideoFrameTexturesHandles
74
{
75
public
:
76
struct
Plane
77
{
78
VkImage
image
=
VK_NULL_HANDLE
;
79
VkDeviceMemory
memory
=
VK_NULL_HANDLE
;
80
};
81
82
VulkanDmaBufTextureHandles
(
QVulkanDeviceFunctions
*
deviceFunctions
,
VkDevice
device
,
83
int
nPlanes
,
std
::
array
<
Plane
, 4>
planes
,
84
std
::
shared_ptr
<
void
>
parentKeepAlive
= {});
85
86
~
VulkanDmaBufTextureHandles
()
override
;
87
88
quint64
textureHandle
(
QRhi
&,
int
plane
)
override
{
return
quint64
(
m_planes
[
plane
].
image
); }
89
90
private
:
91
const
std
::
shared_ptr
<
void
>
m_parentKeepAlive
;
// keep the backend alive
92
QVulkanDeviceFunctions
*
const
m_deviceFunctions
;
93
const
VkDevice
m_device
;
94
const
int
m_nPlanes
;
95
const
std
::
array
<
Plane
, 4>
m_planes
;
96
};
97
98
// Same recoverable/unrecoverable failure semantics as importDmaBufTextures (the EGL importer).
99
Q_MULTIMEDIA_EXPORT
q23
::
expected
<
QVideoFrameTexturesHandlesUPtr
,
FailureSeverity
>
100
importDmaBufTexturesVulkan
(
QRhi
&
rhi
,
const
DmaBufVulkanContext
&
vulkanContext
,
101
QSpan
<
const
DmaBufPlane
>
planes
,
QVideoFrameFormat
::
PixelFormat
qtFormat
,
102
QSize
frameSize
,
std
::
shared_ptr
<
void
>
parentKeepAlive
= {});
103
104
}
// namespace QtMultimediaPrivate
105
106
QT_END_NAMESPACE
107
108
#
endif
// QDMABUFVULKANIMPORTER_P_H
QtMultimediaPrivate::DmaBufVulkanContext
Definition
qdmabufvulkanimporter_p.h:43
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QtMultimediaPrivate::importDmaBufTexturesVulkan
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importDmaBufTexturesVulkan(QRhi &rhi, const DmaBufVulkanContext &vulkanContext, QSpan< const DmaBufPlane > planes, QVideoFrameFormat::PixelFormat qtFormat, QSize frameSize, std::shared_ptr< void > parentKeepAlive)
Definition
qdmabufvulkanimporter.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)
qtmultimedia
src
multimedia
video
qdmabufvulkanimporter_p.h
Generated on
for Qt by
1.18.0