[libcamera-devel,09/13] libcamera: raspberrypi: Do not over-write metadata
diff mbox series

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

Commit Message

Jacopo Mondi April 19, 2021, 1:14 p.m. UTC
This commit applies to the RaspberryPi pipeline handler the same change
applied to IPU3 in commit 13a7ed7b1f1f ("libcamera: ipu3: Do not
over-write metadata").

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.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Naushir Patuck April 19, 2021, 1:58 p.m. UTC | #1
Hi Jacopo,

Thank you for your work.

On Mon, 19 Apr 2021 at 14:14, Jacopo Mondi <jacopo@jmondi.org> wrote:

> This commit applies to the RaspberryPi pipeline handler the same change
> applied to IPU3 in commit 13a7ed7b1f1f ("libcamera: ipu3: Do not
> over-write metadata").
>
> 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.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
>
---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index f22e286ed87a..d1902bfc3393 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1312,9 +1312,15 @@ 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, in
> example
>

s/in example/for example/?

Apart from that,
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>


> +        * SensorTimestamp.
> +        */
>         Request *request = requestQueue_.front();
> -       request->metadata() = controls;
> +       for (const auto &ctrl : controls)
> +               request->metadata().set(ctrl.first, ctrl.second);
>
>         /*
>          * 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
>
Laurent Pinchart April 20, 2021, 9:54 p.m. UTC | #2
Hi Jacopo,

Thank you for the patch.

On Mon, Apr 19, 2021 at 03:14:29PM +0200, Jacopo Mondi wrote:
> This commit applies to the RaspberryPi pipeline handler the same change
> applied to IPU3 in commit 13a7ed7b1f1f ("libcamera: ipu3: Do not
> over-write metadata").
> 
> 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.

The change looks good, but may be implemented on top of
ControlList::merge().

> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index f22e286ed87a..d1902bfc3393 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1312,9 +1312,15 @@ 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, in example
> +	 * SensorTimestamp.
> +	 */
>  	Request *request = requestQueue_.front();
> -	request->metadata() = controls;
> +	for (const auto &ctrl : controls)
> +		request->metadata().set(ctrl.first, ctrl.second);
>  
>  	/*
>  	 * Also update the ScalerCrop in the metadata with what we actually

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index f22e286ed87a..d1902bfc3393 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1312,9 +1312,15 @@  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, in example
+	 * SensorTimestamp.
+	 */
 	Request *request = requestQueue_.front();
-	request->metadata() = controls;
+	for (const auto &ctrl : controls)
+		request->metadata().set(ctrl.first, ctrl.second);
 
 	/*
 	 * Also update the ScalerCrop in the metadata with what we actually