[PATCH 3/6] pipelien: rpi: vc4: Populate the wallclock timestamps queue

David Plowman david.plowman at raspberrypi.com
Fri Oct 4 13:55:55 CEST 2024


From: Naushir Patuck <naush at raspberrypi.com>

We add wallclock timestamps to the queue when we dequeue a camera
buffer from Unicam.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/libcamera/pipeline/rpi/vc4/vc4.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index e5b6ef2b..754cfdde 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -777,6 +777,18 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)
 		 * as it does not receive the FrameBuffer object.
 		 */
 		ctrl.set(controls::SensorTimestamp, buffer->metadata().timestamp);
+
+		/* Also record a wall-clock timestamp that can be passed to IPAs. */
+		while (!frameWallClock_.empty() &&
+		       frameWallClock_.front().first < buffer->metadata().sequence)
+			frameWallClock_.pop();
+
+		if (!frameWallClock_.empty() &&
+		    frameWallClock_.front().first == buffer->metadata().sequence) {
+			ctrl.set(controls::rpi::FrameWallClock, frameWallClock_.front().second.get<std::micro>());
+			frameWallClock_.pop();
+		}
+
 		bayerQueue_.push({ buffer, std::move(ctrl), delayContext });
 	} else {
 		embeddedQueue_.push(buffer);
-- 
2.39.5



More information about the libcamera-devel mailing list