@@ -36,6 +36,7 @@ struct ISPConfig {
uint32 bayerBufferId;
bool embeddedBufferPresent;
libcamera.ControlList controls;
+ uint32 ipaCookie;
};
struct IPAConfig {
@@ -136,5 +137,5 @@ interface IPARPiEventInterface {
runIsp(uint32 bufferId);
embeddedComplete(uint32 bufferId);
setIspControls(libcamera.ControlList controls);
- setDelayedControls(libcamera.ControlList controls);
+ setDelayedControls(libcamera.ControlList controls, uint32 ipaCookie);
};
@@ -1144,7 +1144,7 @@ void IPARPi::processStats(unsigned int bufferId)
ControlList ctrls(sensorCtrls_);
applyAGC(&agcStatus, ctrls);
- setDelayedControls.emit(ctrls);
+ setDelayedControls.emit(ctrls, metadataIdx_);
}
}
@@ -208,7 +208,7 @@ public:
void runIsp(uint32_t bufferId);
void embeddedComplete(uint32_t bufferId);
void setIspControls(const ControlList &controls);
- void setDelayedControls(const ControlList &controls);
+ void setDelayedControls(const ControlList &controls, uint32_t ipaCookie);
void setSensorControls(ControlList &controls);
void unicamTimeout();
@@ -259,6 +259,7 @@ public:
struct BayerFrame {
FrameBuffer *buffer;
ControlList controls;
+ unsigned int ipaCookie;
};
std::queue<BayerFrame> bayerQueue_;
@@ -1784,9 +1785,9 @@ void RPiCameraData::setIspControls(const ControlList &controls)
handleState();
}
-void RPiCameraData::setDelayedControls(const ControlList &controls)
+void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t ipaCookie)
{
- if (!delayedCtrls_->push(controls))
+ if (!delayedCtrls_->push(controls, ipaCookie))
LOG(RPI, Error) << "V4L2 DelayedControl set failed";
handleState();
}
@@ -1848,13 +1849,13 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
* Lookup the sensor controls used for this frame sequence from
* DelayedControl and queue them along with the frame buffer.
*/
- auto [ctrl, cookie] = delayedCtrls_->get(buffer->metadata().sequence);
+ auto [ctrl, ipaCookie] = delayedCtrls_->get(buffer->metadata().sequence);
/*
* Add the frame timestamp to the ControlList for the IPA to use
* as it does not receive the FrameBuffer object.
*/
ctrl.set(controls::SensorTimestamp, buffer->metadata().timestamp);
- bayerQueue_.push({ buffer, std::move(ctrl) });
+ bayerQueue_.push({ buffer, std::move(ctrl), ipaCookie });
} else {
embeddedQueue_.push(buffer);
}
@@ -2148,6 +2149,7 @@ void RPiCameraData::tryRunPipeline()
ipa::RPi::ISPConfig ispPrepare;
ispPrepare.bayerBufferId = ipa::RPi::MaskBayerData | bayerId;
ispPrepare.controls = std::move(bayerFrame.controls);
+ ispPrepare.ipaCookie = bayerFrame.ipaCookie;
if (embeddedBuffer) {
unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);
Pass an IPA cookie from the IPA to the pipeline handler through the setDelayedControls signal. This cookie is the index of the current RPiController::Metadata context used for the frame. The cookie is subsequently passed into DelayedControls together with the controls to action. The IPA cookie is then returned from DelayedControls when the frame with the applied controls has been returned from the sensor, and eventually passed back to the IPA from the signalIspPrepare signal. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- include/libcamera/ipa/raspberrypi.mojom | 3 ++- src/ipa/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-)