<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for the patch.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 2 Dec 2020 at 11:53, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The number of frames to drop (not display) is passed back now from the<br>
start method, not configure. This means applications have a chance to<br>
set fixed exposure/gain before starting the camera and this can affect<br>
the frame drop count that is returned.<br>
<br>
Both the IPA implementation file and the pipeline handler need<br>
matching modifications.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/ipa/raspberrypi/raspberrypi.cpp | 38 +++++++++----------<br>
.../pipeline/raspberrypi/raspberrypi.cpp | 25 ++++++------<br>
2 files changed, 32 insertions(+), 31 deletions(-)<br>
<br>
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp<br>
index b8298768..0300b8d9 100644<br>
--- a/src/ipa/raspberrypi/raspberrypi.cpp<br>
+++ b/src/ipa/raspberrypi/raspberrypi.cpp<br>
@@ -182,6 +182,25 @@ int IPARPi::start(const IPAOperationData &ipaConfig, IPAOperationData *result)<br>
result->operation |= RPi::IPA_CONFIG_SENSOR;<br>
}<br>
<br>
+ /*<br>
+ * Initialise frame counts, and decide how many frames must be hidden or<br>
+ *"mistrusted", which depends on whether this is a startup from cold,<br>
+ * or merely a mode switch in a running system.<br>
+ */<br>
+ frameCount_ = 0;<br>
+ checkCount_ = 0;<br>
+ unsigned int dropFrame = 0;<br>
+ if (firstStart_) {<br>
+ dropFrame = helper_->HideFramesStartup();<br>
+ mistrustCount_ = helper_->MistrustFramesStartup();<br>
+ } else {<br>
+ dropFrame = helper_->HideFramesModeSwitch();<br>
+ mistrustCount_ = helper_->MistrustFramesModeSwitch();<br>
+ }<br>
+<br>
+ result->data.push_back(dropFrame);<br>
+ result->operation |= RPi::IPA_CONFIG_DROP_FRAMES;<br>
+<br>
firstStart_ = false;<br>
<br>
return 0;<br>
@@ -298,25 +317,6 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,<br>
/* Pass the camera mode to the CamHelper to setup algorithms. */<br>
helper_->SetCameraMode(mode_);<br>
<br>
- /*<br>
- * Initialise frame counts, and decide how many frames must be hidden or<br>
- *"mistrusted", which depends on whether this is a startup from cold,<br>
- * or merely a mode switch in a running system.<br>
- */<br>
- frameCount_ = 0;<br>
- checkCount_ = 0;<br>
- unsigned int dropFrame = 0;<br>
- if (controllerInit_) {<br>
- dropFrame = helper_->HideFramesModeSwitch();<br>
- mistrustCount_ = helper_->MistrustFramesModeSwitch();<br>
- } else {<br>
- dropFrame = helper_->HideFramesStartup();<br>
- mistrustCount_ = helper_->MistrustFramesStartup();<br>
- }<br>
-<br>
- result->data.push_back(dropFrame);<br>
- result->operation |= RPi::IPA_CONFIG_DROP_FRAMES;<br>
-<br>
if (!controllerInit_) {<br>
/* Load the tuning file for this sensor. */<br>
controller_.Read(tuningFile_.c_str());<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index 89a44763..5ae56628 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -745,13 +745,6 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont<br>
return ret;<br>
}<br>
<br>
- ret = queueAllBuffers(camera);<br>
- if (ret) {<br>
- LOG(RPI, Error) << "Failed to queue buffers";<br>
- stop(camera);<br>
- return ret;<br>
- }<br>
-<br>
/* Check if a ScalerCrop control was specified. */<br>
if (controls)<br>
data->applyScalerCrop(*controls);<br>
@@ -778,6 +771,19 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont<br>
LOG(RPI, Error) << "V4L2 staggered set failed";<br>
}<br>
<br>
+ if (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {<br>
+ /* Configure the number of dropped frames required on startup. */<br>
+ data->dropFrameCount_ = result.data[0];<br>
+ }<br>
+<br>
+ /* We need to set the dropFrameCount_ before queueing buffers. */<br>
+ ret = queueAllBuffers(camera);<br>
+ if (ret) {<br>
+ LOG(RPI, Error) << "Failed to queue buffers";<br>
+ stop(camera);<br>
+ return ret;<br>
+ }<br>
+<br>
/*<br>
* IPA configure may have changed the sensor flips - hence the bayer<br>
* order. Get the sensor format and set the ISP input now.<br>
@@ -1231,11 +1237,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)<br>
LOG(RPI, Error) << "V4L2 staggered set failed";<br>
}<br>
<br>
- if (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {<br>
- /* Configure the number of dropped frames required on startup. */<br>
- dropFrameCount_ = result.data[resultIdx++];<br>
- }<br>
-<br>
/*<br>
* Configure the H/V flip controls based on the combination of<br>
* the sensor and user transform.<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>