[PATCH 17/27] libcamera: software_isp: Move DMA sync code to common place in Debayer base

Bryan O'Donoghue bryan.odonoghue at linaro.org
Tue Apr 22 23:59:10 CEST 2025


The DMA Sync code is directly reusable in eGLISP move to the Debayer base
class to facilitate reuse.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
 src/libcamera/software_isp/debayer.cpp     | 13 +++++++++++++
 src/libcamera/software_isp/debayer.h       |  2 ++
 src/libcamera/software_isp/debayer_cpu.cpp |  6 +-----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp
index 3d883b28..25cfd1a1 100644
--- a/src/libcamera/software_isp/debayer.cpp
+++ b/src/libcamera/software_isp/debayer.cpp
@@ -203,4 +203,17 @@ void Debayer::setParams(DebayerParams &params)
 	gammaLut_ = params.gammaLut;
 }
 
+/**
+ * \fn void Debayer::dmaSyncBegin(DebayerParams &params)
+ * \brief Common CPU/GPU Dma Sync Buffer begin
+ */
+void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output)
+{
+	for (const FrameBuffer::Plane &plane : input->planes())
+		dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read);
+
+	for (const FrameBuffer::Plane &plane : output->planes())
+		dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);
+}
+
 } /* namespace libcamera */
diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h
index 9cebcbe8..c8ce14f0 100644
--- a/src/libcamera/software_isp/debayer.h
+++ b/src/libcamera/software_isp/debayer.h
@@ -20,6 +20,7 @@
 #include <libcamera/geometry.h>
 #include <libcamera/stream.h>
 
+#include "libcamera/internal/dma_buf_allocator.h"
 #include "libcamera/internal/software_isp/benchmark.h"
 #include "libcamera/internal/software_isp/debayer_params.h"
 
@@ -86,6 +87,7 @@ private:
 protected:
 
 	void setParams(DebayerParams &params);
+	void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers,FrameBuffer *input, FrameBuffer *output);
 
 };
 
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index baec4799..987f225f 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -22,7 +22,6 @@
 #include <libcamera/formats.h>
 
 #include "libcamera/internal/bayer_format.h"
-#include "libcamera/internal/dma_buf_allocator.h"
 #include "libcamera/internal/framebuffer.h"
 #include "libcamera/internal/mapped_framebuffer.h"
 
@@ -748,11 +747,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
 	bench_.startFrame();
 
 	std::vector<DmaSyncer> dmaSyncers;
-	for (const FrameBuffer::Plane &plane : input->planes())
-		dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read);
 
-	for (const FrameBuffer::Plane &plane : output->planes())
-		dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);
+	dmaSyncBegin(dmaSyncers, input, output);
 
 	setParams(params);
 
-- 
2.49.0



More information about the libcamera-devel mailing list