[PATCH] libcamera: debayer_cpu: Report buffer sync times

Robert Mader robert.mader at collabora.com
Sat Aug 31 21:02:21 CEST 2024


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 &&

-- 
Robert Mader
Consultant Software Developer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718



More information about the libcamera-devel mailing list