[libcamera-devel,04/15] libcamera: ipu3: Do not overwrite StreamConfiguration

Message ID 20200701123036.51922-5-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: ipu3: Rework streams configuration
Related show

Commit Message

Jacopo Mondi July 1, 2020, 12:30 p.m. UTC
The validate function overwrites the generated StreamConfiguration with
the one reported by the CIO2 unit when inspecting the RAW stream
configuration.

As we prepare to add StreamFormats to the IPU3 StreamConfiguration,
assigning to the CIO2 generated configuration would delete the
StreamFormats.

Fix this by updating relevant fields only in order to keep the
assigned StreamFormats.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.27.0

Comments

Niklas Söderlund July 1, 2020, 4:24 p.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2020-07-01 14:30:25 +0200, Jacopo Mondi wrote:
> The validate function overwrites the generated StreamConfiguration with
> the one reported by the CIO2 unit when inspecting the RAW stream
> configuration.
> 
> As we prepare to add StreamFormats to the IPU3 StreamConfiguration,
> assigning to the CIO2 generated configuration would delete the
> StreamFormats.
> 
> Fix this by updating relevant fields only in order to keep the
> assigned StreamFormats.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 97fc8b60c3cb..cd18c6f31023 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -264,7 +264,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
>  		const Stream *stream = streams_[i];
> 
>  		if (stream == &data_->rawStream_) {
> -			cfg = cio2Configuration_;
> +			cfg.size = cio2Configuration_.size;
> +			cfg.pixelFormat = cio2Configuration_.pixelFormat;
> +			cfg.bufferCount = cio2Configuration_.bufferCount;
>  		} else {
>  			bool scale = stream == &data_->vfStream_;
>  			adjustStream(config_[i], scale);
> --
> 2.27.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 97fc8b60c3cb..cd18c6f31023 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -264,7 +264,9 @@  CameraConfiguration::Status IPU3CameraConfiguration::validate()
 		const Stream *stream = streams_[i];

 		if (stream == &data_->rawStream_) {
-			cfg = cio2Configuration_;
+			cfg.size = cio2Configuration_.size;
+			cfg.pixelFormat = cio2Configuration_.pixelFormat;
+			cfg.bufferCount = cio2Configuration_.bufferCount;
 		} else {
 			bool scale = stream == &data_->vfStream_;
 			adjustStream(config_[i], scale);