Message ID | 20250824-b4-v0-5-2-gpuisp-v2-a-v2-10-96f4576c814e@linaro.org |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > We can reuse the DMA Sync code in the GPUISP. Move the code we need to > the base class. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@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 fc2438c0d0161a36da2769d95836f282836b143d..75e4bffab0f082bdf6e5bdf3030b9f49d4877524 100644 > --- a/src/libcamera/software_isp/debayer.cpp > +++ b/src/libcamera/software_isp/debayer.cpp > @@ -214,4 +214,17 @@ void Debayer::setParams(DebayerParams ¶ms) > gammaLut_ = params.gammaLut; > } > > +/** > + * \fn void Debayer::dmaSyncBegin(DebayerParams ¶ms) > + * \brief Common CPU/GPU Dma Sync Buffer begin The description could be probably improved. Reviewed-by: Milan Zamazal <mzamazal@redhat.com> > + */ > +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 5f692bcbdeec1447c596ebbdc984585948a34880..0af66b556bbf8993a66042a3a76cd50582209bce 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" > > @@ -85,6 +86,7 @@ private: > > protected: > void setParams(DebayerParams ¶ms); > + void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output); > }; > > } /* namespace libcamera */ > diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp > index 6ed17e9fc144bc7c3472d999b1e9c23236020963..9fce2a143ac9585eadcea41744d680bc9589c507 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" > > @@ -740,11 +739,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);
diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index fc2438c0d0161a36da2769d95836f282836b143d..75e4bffab0f082bdf6e5bdf3030b9f49d4877524 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -214,4 +214,17 @@ void Debayer::setParams(DebayerParams ¶ms) gammaLut_ = params.gammaLut; } +/** + * \fn void Debayer::dmaSyncBegin(DebayerParams ¶ms) + * \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 5f692bcbdeec1447c596ebbdc984585948a34880..0af66b556bbf8993a66042a3a76cd50582209bce 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" @@ -85,6 +86,7 @@ private: protected: void setParams(DebayerParams ¶ms); + void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 6ed17e9fc144bc7c3472d999b1e9c23236020963..9fce2a143ac9585eadcea41744d680bc9589c507 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" @@ -740,11 +739,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);
We can reuse the DMA Sync code in the GPUISP. Move the code we need to the base class. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@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(-)