From patchwork Sat Aug 31 18:59:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 21128 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 64C46C323E for ; Sat, 31 Aug 2024 19:00:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6759063471; Sat, 31 Aug 2024 21:00:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="LwD+8pUJ"; dkim-atps=neutral Received: from sender4-op-o10.zoho.com (sender4-op-o10.zoho.com [136.143.188.10]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F24B61900 for ; Sat, 31 Aug 2024 21:00:13 +0200 (CEST) Delivered-To: robert.mader@collabora.com ARC-Seal: i=1; a=rsa-sha256; t=1725130810; cv=none; d=zohomail.com; s=zohoarc; b=U+RHM42rBjaCb4VrJUduWGjyr2KC0i2uCfQ4vn19UgcWiAGoM+fL+a77FEOXYLVloSlQl2IvzFVpGhmmfgHRtIyJV1qGhbgkpN0yc5xbtNYTMNvLYjvHiVHw6rHZPpao9kUQiP99cSi5pR6dAkaNvPYSnu1jnHwKTLtZ0RR5O6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725130810; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=mRGpj2r7GTtOpgoGMSinSGIxW6JGSD53mi31ysKAMn0=; b=ecoDsGxA6Ak5dKeKE1hjojoW9AvnlKnIDpx4fWV84P01XmXszmxDFS0vK+1UwiN+VFp7X+cJU2JYU6oOggSAiPgPX65zYUBPUK7nGoEc8QvV2VN6L3OQNMi1V7CSdoqkGuY04yPhhlIRkTcA5GQhb1iEEKGAni7cOP0RZvjlc00= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1725130810; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=mRGpj2r7GTtOpgoGMSinSGIxW6JGSD53mi31ysKAMn0=; b=LwD+8pUJQTpcal+YZ+o2CxZdy8HltPrDXhJma+Px90H5DA9MTLQolu/2d+AlHfBq 8aMFNkynF8pjgd40dE2aUtY4986AMaZqrLnRBcbkxwvW/papSG6ztPvfjIKbXIxLff/ 8ZAIRs1wKX4GaXUHTUFOvb7IaxJWTD8JY4jnJKGA= Received: by mx.zohomail.com with SMTPS id 1725130809016294.34292254385946; Sat, 31 Aug 2024 12:00:09 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH] libcamera: debayer_cpu: Report buffer sync times Date: Sat, 31 Aug 2024 20:59:26 +0200 Message-ID: <20240831185927.125879-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" --- 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 &&