pipeline: ipa: raspberrypi: Use IPA cookies

Pass an IPA cookie from the pipeline handler to the IPA and eventually back to
the pipeline handler through the setDelayedControls signal. This cookie is used
to index the RPiController::Metadata object to be used for the frame.

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>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck
2022-11-15 09:07:54 +00:00
committed by Laurent Pinchart
parent 44cffefd60
commit 546154b134
3 changed files with 37 additions and 27 deletions
@@ -206,7 +206,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 delayContext);
void setSensorControls(ControlList &controls);
void unicamTimeout();
@@ -262,6 +262,7 @@ public:
struct BayerFrame {
FrameBuffer *buffer;
ControlList controls;
unsigned int delayContext;
};
std::queue<BayerFrame> bayerQueue_;
@@ -1800,9 +1801,9 @@ void RPiCameraData::setIspControls(const ControlList &controls)
handleState();
}
void RPiCameraData::setDelayedControls(const ControlList &controls)
void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t delayContext)
{
if (!delayedCtrls_->push(controls, 0))
if (!delayedCtrls_->push(controls, delayContext))
LOG(RPI, Error) << "V4L2 DelayedControl set failed";
handleState();
}
@@ -1875,13 +1876,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, delayContext] = 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), delayContext });
} else {
embeddedQueue_.push(buffer);
}
@@ -1931,7 +1932,8 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
* application until after the IPA signals so.
*/
if (stream == &isp_[Isp::Stats]) {
ipa_->signalStatReady(RPi::MaskStats | static_cast<unsigned int>(index));
ipa_->signalStatReady(RPi::MaskStats | static_cast<unsigned int>(index),
requestQueue_.front()->sequence());
} else {
/* Any other ISP output can be handed back to the application now. */
handleStreamBuffer(buffer, stream);
@@ -2176,6 +2178,8 @@ void RPiCameraData::tryRunPipeline()
ipa::RPi::ISPConfig ispPrepare;
ispPrepare.bayerBufferId = RPi::MaskBayerData | bayerId;
ispPrepare.controls = std::move(bayerFrame.controls);
ispPrepare.ipaContext = request->sequence();
ispPrepare.delayContext = bayerFrame.delayContext;
if (embeddedBuffer) {
unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);