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
qlibcamera_dmabufregistry_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
QLIBCAMERA_DMABUFREGISTRY_P_H
4
#
define
QLIBCAMERA_DMABUFREGISTRY_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
"qlibcamera_stream_p.h"
18
19
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
20
#
include
<
QtMultimedia
/
private
/
qcaptureslotregistry_p
.
h
>
21
#
include
<
QtMultimedia
/
private
/
qdmabufallocator_p
.
h
>
22
#
include
<
QtMultimedia
/
private
/
qdmabufsource_p
.
h
>
23
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
24
25
#
include
<
QtCore
/
qspan
.
h
>
26
27
#
include
<
memory
>
28
#
include
<
optional
>
29
#
include
<
vector
>
30
31
namespace
libcamera
{
32
class
Camera;
33
class
Request;
34
class
Stream;
35
}
// namespace libcamera
36
37
QT_BEGIN_NAMESPACE
38
39
namespace
QLibCamera
{
40
41
#
if
QT_CONFIG
(
linux_dmabuf
)
42
43
// Owns the DMA-BUFs behind the request buffers of a stream. A frame that wraps a buffer holds
44
// the buffer's request as a capture slot, which keeps the request out of the camera queue until
45
// the frame releases it.
46
class
QLibCameraDmaBufRegistry
final
47
:
public
QtMultimediaPrivate
::
CaptureSlotRegistry
<
QLibCameraDmaBufRegistry
,
48
libcamera
::
Request
*,
kCaptureBufferCount
>
49
{
50
public
:
51
using
DmaBufLayout
=
QtMultimediaPrivate
::
DmaBufLayout
;
52
using
QDmaBuf
=
QtMultimediaPrivate
::
QDmaBuf
;
53
54
// Returns nullptr when the buffers cannot be shared as DMA-BUFs; frames are then copied.
55
static
std
::
shared_ptr
<
QLibCameraDmaBufRegistry
>
56
create
(
std
::
shared_ptr
<
libcamera
::
Camera
>,
std
::
shared_ptr
<
QLibCameraPendingControls
>,
57
QSpan
<
const
std
::
unique_ptr
<
libcamera
::
Request
>>,
libcamera
::
Stream
*,
58
const
QVideoFrameFormat
&,
int
bytesPerLine
);
59
60
std
::
shared_ptr
<
QDmaBuf
>
dmaBufFor
(
const
libcamera
::
Request
*
request
)
const
;
61
62
// Plane placement shared by all buffers; nullopt for formats without a zero-copy layout.
63
const
std
::
optional
<
DmaBufLayout
> &
layout
()
const
{
return
m_layout
; }
64
65
void
recycleSlot
(
libcamera
::
Request
*
request
)
const
;
66
67
private
:
68
struct
Buffer
69
{
70
libcamera
::
Request
*
request
;
71
std
::
shared_ptr
<
QDmaBuf
>
dmaBuf
;
72
};
73
74
QLibCameraDmaBufRegistry
(
std
::
shared_ptr
<
libcamera
::
Camera
>
camera
,
75
std
::
shared_ptr
<
QLibCameraPendingControls
>
pendingControls
,
76
std
::
vector
<
Buffer
>
buffers
,
std
::
optional
<
DmaBufLayout
>
layout
);
77
78
const
std
::
shared_ptr
<
libcamera
::
Camera
>
m_camera
;
79
const
std
::
shared_ptr
<
QLibCameraPendingControls
>
m_pendingControls
;
80
const
std
::
vector
<
Buffer
>
m_buffers
;
// CHECK: Should this be a (flat)map for faster lookup?
81
const
std
::
optional
<
DmaBufLayout
>
m_layout
;
82
};
83
84
#
endif
// QT_CONFIG(linux_dmabuf)
85
86
}
// namespace QLibCamera
87
88
QT_END_NAMESPACE
89
90
#
endif
// QLIBCAMERA_DMABUFREGISTRY_P_H
QLibCamera
Definition
qplatformlibcameraintegration.cpp:13
libcamera
Definition
qlibcamera_camera_p.h:29
qtmultimedia
src
plugins
libcamera
qlibcamera_dmabufregistry_p.h
Generated on
for Qt by
1.18.0