[v6,5/7] libcamera: mali-c55: Configure camera in memory-to-memory
diff mbox series

Message ID 20260325-mali-cru-v6-5-b16b0c49819a@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: mali-c55: Add support for memory-to-memory
Related show

Commit Message

Jacopo Mondi March 25, 2026, 2:44 p.m. UTC
Add support for memory-to-memory Camera to the
PipelineHandlerMaliC55::configure() function.

Start by enabling the IVC links, then configure the CRU and
propagate the format to the IVC.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/libcamera/pipeline/mali-c55/mali-c55.cpp | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

Comments

Barnabás Pőcze March 31, 2026, 1:07 p.m. UTC | #1
2026. 03. 25. 15:44 keltezéssel, Jacopo Mondi írta:
> Add support for memory-to-memory Camera to the
> PipelineHandlerMaliC55::configure() function.
> 
> Start by enabling the IVC links, then configure the CRU and
> propagate the format to the IVC.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---

Looks ok to me.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   src/libcamera/pipeline/mali-c55/mali-c55.cpp | 24 ++++++++++++++++++++----
>   1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> index 26d368bb9132..be3e38da95ab 100644
> --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> @@ -1013,8 +1013,9 @@ int PipelineHandlerMaliC55::configure(Camera *camera,
>   			const MediaEntity *csi2Entity = in.csi2_->entity();
>   			return csi2Entity->getPadByIndex(1)->links()[0]->setEnabled(true);
>   		},
> -		[](MaliC55CameraData::Memory &) {
> -			return 0;
> +		[&](MaliC55CameraData::Memory &) {
> +			const MediaEntity *ivcEntity = ivcSd_->entity();
> +			return ivcEntity->getPadByIndex(1)->links()[0]->setEnabled(true);
>   		},
>   	}, data->input_);
>   	if (ret)
> @@ -1041,8 +1042,23 @@ int PipelineHandlerMaliC55::configure(Camera *camera,
>   
>   			return in.csi2_->getFormat(1, &subdevFormat);
>   		},
> -		[](MaliC55CameraData::Memory &) {
> -			return 0;
> +		[&](MaliC55CameraData::Memory &mem) {
> +			V4L2DeviceFormat inputFormat;
> +
> +			int r = mem.cru_->configure(&subdevFormat, &inputFormat);
> +			if (r)
> +				return r;
> +
> +			/* Propagate the CRU format to the IVC input. */
> +			r = ivcSd_->setFormat(0, &subdevFormat);
> +			if (r)
> +				return r;
> +
> +			r = ivcSd_->getFormat(1, &subdevFormat);
> +			if (r)
> +				return r;
> +
> +			return ivc_->setFormat(&inputFormat);
>   		},
>   	}, data->input_);
>   	if (ret)
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
index 26d368bb9132..be3e38da95ab 100644
--- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp
+++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
@@ -1013,8 +1013,9 @@  int PipelineHandlerMaliC55::configure(Camera *camera,
 			const MediaEntity *csi2Entity = in.csi2_->entity();
 			return csi2Entity->getPadByIndex(1)->links()[0]->setEnabled(true);
 		},
-		[](MaliC55CameraData::Memory &) {
-			return 0;
+		[&](MaliC55CameraData::Memory &) {
+			const MediaEntity *ivcEntity = ivcSd_->entity();
+			return ivcEntity->getPadByIndex(1)->links()[0]->setEnabled(true);
 		},
 	}, data->input_);
 	if (ret)
@@ -1041,8 +1042,23 @@  int PipelineHandlerMaliC55::configure(Camera *camera,
 
 			return in.csi2_->getFormat(1, &subdevFormat);
 		},
-		[](MaliC55CameraData::Memory &) {
-			return 0;
+		[&](MaliC55CameraData::Memory &mem) {
+			V4L2DeviceFormat inputFormat;
+
+			int r = mem.cru_->configure(&subdevFormat, &inputFormat);
+			if (r)
+				return r;
+
+			/* Propagate the CRU format to the IVC input. */
+			r = ivcSd_->setFormat(0, &subdevFormat);
+			if (r)
+				return r;
+
+			r = ivcSd_->getFormat(1, &subdevFormat);
+			if (r)
+				return r;
+
+			return ivc_->setFormat(&inputFormat);
 		},
 	}, data->input_);
 	if (ret)