[libcamera-devel,v4,12/16] libcamera: raspberrypi: Do not over-write metadata
diff mbox series

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

Commit Message

Jacopo Mondi April 30, 2021, 4 p.m. UTC
When a Request is completed upon receiving the IPA produced metadata,
the metadata associated with the Request are over-written, deleting
the information set at output buffer completion, such as the
SensorTimestamp.

This commit applies to the RaspberryPi pipeline handler the same change
applied to IPU3 in commit 13a7ed7b1f1f ("libcamera: ipu3: Do not
over-write metadata") but compared to that commit it uses the newly
introduced ControlList::merge() function.

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

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

Thanks for your work.

On 2021-04-30 18:00:22 +0200, Jacopo Mondi wrote:
> When a Request is completed upon receiving the IPA produced metadata,
> the metadata associated with the Request are over-written, deleting
> the information set at output buffer completion, such as the
> SensorTimestamp.
> 
> This commit applies to the RaspberryPi pipeline handler the same change
> applied to IPU3 in commit 13a7ed7b1f1f ("libcamera: ipu3: Do not
> over-write metadata") but compared to that commit it uses the newly
> introduced ControlList::merge() function.
> 
> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 2a917455500f..46f418aa8d73 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1312,9 +1312,14 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &
>  
>  	handleStreamBuffer(buffer, &isp_[Isp::Stats]);
>  
> -	/* Fill the Request metadata buffer with what the IPA has provided */
> +	/*
> +	 * Add to the Request metadata buffer what the IPA has provided.
> +	 *
> +	 * Do not overwrite controls set by the pipeline handler, for example
> +	 * SensorTimestamp.
> +	 */

The comment reads more like it belongs in the commit message then in the 
code. With the comment left unchanged,

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

>  	Request *request = requestQueue_.front();
> -	request->metadata() = controls;
> +	request->metadata().merge(controls);
>  
>  	/*
>  	 * Also update the ScalerCrop in the metadata with what we actually
> -- 
> 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/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 2a917455500f..46f418aa8d73 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1312,9 +1312,14 @@  void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &
 
 	handleStreamBuffer(buffer, &isp_[Isp::Stats]);
 
-	/* Fill the Request metadata buffer with what the IPA has provided */
+	/*
+	 * Add to the Request metadata buffer what the IPA has provided.
+	 *
+	 * Do not overwrite controls set by the pipeline handler, for example
+	 * SensorTimestamp.
+	 */
 	Request *request = requestQueue_.front();
-	request->metadata() = controls;
+	request->metadata().merge(controls);
 
 	/*
 	 * Also update the ScalerCrop in the metadata with what we actually