[v1,04/11] ipa: rkisp1: Pass parameters buffer size to pipeline handler
diff mbox series

Message ID 20240703225230.3530-5-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • rkisp1: Support BLS on i.MX8MP
Related show

Commit Message

Laurent Pinchart July 3, 2024, 10:52 p.m. UTC
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

The ISP parameters buffer currently has a fixed payload size, which is
hardcoded in the pipeline handler. To prepare for support of the
extensible parameters format that has a variable payload size, pass the
size from the IPA module to the pipeline handler explicitly. Keep the
size hardcoded to sizeof(struct rkisp1_params_cfg) for now, this will be
udpated later.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/ipa/rkisp1.mojom       | 2 +-
 src/ipa/rkisp1/rkisp1.cpp                | 2 +-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)

Comments

Jacopo Mondi July 4, 2024, 10:59 a.m. UTC | #1
On Thu, Jul 04, 2024 at 01:52:23AM GMT, Laurent Pinchart wrote:
> From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Well, this was not a standalone patch in my tree, so if you want to
retain authorship feel free to do so

>
> The ISP parameters buffer currently has a fixed payload size, which is
> hardcoded in the pipeline handler. To prepare for support of the
> extensible parameters format that has a variable payload size, pass the
> size from the IPA module to the pipeline handler explicitly. Keep the
> size hardcoded to sizeof(struct rkisp1_params_cfg) for now, this will be
> udpated later.
>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  include/libcamera/ipa/rkisp1.mojom       | 2 +-
>  src/ipa/rkisp1/rkisp1.cpp                | 2 +-
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 7 +++----
>  3 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
> index 585d38572aa2..80d54a03aa90 100644
> --- a/include/libcamera/ipa/rkisp1.mojom
> +++ b/include/libcamera/ipa/rkisp1.mojom
> @@ -37,7 +37,7 @@ interface IPARkISP1Interface {
>  };
>
>  interface IPARkISP1EventInterface {
> -	paramsBufferReady(uint32 frame);
> +	paramsBufferReady(uint32 frame, uint32 bytesused);
>  	setSensorControls(uint32 frame, libcamera.ControlList sensorControls);
>  	metadataReady(uint32 frame, libcamera.ControlList metadata);
>  };
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 71698bc47391..84ffe6cf2777 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -332,7 +332,7 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
>  	for (auto const &algo : algorithms())
>  		algo->prepare(context_, frame, frameContext, params);
>
> -	paramsBufferReady.emit(frame);
> +	paramsBufferReady.emit(frame, sizeof(*params));
>  }
>
>  void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 73e56b8fbf13..f5c01a2566d2 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -110,7 +110,7 @@ public:
>  	std::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;
>
>  private:
> -	void paramFilled(unsigned int frame);
> +	void paramFilled(unsigned int frame, unsigned int bytesused);
>  	void setSensorControls(unsigned int frame,
>  			       const ControlList &sensorControls);
>
> @@ -379,15 +379,14 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)
>  	return 0;
>  }
>
> -void RkISP1CameraData::paramFilled(unsigned int frame)
> +void RkISP1CameraData::paramFilled(unsigned int frame, unsigned int bytesused)
>  {
>  	PipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();
>  	RkISP1FrameInfo *info = frameInfo_.find(frame);
>  	if (!info)
>  		return;
>
> -	info->paramBuffer->_d()->metadata().planes()[0].bytesused =
> -		sizeof(struct rkisp1_params_cfg);
> +	info->paramBuffer->_d()->metadata().planes()[0].bytesused = bytesused;
>  	pipe->param_->queueBuffer(info->paramBuffer);
>  	pipe->stat_->queueBuffer(info->statBuffer);
>
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
index 585d38572aa2..80d54a03aa90 100644
--- a/include/libcamera/ipa/rkisp1.mojom
+++ b/include/libcamera/ipa/rkisp1.mojom
@@ -37,7 +37,7 @@  interface IPARkISP1Interface {
 };
 
 interface IPARkISP1EventInterface {
-	paramsBufferReady(uint32 frame);
+	paramsBufferReady(uint32 frame, uint32 bytesused);
 	setSensorControls(uint32 frame, libcamera.ControlList sensorControls);
 	metadataReady(uint32 frame, libcamera.ControlList metadata);
 };
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 71698bc47391..84ffe6cf2777 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -332,7 +332,7 @@  void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
 	for (auto const &algo : algorithms())
 		algo->prepare(context_, frame, frameContext, params);
 
-	paramsBufferReady.emit(frame);
+	paramsBufferReady.emit(frame, sizeof(*params));
 }
 
 void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 73e56b8fbf13..f5c01a2566d2 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -110,7 +110,7 @@  public:
 	std::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;
 
 private:
-	void paramFilled(unsigned int frame);
+	void paramFilled(unsigned int frame, unsigned int bytesused);
 	void setSensorControls(unsigned int frame,
 			       const ControlList &sensorControls);
 
@@ -379,15 +379,14 @@  int RkISP1CameraData::loadIPA(unsigned int hwRevision)
 	return 0;
 }
 
-void RkISP1CameraData::paramFilled(unsigned int frame)
+void RkISP1CameraData::paramFilled(unsigned int frame, unsigned int bytesused)
 {
 	PipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();
 	RkISP1FrameInfo *info = frameInfo_.find(frame);
 	if (!info)
 		return;
 
-	info->paramBuffer->_d()->metadata().planes()[0].bytesused =
-		sizeof(struct rkisp1_params_cfg);
+	info->paramBuffer->_d()->metadata().planes()[0].bytesused = bytesused;
 	pipe->param_->queueBuffer(info->paramBuffer);
 	pipe->stat_->queueBuffer(info->statBuffer);