Argus::ICaptureMetadata::getSensorTimestamp clock domain in L4T 32.4.4

Hello,
When looking at Argus API, the function to get the camera capture timestamp is:

Argus::ICaptureMetadata::getSensorTimestamp

The help says:
Returns the start timestamp for the sensor (in nanoseconds).
This is the time that the first data from this capture arrives from the sensor.

But we don’t know the clock domain.
Is this CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW or another?
We use L4T 32.4.4.

thank you

Have reference to below topic.

Hello,
I have read this topic and you say that Argus::ICaptureMetadata::getSensorTimestamp give the kernel timestamp.
What is the clock domain for kernel timestamp: is it Wall Clock or MONOTONIC_CLOCK or another? the topic given doesn’t say it.
I need to compare this timestamp to another timestamp based on MONOTONIC_CLOCK. How can i do it?
thank you

Looks like it’s MONOTONIC_RAW

Hello,
excuse me but “looks like it’s MONOTONIC_RAW” seems a little imprecise.
I need to be certain that it is “MONOTONIC_RAW” or not. And if not then which clock it is.
thanks

hello Denisss,

since you’re now working with l4r-r32.4.4. please note that there’ll be timestamp modification for next public release.
please refer to the statement in Topic 78821, recap as below…

we had some changes for Xavier to plumbed up the hardware timestamps into camera software stack.
there’ll be start-of-frame and end-of-frame sensor timestamps include in metadata from TSC hardware, by using new interfaces for TSC HW timestamp; you may expect those changes will be include to next public release, i.e. JetPack-4.5 / l4t-r32.5.


iCaptureMetadata->getSensorTimestamp() return the kernel timestamp (i.e. MONOTONIC_RAW) of sensor start-of-frame.
as you can see, there’s formula to calculate the HW capture timestamp (TSC) from system time.

clock_gettime(MONOTONIC_RAW) = cycle_ns(TSC) - offset_ns

please refer to below example for offset_ns to compensate the capture timestamp.
for example,

root@tegra-ubuntu:~# cat /sys/devices/system/clocksource/clocksource0/offset_ns
9045955168
diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
index f8c0df5..6a7c370 100644
--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c
+++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
@@ -427,6 +427,9 @@ static void vi5_capture_dequeue(struct tegra_channel *chan,
    /* Read SOF from capture descriptor */
    ts = ns_to_timespec((s64)descr->status.sof_timestamp);
... 
+   pr_err("Jerry %s timestamp= %ld.%ld Line(%d)\n", __func__, ts.tv_sec, ts.tv_nsec, __LINE__);
kernel log
[  128.924693] Jerry vi5_capture_dequeue timestamp= 137.483546848 

which means… 128.924693 + 9045955168(ns) ~= 137.483546848


VI drivers to capture frame and store the timestamp with TSC.
you may also adding some kernel APIs for checking timestamp difference within the VI drivers.
for example,

*ts = ns_to_timespec((s64)status.sof_ts);
+ printk("VI: RTCPU SOF timestamp %lu.%lu s\n", ts->tv_sec, ts->tv_nsec);
+ sys_clock_gettime(CLOCK_MONOTONIC, &monotonic);
+ printk("VI: Monotonic Raw timestamp %lu.%lu s\n", monotonic.tv_sec, monotonic.tv_nsec);