[libcamera-devel,v3,06/16] libcamera: uvc: Report sensor timestamp
diff mbox series

Message ID 20210421160319.42251-7-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • Support SensorTimestamp metadata
Related show

Commit Message

Jacopo Mondi April 21, 2021, 4:03 p.m. UTC
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The UVC driver reports timestamps of SOE event through metadata, for
which there is no support in the current pipeline implementation.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Hirokazu Honda April 22, 2021, 4:35 a.m. UTC | #1
Hi Jacopo, thank you for the patch.

On Thu, Apr 22, 2021 at 1:02 AM Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> Report the sensor's timestamp in the Request metadata using the
> completed buffer timestamp.
>
> The UVC driver reports timestamps of SOE event through metadata, for
> which there is no support in the current pipeline implementation.
>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>

> ---
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> index b6c6ade5ebaf..faa8d6b05f46 100644
> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> @@ -662,6 +662,10 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer)
>  {
>         Request *request = buffer->request();
>
> +       /* \todo Use the UVC metadata to calculate a more precise timestamp */
> +       request->metadata().set(controls::SensorTimestamp,
> +                               buffer->metadata().timestamp);
> +
>         pipe_->completeBuffer(request, buffer);
>         pipe_->completeRequest(request);
>  }
> --
> 2.31.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index b6c6ade5ebaf..faa8d6b05f46 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -662,6 +662,10 @@  void UVCCameraData::bufferReady(FrameBuffer *buffer)
 {
 	Request *request = buffer->request();
 
+	/* \todo Use the UVC metadata to calculate a more precise timestamp */
+	request->metadata().set(controls::SensorTimestamp,
+				buffer->metadata().timestamp);
+
 	pipe_->completeBuffer(request, buffer);
 	pipe_->completeRequest(request);
 }