<div dir="ltr">Hi,<div><br></div><div>Gentle ping to get some feedback on this patch series. It fixes a possible segfault that has been reported, and would be nice to get in soon.</div><div><br></div><div>Regards,</div><div>Naush</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 12 May 2021 at 09:47, Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@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">Write the controls::SensorTimestamp value in the Request metadata when<br>
the request is popped from the queue ready to run the pipeline. This<br>
ensures that the timestamp is written to the correct Request item,<br>
which may not be at the top of the queue when the Unicam buffer dequeue<br>
occurs.<br>
<br>
Fixes: fcfb1dc02a6b ("libcamera: raspberry: Report sensor timestamp")<br>
Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
---<br>
.../pipeline/raspberrypi/raspberrypi.cpp | 29 +++++++++++--------<br>
1 file changed, 17 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index 6fbdba0487bf..eb6d31670567 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -221,6 +221,8 @@ public:<br>
<br>
private:<br>
void checkRequestCompleted();<br>
+ void fillRequestMetadata(const ControlList &bufferControls,<br>
+ Request *request);<br>
void tryRunPipeline();<br>
bool findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&embeddedBuffer);<br>
<br>
@@ -1416,18 +1418,6 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)<br>
<< ", timestamp: " << buffer->metadata().timestamp;<br>
<br>
if (stream == &unicam_[Unicam::Image]) {<br>
- /*<br>
- * Record the sensor timestamp in the Request.<br>
- *<br>
- * \todo Do not assume the request in the front of the queue<br>
- * is the correct one<br>
- */<br>
- Request *request = requestQueue_.front();<br>
- ASSERT(request);<br>
-<br>
- request->metadata().set(controls::SensorTimestamp,<br>
- buffer->metadata().timestamp);<br>
-<br>
/*<br>
* Lookup the sensor controls used for this frame sequence from<br>
* DelayedControl and queue them along with the frame buffer.<br>
@@ -1689,6 +1679,13 @@ void RPiCameraData::applyScalerCrop(const ControlList &controls)<br>
}<br>
}<br>
<br>
+void RPiCameraData::fillRequestMetadata(const ControlList &bufferControls,<br>
+ Request *request)<br>
+{<br>
+ request->metadata().set(controls::SensorTimestamp,<br>
+ bufferControls.get(controls::SensorTimestamp));<br>
+}<br>
+<br>
void RPiCameraData::tryRunPipeline()<br>
{<br>
FrameBuffer *embeddedBuffer;<br>
@@ -1708,6 +1705,14 @@ void RPiCameraData::tryRunPipeline()<br>
/* See if a new ScalerCrop value needs to be applied. */<br>
applyScalerCrop(request->controls());<br>
<br>
+ /*<br>
+ * Clear the request metadata and fill it with some initial non-IPA<br>
+ * related controls. We clear it first because the request metadata<br>
+ * may have been populated if we have dropped the previous frame.<br>
+ */<br>
+ request->metadata().clear();<br>
+ fillRequestMetadata(bayerFrame.controls, request);<br>
+<br>
/*<br>
* Process all the user controls by the IPA. Once this is complete, we<br>
* queue the ISP output buffer listed in the request to start the HW<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>