[PATCH 0/5] Implement wallclock timestamps for frames

David Plowman david.plowman at raspberrypi.com
Fri Dec 6 15:27:37 CET 2024


Hi everyone

Here's a version that incorporates the various comments and decisions
from yesterday's useful discussions. So thanks to everyone for taking
the time yesterday! To summarise what has changed:

* It's been simplified by sampling both clocks in dequeueBuffer. It
  works better like this too, as there's less chance of context
  switches intervening. (I've also provided an option to have the
  ClockRecovery class sample the timestamps for you, for convenience.)

* I've stopped talking about "steady clocks" and "system clocks" in
  the C++ fashion. It doesn't seem 100% explicit exactly what these
  are, so I've gone over to Linux CLOCK_BOOTTIME and CLOCK_REALTIME
  instead (which do appear to be equivalent, at least).

* I've removed the raw wallclock entirely. It's not really useful on
  its own, because of the other changes, and I couldn't really decide
  what to do. I've left some logging in the clock recovery code,
  though, so at least there's that.

* Pipeline handlers have to enable wallclocks for a device, by passing
  in a ClockRecovery (which they could tweak, if they don't like the
  default configuration).

* There's a near-duplicate of the final patch for the Pi 5
  too. Looking forward to being able to submit that!!

But lots still to talk about, I'm sure - looking forward to it!

Thanks
David

David Plowman (5):
  controls: Add FrameWallClock control
  libcamera: Add ClockRecovery class to generate wallclock timestamps
  libcamera: v4l2: Add wallclock metadata to video devices
  pipeline: rpi: common: Add wallclock timestamp support
  pipeline: rpi: vc4: Add wallclock timestamp support

 include/libcamera/framebuffer.h               |   1 +
 include/libcamera/internal/clock_recovery.h   |  72 ++++++
 include/libcamera/internal/meson.build        |   1 +
 include/libcamera/internal/v4l2_videodevice.h |   5 +
 src/libcamera/clock_recovery.cpp              | 207 ++++++++++++++++++
 src/libcamera/control_ids_core.yaml           |  14 ++
 src/libcamera/meson.build                     |   1 +
 .../pipeline/rpi/common/pipeline_base.cpp     |   2 +
 .../pipeline/rpi/common/pipeline_base.h       |   3 +
 src/libcamera/pipeline/rpi/vc4/vc4.cpp        |   4 +
 src/libcamera/v4l2_videodevice.cpp            |  36 ++-
 11 files changed, 345 insertions(+), 1 deletion(-)
 create mode 100644 include/libcamera/internal/clock_recovery.h
 create mode 100644 src/libcamera/clock_recovery.cpp

-- 
2.39.5



More information about the libcamera-devel mailing list