[v1,12/35] pipeline: rkisp1: Fix controls in raw mode
diff mbox series

Message ID 20251024085130.995967-13-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: pipeline rework for PFC
Related show

Commit Message

Stefan Klug Oct. 24, 2025, 8:50 a.m. UTC
After the pipeline restructuring setSensorControls is no longer emitted
within process() but within computeParams(). In raw mode computeParams
is not called and therefore setSensorControls is never emitted. Fix that
by allowing computeParams to be called with an empty bufferId. This
strategy is also used for processStats() to ensure that metadata gets
filled in raw mode.  Then call computeParams within frameStart() when in
raw mode.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/rkisp1/rkisp1.cpp                | 12 ++++++++++++
 src/libcamera/pipeline/rkisp1/rkisp1.cpp |  4 ++++
 2 files changed, 16 insertions(+)

Comments

Paul Elder Jan. 22, 2026, 9:15 a.m. UTC | #1
Quoting Stefan Klug (2025-10-24 17:50:36)
> After the pipeline restructuring setSensorControls is no longer emitted
> within process() but within computeParams(). In raw mode computeParams
> is not called and therefore setSensorControls is never emitted. Fix that
> by allowing computeParams to be called with an empty bufferId. This
> strategy is also used for processStats() to ensure that metadata gets
> filled in raw mode.  Then call computeParams within frameStart() when in
> raw mode.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  src/ipa/rkisp1/rkisp1.cpp                | 12 ++++++++++++
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp |  4 ++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index ab8583e389d3..ee87c899fcb1 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -343,6 +343,18 @@ void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId)
>  {
>         IPAFrameContext &frameContext = context_.frameContexts.get(frame);
>  
> +       /*
> +        * \todo: This needs discussion. In raw mode, computeParams is
> +        * called without a params buffer, to trigger the setSensorControls
> +        * signal. Currently our algorithms don't support prepare calls with
> +        * a nullptr. Do we need that or can we safely skip it?

At first I thought we could just use the same patterns as in processStats() and
check if (algo->disabled_) but then I realized there's not much point in
prepare()ing in the first place since there are no stats. The manual controls
are handled in queueRequest and the metadata and state is handled in process.

We can keep the todo though, to document the debate.

> +        */
> +       if (bufferId == 0) {
> +               ControlList ctrls = getSensorControls(frameContext);
> +               setSensorControls.emit(frame, ctrls);
> +               return;
> +       }
> +
>         RkISP1Params params(context_.configuration.paramFormat,
>                             mappedBuffers_.at(bufferId).planes()[0]);
>  
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 9be9f44db479..0e6e45bba75b 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -1618,6 +1618,10 @@ void PipelineHandlerRkISP1::frameStart(uint32_t sequence)
>  
>         RkISP1CameraData *data = cameraData(activeCamera_);
>         data->delayedCtrls_->applyControls(sequence);
> +
> +       if (isRaw_) {
> +               data->ipa_->computeParams(sequence + 1, 0);
> +       }

I don't think we need the braces.

What's the reason that this is here instead of in queueRequestDevice like the
non-raw case?


Paul

>  }
>  
>  bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
> -- 
> 2.48.1
>

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index ab8583e389d3..ee87c899fcb1 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -343,6 +343,18 @@  void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId)
 {
 	IPAFrameContext &frameContext = context_.frameContexts.get(frame);
 
+	/*
+	 * \todo: This needs discussion. In raw mode, computeParams is
+	 * called without a params buffer, to trigger the setSensorControls
+	 * signal. Currently our algorithms don't support prepare calls with
+	 * a nullptr. Do we need that or can we safely skip it?
+	 */
+	if (bufferId == 0) {
+		ControlList ctrls = getSensorControls(frameContext);
+		setSensorControls.emit(frame, ctrls);
+		return;
+	}
+
 	RkISP1Params params(context_.configuration.paramFormat,
 			    mappedBuffers_.at(bufferId).planes()[0]);
 
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 9be9f44db479..0e6e45bba75b 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -1618,6 +1618,10 @@  void PipelineHandlerRkISP1::frameStart(uint32_t sequence)
 
 	RkISP1CameraData *data = cameraData(activeCamera_);
 	data->delayedCtrls_->applyControls(sequence);
+
+	if (isRaw_) {
+		data->ipa_->computeParams(sequence + 1, 0);
+	}
 }
 
 bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)