1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
From 0dc02639e1d0d6178acac1008b7b33e56f653014 Mon Sep 17 00:00:00 2001
From: Stefan Klug <stefan.klug@ideasonboard.com>
Date: Wed, 25 Mar 2026 16:13:41 +0100
Subject: [PATCH] ipa: rkisp1: Refactor setControls()
IPARkISP1::setControls() is called when new sensor controls shall be
queued to the pipeline handler. It constructs a list of sensor controls
and then emits the setSensorControls signal.
To be able to return initial sensor controls from the IPARkISP1::start()
function, similar functionality will be needed. Prepare for that by
changing the setControls() function to a getSensorControls() that is
passed a frame context and by moving the setSensorControls.emit() out of
the function.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
---
src/ipa/libipa/fc_queue.cpp | 6 ++++++
src/ipa/libipa/fc_queue.h | 2 ++
src/ipa/rkisp1/rkisp1.cpp | 26 +++++++++++++-------------
3 files changed, 21 insertions(+), 13 deletions(-)
--- a/src/ipa/libipa/fc_queue.cpp
+++ b/src/ipa/libipa/fc_queue.cpp
@@ -39,6 +39,12 @@ namespace ipa {
*/
/**
+ * \fn FrameContext::frame()
+ * \brief Get the frame of that frame context
+ * \return THe frame number
+ */
+
+/**
* \class FCQueue
* \brief A support class for managing FrameContext instances in IPA modules
* \tparam FrameContext The IPA module-specific FrameContext derived class type
--- a/src/ipa/libipa/fc_queue.h
+++ b/src/ipa/libipa/fc_queue.h
@@ -22,6 +22,8 @@ template<typename FrameContext>
class FCQueue;
struct FrameContext {
+ uint32_t frame() const { return frame_; }
+
private:
template<typename T> friend class FCQueue;
uint32_t frame_;
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -77,7 +77,7 @@ private:
void updateControls(const IPACameraSensorInfo &sensorInfo,
const ControlInfoMap &sensorControls,
ControlInfoMap *ipaControls);
- void setControls(unsigned int frame);
+ ControlList getSensorControls(const IPAFrameContext &context);
std::map<unsigned int, FrameBuffer> buffers_;
std::map<unsigned int, MappedFrameBuffer> mappedBuffers_;
@@ -380,7 +380,12 @@ void IPARkISP1::processStats(const uint3
algo->process(context_, frame, frameContext, stats, metadata);
}
- setControls(frame);
+ /*
+ * \todo: Here we should do a lookahead that takes the sensor delays
+ * into account.
+ */
+ ControlList ctrls = getSensorControls(frameContext);
+ setSensorControls.emit(frame, ctrls);
context_.debugMetadata.moveEntries(metadata);
metadataReady.emit(frame, metadata);
@@ -446,28 +451,23 @@ void IPARkISP1::updateControls(const IPA
*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);
}
-void IPARkISP1::setControls(unsigned int frame)
+ControlList IPARkISP1::getSensorControls(const IPAFrameContext &frameContext)
{
- /*
- * \todo The frame number is most likely wrong here, we need to take
- * internal sensor delays and other timing parameters into account.
- */
-
- IPAFrameContext &frameContext = context_.frameContexts.get(frame);
uint32_t exposure = frameContext.agc.exposure;
uint32_t gain = context_.camHelper->gainCode(frameContext.agc.gain);
uint32_t vblank = frameContext.agc.vblank;
LOG(IPARkISP1, Debug)
- << "Set controls for frame " << frame << ": exposure " << exposure
- << ", gain " << frameContext.agc.gain << ", vblank " << vblank;
+ << "Set controls for frame " << frameContext.frame()
+ << ": exposure " << exposure
+ << ", gain " << frameContext.agc.gain
+ << ", vblank " << vblank;
ControlList ctrls(sensorControls_);
ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));
ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));
ctrls.set(V4L2_CID_VBLANK, static_cast<int32_t>(vblank));
-
- setSensorControls.emit(frame, ctrls);
+ return ctrls;
}
} /* namespace ipa::rkisp1 */
|