summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libcamera/software_isp/debayer_cpu.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index cf5ecdf7..31ab96ab 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -20,6 +20,7 @@
#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"
@@ -722,23 +723,6 @@ void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)
namespace {
-void syncBufferForCPU(FrameBuffer *buffer, uint64_t syncFlags)
-{
- for (const FrameBuffer::Plane &plane : buffer->planes()) {
- const int fd = plane.fd.get();
- struct dma_buf_sync sync = { syncFlags };
- int ret;
-
- ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);
- if (ret < 0) {
- ret = errno;
- LOG(Debayer, Error)
- << "Syncing buffer FD " << fd << " with flags "
- << syncFlags << " failed: " << strerror(ret);
- }
- }
-}
-
inline int64_t timeDiff(timespec &after, timespec &before)
{
return (after.tv_sec - before.tv_sec) * 1000000000LL +
@@ -756,8 +740,12 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
clock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime);
}
- syncBufferForCPU(input, DMA_BUF_SYNC_START | DMA_BUF_SYNC_READ);
- syncBufferForCPU(output, DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE);
+ 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);
green_ = params.green;
red_ = swapRedBlueGains_ ? params.blue : params.red;
@@ -786,8 +774,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
metadata.planes()[0].bytesused = out.planes()[0].size();
- syncBufferForCPU(output, DMA_BUF_SYNC_END | DMA_BUF_SYNC_WRITE);
- syncBufferForCPU(input, DMA_BUF_SYNC_END | DMA_BUF_SYNC_READ);
+ dmaSyncers.clear();
/* Measure before emitting signals */
if (measuredFrames_ < DebayerCpu::kLastFrameToMeasure &&