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

Message ID 20251210-mali-cru-v2-4-e26421de202b@ideasonboard.com
State New
Headers show
Series
  • libcamera: mali-c55: Add support for memory-to-memory
Related show

Commit Message

Jacopo Mondi Dec. 10, 2025, 2:39 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 | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

Comments

Dan Scally Dec. 12, 2025, 2:39 p.m. UTC | #1
Hi Jacopo

On 10/12/2025 14:39, Jacopo Mondi wrote:
> 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 good too:


Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

>   src/libcamera/pipeline/mali-c55/mali-c55.cpp | 27 +++++++++++++++++++++++++--
>   1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> index c0c14338ddb3f1d0075df3b3d3d154bc1b5d678a..8dcc51e27020c754004cd98cbdf73e771275b059 100644
> --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
> @@ -1104,9 +1104,12 @@ int PipelineHandlerMaliC55::configure(Camera *camera,
>   		ret = csi2Entity->getPadByIndex(1)->links()[0]->setEnabled(true);
>   		break;
>   	}
> -	case MaliC55CameraData::Memory:
> +	case MaliC55CameraData::Memory: {
> +		const MediaEntity *ivcEntity = ivc_->entity();
> +		ret = ivcEntity->getPadByIndex(1)->links()[0]->setEnabled(true);
>   		break;
>   	}
> +	}
>   	if (ret)
>   		return ret;
>   
> @@ -1133,7 +1136,27 @@ int PipelineHandlerMaliC55::configure(Camera *camera,
>   		ret = data->csi2()->getFormat(1, &subdevFormat);
>   
>   		break;
> -	case MaliC55CameraData::Memory:
> +	}
> +	case MaliC55CameraData::Memory: {
> +		V4L2DeviceFormat inputFormat;
> +
> +		ret = data->cru()->configure(&subdevFormat, &inputFormat);
> +		if (ret)
> +			return ret;
> +
> +		/* Propagate the CRU format to the IVC input. */
> +		ret = ivc_->setFormat(0, &subdevFormat);
> +		if (ret)
> +			return ret;
> +
> +		ret = ivc_->getFormat(1, &subdevFormat);
> +		if (ret)
> +			return ret;
> +
> +		ret = input_->setFormat(&inputFormat);
> +		if (ret)
> +			return ret;
> +
>   		break;
>   	}
>   	}
>

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 c0c14338ddb3f1d0075df3b3d3d154bc1b5d678a..8dcc51e27020c754004cd98cbdf73e771275b059 100644
--- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp
+++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
@@ -1104,9 +1104,12 @@  int PipelineHandlerMaliC55::configure(Camera *camera,
 		ret = csi2Entity->getPadByIndex(1)->links()[0]->setEnabled(true);
 		break;
 	}
-	case MaliC55CameraData::Memory:
+	case MaliC55CameraData::Memory: {
+		const MediaEntity *ivcEntity = ivc_->entity();
+		ret = ivcEntity->getPadByIndex(1)->links()[0]->setEnabled(true);
 		break;
 	}
+	}
 	if (ret)
 		return ret;
 
@@ -1133,7 +1136,27 @@  int PipelineHandlerMaliC55::configure(Camera *camera,
 		ret = data->csi2()->getFormat(1, &subdevFormat);
 
 		break;
-	case MaliC55CameraData::Memory:
+	}
+	case MaliC55CameraData::Memory: {
+		V4L2DeviceFormat inputFormat;
+
+		ret = data->cru()->configure(&subdevFormat, &inputFormat);
+		if (ret)
+			return ret;
+
+		/* Propagate the CRU format to the IVC input. */
+		ret = ivc_->setFormat(0, &subdevFormat);
+		if (ret)
+			return ret;
+
+		ret = ivc_->getFormat(1, &subdevFormat);
+		if (ret)
+			return ret;
+
+		ret = input_->setFormat(&inputFormat);
+		if (ret)
+			return ret;
+
 		break;
 	}
 	}