[v2,16/22] libcamera: software_isp: Move configure to worker thread
diff mbox series

Message ID 20251127022256.178929-17-bryan.odonoghue@linaro.org
State New
Headers show
Series
  • GPUISP precursor series
Related show

Commit Message

Bryan O'Donoghue Nov. 27, 2025, 2:22 a.m. UTC
EGL requires both configure() and process() to operate on the same
thread. As preparation for that, move current CPU configure into the
WorkerThread with a ConnectionTypeBlocking invocation of
&DebayerCpu::configure.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 src/libcamera/software_isp/software_isp.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Nov. 27, 2025, 9:09 a.m. UTC | #1
Quoting Bryan O'Donoghue (2025-11-27 02:22:48)
> EGL requires both configure() and process() to operate on the same
> thread. As preparation for that, move current CPU configure into the
> WorkerThread with a ConnectionTypeBlocking invocation of
> &DebayerCpu::configure.
> 

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  src/libcamera/software_isp/software_isp.cpp | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
> index afa4eb7a8..4c232339b 100644
> --- a/src/libcamera/software_isp/software_isp.cpp
> +++ b/src/libcamera/software_isp/software_isp.cpp
> @@ -267,7 +267,15 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg,
>  
>         ispWorkerThread_.start();
>  
> -       return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_);
> +       ret = debayer_->invokeMethod(&Debayer::configure,
> +                                    ConnectionTypeBlocking, inputCfg,
> +                                    outputCfgs, ccmEnabled_);
> +       if (ret) {
> +               ispWorkerThread_.exit();
> +               ispWorkerThread_.wait();
> +       }
> +
> +       return ret;
>  }
>  
>  /**
> @@ -391,7 +399,7 @@ void SoftwareIsp::stop()
>  void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)
>  {
>         ipa_->computeParams(frame);
> -       debayer_->invokeMethod(&DebayerCpu::process,
> +       debayer_->invokeMethod(&Debayer::process,
>                                ConnectionTypeQueued, frame, input, output, debayerParams_);
>  }
>  
> -- 
> 2.51.2
>

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
index afa4eb7a8..4c232339b 100644
--- a/src/libcamera/software_isp/software_isp.cpp
+++ b/src/libcamera/software_isp/software_isp.cpp
@@ -267,7 +267,15 @@  int SoftwareIsp::configure(const StreamConfiguration &inputCfg,
 
 	ispWorkerThread_.start();
 
-	return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_);
+	ret = debayer_->invokeMethod(&Debayer::configure,
+				     ConnectionTypeBlocking, inputCfg,
+				     outputCfgs, ccmEnabled_);
+	if (ret) {
+		ispWorkerThread_.exit();
+		ispWorkerThread_.wait();
+	}
+
+	return ret;
 }
 
 /**
@@ -391,7 +399,7 @@  void SoftwareIsp::stop()
 void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)
 {
 	ipa_->computeParams(frame);
-	debayer_->invokeMethod(&DebayerCpu::process,
+	debayer_->invokeMethod(&Debayer::process,
 			       ConnectionTypeQueued, frame, input, output, debayerParams_);
 }