Message ID | 20220905073956.7342-7-naush@raspberrypi.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Naush Thanks for the patch. On Mon, 5 Sept 2022 at 08:40, Naushir Patuck via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote: > > 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> Not a lot to add to this one either... LGTM. Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Thanks! David > --- > 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(-) > > diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom > index c0de435b7b33..fb806a1518d5 100644 > --- a/include/libcamera/ipa/raspberrypi.mojom > +++ b/include/libcamera/ipa/raspberrypi.mojom > @@ -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); > }; > diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp > index 63cccda901c1..0e80ef9c7b95 100644 > --- a/src/ipa/raspberrypi/raspberrypi.cpp > +++ b/src/ipa/raspberrypi/raspberrypi.cpp > @@ -1144,7 +1144,7 @@ void IPARPi::processStats(unsigned int bufferId) > ControlList ctrls(sensorCtrls_); > applyAGC(&agcStatus, ctrls); > > - setDelayedControls.emit(ctrls); > + setDelayedControls.emit(ctrls, metadataIdx_); > } > } > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > index d34a906c3cea..4d4c9e1fb9c4 100644 > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > @@ -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); > -- > 2.25.1 >
diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index c0de435b7b33..fb806a1518d5 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -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); }; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 63cccda901c1..0e80ef9c7b95 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -1144,7 +1144,7 @@ void IPARPi::processStats(unsigned int bufferId) ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); - setDelayedControls.emit(ctrls); + setDelayedControls.emit(ctrls, metadataIdx_); } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index d34a906c3cea..4d4c9e1fb9c4 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -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(-)