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

Message ID 20210430160026.190724-7-jacopo@jmondi.org
State Superseded
Headers show
Series
  • Support SensorTimestamp metadata
Related show

Commit Message

Jacopo Mondi April 30, 2021, 4 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: Hirokazu Honda <hiroh@chromium.org>
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

Niklas Söderlund May 1, 2021, 6:28 a.m. UTC | #1
Hi Jacopo,

Thanks for your patch.

On 2021-04-30 18:00:16 +0200, Jacopo Mondi 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: Hirokazu Honda <hiroh@chromium.org>
> 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(+)
> 
> 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 */

How?

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> +	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
Jacopo Mondi May 1, 2021, 7:52 a.m. UTC | #2
Hi Niklas,

On Sat, May 01, 2021 at 08:28:46AM +0200, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your patch.
>
> On 2021-04-30 18:00:16 +0200, Jacopo Mondi 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: Hirokazu Honda <hiroh@chromium.org>
> > 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(+)
> >
> > 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 */
>
> How?

My understanding is that UVC is capable of producing metadata (no idea
how they're provided to uspace though) and the frame timestamp is part
of the metadata.

>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
>
> > +	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
>
> --
> Regards,
> Niklas Söderlund

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);
 }