libcamera: controls: Use nanoseconds units for FrameWallClock

Use nanoseconds for the FrameWallClock control to match the units for
other timestamp controls, including SensorTimestamp.

Update the RPi pipeline handlers to match the new nanoseconds units when
converting from SensorTimestamp to FrameWallClock.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2025-07-08 09:49:15 +01:00 committed by Kieran Bingham
parent a437212753
commit 29a88d85b7
3 changed files with 4 additions and 3 deletions

View file

@ -1274,7 +1274,8 @@ controls:
description: |
This timestamp corresponds to the same moment in time as the
SensorTimestamp, but is represented as a wall clock time as measured by
the CLOCK_REALTIME clock.
the CLOCK_REALTIME clock. Like SensorTimestamp, the timestamp value is
expressed in nanoseconds.
Being a wall clock measurement, it can be used to synchronise timing
across different devices.

View file

@ -1760,7 +1760,7 @@ void PiSPCameraData::cfeBufferDequeue(FrameBuffer *buffer)
*/
wallClockRecovery_.addSample();
uint64_t sensorTimestamp = buffer->metadata().timestamp;
uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);
uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);
ctrl.set(controls::SensorTimestamp, sensorTimestamp);
ctrl.set(controls::FrameWallClock, wallClockTimestamp);

View file

@ -778,7 +778,7 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)
*/
wallClockRecovery_.addSample();
uint64_t sensorTimestamp = buffer->metadata().timestamp;
uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);
uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);
ctrl.set(controls::SensorTimestamp, sensorTimestamp);
ctrl.set(controls::FrameWallClock, wallClockTimestamp);