<div dir="ltr"><div dir="ltr">Hi Jacopo,<div><br></div><div>Thank you for your work.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 19 Apr 2021 at 14:14, Jacopo Mondi <<a href="mailto:jacopo@jmondi.org">jacopo@jmondi.org</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">Report the sensor's timestamp in the Request metadata by using the<br>
Unicam::Image buffer timestamp as an initial approximation.<br>
<br>
The buffer's timestamp is recorded at DMA-transfer time, and it does not<br>
theoretically matches the 'start of exposure' definition, but when used<br>
to compare two consecutive frames it gives an acceptable estimation of<br>
the sensor frame period duration.<br>
<br>
Signed-off-by: Jacopo Mondi <<a href="mailto:jacopo@jmondi.org" target="_blank">jacopo@jmondi.org</a>><br>
---<br>
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++++++<br>
 1 file changed, 12 insertions(+)<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index d1902bfc3393..7dc92acf3c4f 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -1415,6 +1415,18 @@ 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 The sensor timestamp should be better estimated by<br>
+                * sampling the V4L2Device::frameStart signal.<br>
+                */<br></blockquote><div><br></div><div>Just a minor correction to this comment - the VB2 buffer timestamp that</div><div>is provided by the device driver is actually sampled at the CSI2 frame start</div><div>event, so is pretty much as close to the start of exposure as we can get</div><div>without dead reckoning.  This sample is also before the DMA to memory</div><div>and V4L2Device::frameStart signal.</div><div><br></div><div>Other than that,</div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>><br></div><div><br></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">
+               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>
-- <br>
2.31.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>