summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-04-19 12:53:19 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-05-06 15:09:42 +0200
commitfcfb1dc02a6baed23a85aa1186dc8aa9b2217f49 (patch)
tree9f0577e9155af27983b2632911c0c5d95e55ce6d
parent131b2096937b070fa9348705996d269db5a74eb1 (diff)
libcamera: raspberry: Report sensor timestamp
Report the sensor's timestamp in the Request metadata by using the Unicam::Image buffer timestamp as an initial approximation. The buffer's timestamp is recorded at DMA-transfer time, and it does not theoretically matches the 'start of exposure' definition, but when used to compare two consecutive frames it gives an acceptable estimation of the sensor frame period duration. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 91f44f68..b2256493 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1410,6 +1410,18 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
if (stream == &unicam_[Unicam::Image]) {
/*
+ * Record the sensor timestamp in the Request.
+ *
+ * \todo Do not assume the request in the front of the queue
+ * is the correct one
+ */
+ Request *request = requestQueue_.front();
+ ASSERT(request);
+
+ request->metadata().set(controls::SensorTimestamp,
+ buffer->metadata().timestamp);
+
+ /*
* Lookup the sensor controls used for this frame sequence from
* DelayedControl and queue them along with the frame buffer.
*/