libcamera: debayer_cpu: Report buffer sync times
diff mbox series

Message ID 20240831185927.125879-1-robert.mader@collabora.com
State New
Headers show
Series
  • libcamera: debayer_cpu: Report buffer sync times
Related show

Commit Message

Robert Mader Aug. 31, 2024, 6:59 p.m. UTC
---
 src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Robert Mader Aug. 31, 2024, 7:02 p.m. UTC | #1
Whoops, this was the wrong commit, please ignore. Sorry!

On 31.08.24 20:59, Robert Mader wrote:
> ---
>   src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
> index 6c953b03..e51ab6ff 100644
> --- a/src/libcamera/software_isp/debayer_cpu.cpp
> +++ b/src/libcamera/software_isp/debayer_cpu.cpp
> @@ -735,6 +735,8 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
>   		clock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime);
>   	}
>   
> +	timespec time0 = {};
> +	clock_gettime(CLOCK_MONOTONIC_RAW, &time0);
>   	for (const FrameBuffer::Plane &plane : output->planes()) {
>   		const int fd = plane.fd.get();
>   		struct dma_buf_sync sync = { DMA_BUF_SYNC_START };
> @@ -744,6 +746,10 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
>   		if (ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync) < 0)
>   			LOG(Debayer, Error) << "Syncing buffer FD " << fd << "failed: " << errno;
>   	}
> +	timespec time1 = {};
> +	clock_gettime(CLOCK_MONOTONIC_RAW, &time1);
> +	int64_t time_sync = timeDiff(time1, time0);
> +	LOG(Debayer, Warning) << "Syncing input buffers start: " << time_sync / 1000 << "us";
>   
>   	green_ = params.green;
>   	red_ = swapRedBlueGains_ ? params.blue : params.red;
> @@ -772,6 +778,7 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
>   
>   	metadata.planes()[0].bytesused = out.planes()[0].size();
>   
> +	clock_gettime(CLOCK_MONOTONIC_RAW, &time0);
>   	for (const FrameBuffer::Plane &plane : output->planes()) {
>   		const int fd = plane.fd.get();
>   		struct dma_buf_sync sync = { DMA_BUF_SYNC_END };
> @@ -781,6 +788,9 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
>   		if (ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync) < 0)
>   			LOG(Debayer, Error) << "Syncing buffer FD " << fd << "failed: " << errno;
>   	}
> +	clock_gettime(CLOCK_MONOTONIC_RAW, &time1);
> +	time_sync = timeDiff(time1, time0);
> +	LOG(Debayer, Warning) << "Syncing input buffers end: " << time_sync / 1000 << "us";
>   
>   	/* Measure before emitting signals */
>   	if (measuredFrames_ < DebayerCpu::kLastFrameToMeasure &&

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index 6c953b03..e51ab6ff 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -735,6 +735,8 @@  void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
 		clock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime);
 	}
 
+	timespec time0 = {};
+	clock_gettime(CLOCK_MONOTONIC_RAW, &time0);
 	for (const FrameBuffer::Plane &plane : output->planes()) {
 		const int fd = plane.fd.get();
 		struct dma_buf_sync sync = { DMA_BUF_SYNC_START };
@@ -744,6 +746,10 @@  void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
 		if (ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync) < 0)
 			LOG(Debayer, Error) << "Syncing buffer FD " << fd << "failed: " << errno;
 	}
+	timespec time1 = {};
+	clock_gettime(CLOCK_MONOTONIC_RAW, &time1);
+	int64_t time_sync = timeDiff(time1, time0);
+	LOG(Debayer, Warning) << "Syncing input buffers start: " << time_sync / 1000 << "us";
 
 	green_ = params.green;
 	red_ = swapRedBlueGains_ ? params.blue : params.red;
@@ -772,6 +778,7 @@  void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
 
 	metadata.planes()[0].bytesused = out.planes()[0].size();
 
+	clock_gettime(CLOCK_MONOTONIC_RAW, &time0);
 	for (const FrameBuffer::Plane &plane : output->planes()) {
 		const int fd = plane.fd.get();
 		struct dma_buf_sync sync = { DMA_BUF_SYNC_END };
@@ -781,6 +788,9 @@  void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
 		if (ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync) < 0)
 			LOG(Debayer, Error) << "Syncing buffer FD " << fd << "failed: " << errno;
 	}
+	clock_gettime(CLOCK_MONOTONIC_RAW, &time1);
+	time_sync = timeDiff(time1, time0);
+	LOG(Debayer, Warning) << "Syncing input buffers end: " << time_sync / 1000 << "us";
 
 	/* Measure before emitting signals */
 	if (measuredFrames_ < DebayerCpu::kLastFrameToMeasure &&