[RFC,v2,03/14] libcamera: software_isp: Separate allocation of the parameters buffer
diff mbox series

Message ID 20260216203034.27558-4-mzamazal@redhat.com
State New
Headers show
Series
  • Software ISP: Share params and stats buffers
Related show

Commit Message

Milan Zamazal Feb. 16, 2026, 8:30 p.m. UTC
There will be some additions to that code in followup patches and let's
not blow the code in SoftwareIsp constructor even more.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 .../internal/software_isp/software_isp.h        |  1 +
 src/libcamera/software_isp/software_isp.cpp     | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h
index 30b25cddf..dc6b6f7c1 100644
--- a/include/libcamera/internal/software_isp/software_isp.h
+++ b/include/libcamera/internal/software_isp/software_isp.h
@@ -98,6 +98,7 @@  private:
 	Thread ispWorkerThread_;
 	SharedMemObject<DebayerParams> sharedParams_;
 	DebayerParams debayerParams_;
+	bool allocateParamsBuffers();
 	DmaBufAllocator dmaHeap_;
 	bool ccmEnabled_;
 
diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
index 0447d2171..dc0a8eb84 100644
--- a/src/libcamera/software_isp/software_isp.cpp
+++ b/src/libcamera/software_isp/software_isp.cpp
@@ -88,12 +88,8 @@  SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,
 		LOG(SoftwareIsp, Error) << "Failed to create DmaBufAllocator object";
 		return;
 	}
-
-	sharedParams_ = SharedMemObject<DebayerParams>("softIsp_params");
-	if (!sharedParams_) {
-		LOG(SoftwareIsp, Error) << "Failed to create shared memory for parameters";
+	if (!allocateParamsBuffers())
 		return;
-	}
 
 	const GlobalConfiguration &configuration = pipe->cameraManager()->_d()->configuration();
 
@@ -176,6 +172,17 @@  SoftwareIsp::~SoftwareIsp()
 	debayer_.reset();
 }
 
+bool SoftwareIsp::allocateParamsBuffers()
+{
+	sharedParams_ = SharedMemObject<DebayerParams>("softIsp_params");
+	if (!sharedParams_) {
+		LOG(SoftwareIsp, Error) << "Failed to create shared memory for parameters";
+		return false;
+	}
+
+	return true;
+}
+
 /**
  * \fn int SoftwareIsp::loadConfiguration([[maybe_unused]] const std::string &filename)
  * \brief Load a configuration from a file