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

Message ID 20210430160026.190724-9-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 buffer's timestamp is recorded at DMA-transfer time, and it does not
theoretically matches the 'start of exposure' definition. Record this with
a \todo entry.

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

Comments

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

Thanks for your work.

On 2021-04-30 18:00:18 +0200, Jacopo Mondi wrote:
> Report the sensor's timestamp in the Request metadata using the
> completed buffer timestamp.
> 
> The buffer's timestamp is recorded at DMA-transfer time, and it does not
> theoretically matches the 'start of exposure' definition. Record this with
> a \todo entry.
> 
> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 26f708242523..cee6d85fac47 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -1070,6 +1070,15 @@ void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)
>  {
>  	Request *request = buffer->request();
>  
> +	/*
> +	 * Record the sensor's timestamp in the request metadata.
> +	 *
> +	 * \todo The sensor timestamp should be better estimated by connecting
> +	 * to the V4L2Device::frameStart signal.
> +	 */

Same comment as for previous patch, I think what is done here is the 
better solution.

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

> +	request->metadata().set(controls::SensorTimestamp,
> +				buffer->metadata().timestamp);
> +
>  	completeBuffer(request, buffer);
>  	tryCompleteRequest(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/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 26f708242523..cee6d85fac47 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -1070,6 +1070,15 @@  void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)
 {
 	Request *request = buffer->request();
 
+	/*
+	 * Record the sensor's timestamp in the request metadata.
+	 *
+	 * \todo The sensor timestamp should be better estimated by connecting
+	 * to the V4L2Device::frameStart signal.
+	 */
+	request->metadata().set(controls::SensorTimestamp,
+				buffer->metadata().timestamp);
+
 	completeBuffer(request, buffer);
 	tryCompleteRequest(request);
 }