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

Message ID 20210421160319.42251-11-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 buffer's timestamp reports the video capture buffer processing time,
and it does not theoretically matches the 'start of exposure'
definition.

VIMC being a testing platform and the test driver completes the buffers
for each media entity connected in the pipeline one after the other, the
current solution is acceptable for the pipeline.

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

Comments

Niklas Söderlund April 21, 2021, 6:41 p.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2021-04-21 18:03:13 +0200, Jacopo Mondi wrote:
> Report the sensor's timestamp in the Request metadata using the
> completed buffer timestamp.
> 
> The buffer's timestamp reports the video capture buffer processing time,
> and it does not theoretically matches the 'start of exposure'
> definition.
> 
> VIMC being a testing platform and the test driver completes the buffers
> for each media entity connected in the pipeline one after the other, the
> current solution is acceptable for the pipeline.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  src/libcamera/pipeline/vimc/vimc.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> index 8f5f4ba30953..ce83dcaab8ea 100644
> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> @@ -523,6 +523,10 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer)
>  {
>  	Request *request = buffer->request();
>  
> +	/* Record the sensor's timestamp in the request metadata. */
> +	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
Hirokazu Honda April 22, 2021, 5 a.m. UTC | #2
Hi Jacopo, thank you for the patch.

On Thu, Apr 22, 2021 at 3:41 AM Niklas Söderlund
<niklas.soderlund@ragnatech.se> wrote:
>
> Hi Jacopo,
>
> Thanks for your work.
>
> On 2021-04-21 18:03:13 +0200, Jacopo Mondi wrote:
> > Report the sensor's timestamp in the Request metadata using the
> > completed buffer timestamp.
> >
> > The buffer's timestamp reports the video capture buffer processing time,
> > and it does not theoretically matches the 'start of exposure'
> > definition.
> >
> > VIMC being a testing platform and the test driver completes the buffers
> > for each media entity connected in the pipeline one after the other, the
> > current solution is acceptable for the pipeline.
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
>

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

> > ---
> >  src/libcamera/pipeline/vimc/vimc.cpp | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> > index 8f5f4ba30953..ce83dcaab8ea 100644
> > --- a/src/libcamera/pipeline/vimc/vimc.cpp
> > +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> > @@ -523,6 +523,10 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer)
> >  {
> >       Request *request = buffer->request();
> >
> > +     /* Record the sensor's timestamp in the request metadata. */
> > +     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
> _______________________________________________
> 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/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 8f5f4ba30953..ce83dcaab8ea 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -523,6 +523,10 @@  void VimcCameraData::bufferReady(FrameBuffer *buffer)
 {
 	Request *request = buffer->request();
 
+	/* Record the sensor's timestamp in the request metadata. */
+	request->metadata().set(controls::SensorTimestamp,
+				buffer->metadata().timestamp);
+
 	pipe_->completeBuffer(request, buffer);
 	pipe_->completeRequest(request);
 }