{"id":26796,"url":"https://patchwork.libcamera.org/api/patches/26796/?format=json","web_url":"https://patchwork.libcamera.org/patch/26796/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260521155906.120373-5-robert.mader@collabora.com>","date":"2026-05-21T15:59:05","name":"[v4,4/5] libcamera: swstats_cpu: Take MappedFrameBuffer in processFrame()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"016d66794743d642660b696763ce4fa5f9c9c53e","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/?format=json","name":"Robert Mader","email":"robert.mader@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26796/mbox/","series":[{"id":5960,"url":"https://patchwork.libcamera.org/api/series/5960/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5960","date":"2026-05-21T15:59:02","name":"software_isp: Implement DMABuf import for input buffers","version":4,"mbox":"https://patchwork.libcamera.org/series/5960/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26796/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26796/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D3E31C32F4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 May 2026 15:59:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8446462FD3;\n\tThu, 21 May 2026 17:59:38 +0200 (CEST)","from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E7D2862FEC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 May 2026 17:59:31 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1779379165474836.5361585607891;\n\tThu, 21 May 2026 08:59:25 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"ZuAqKimJ\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1779379168; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=O8mxTUk8sKYUSSAPFUi8744otl+fsHGpI4txxX0E4tVkPiqA2av050p3GEugjZJZZ6sk72mdWfV1tuE3YDIF34XoponfAwazkz3sjfFY86RnqyIMo5sucZoqX6ihKwvySGeYcUZqNwnjLoW0RrD8YZcBWcspVd67HHhzKIpz0uc=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1779379168;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=fUuYJQIHRIATzbug2Vo9yV+BiNeQ9KLOui8BmEmgzxM=; \n\tb=KZICwWCD/h6n0Gme9wIzBsMcoHDzDh74k5r5PKh4Pn5QD1kHG6aXfSAqhgERUaaKoezU8DKjeilzeDN6PcYAlWy/Sve8l1eMF43Y5hLHSWbxpLhWjY2YlHjgxCC/6gWQgr9caT88IokEatMsuHcEncCEn3V7HJysFvtu6BlBj7c=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1779379168;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=fUuYJQIHRIATzbug2Vo9yV+BiNeQ9KLOui8BmEmgzxM=;\n\tb=ZuAqKimJLiYMTFVL5l7Iu85iIjpbWjbCel8whGld++H+RzMYw9DEwEazDMSe67lb\n\tFxVW+pYZbnc3LpKx6Ws1U5SenaiXitPROYTkGh0hkjMkKFTP6SDRrH53tMGGad832DK\n\tJ91E5fG3tlphyIHfDXyxqxJBqXRNks4vSZnTRJ7Q=","From":"Robert Mader <robert.mader@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Robert Mader <robert.mader@collabora.com>","Subject":"[PATCH v4 4/5] libcamera: swstats_cpu: Take MappedFrameBuffer in\n\tprocessFrame()","Date":"Thu, 21 May 2026 17:59:05 +0200","Message-ID":"<20260521155906.120373-5-robert.mader@collabora.com>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260521155906.120373-1-robert.mader@collabora.com>","References":"<20260521155906.120373-1-robert.mader@collabora.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"As the only current user - DebayerEGL::process() - already has the buffer\nmapped. Currently this shouldn't impact performance as the kernel should\nalready avoid remapping the dmabuf - i.e. we implicitly benefit from the\nfact that the mentioned function holds its mapping during the runtime of\nprocessFrame(). In a following commit DebayerEGL::process() will change\nin a way that would make keeping the mapping counter-intuitive. Thus\nthis change ensures we'll not accidentally start mapping the buffer\ntwice per frame.\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n---\n .../libcamera/internal/software_isp/swstats_cpu.h   |  2 +-\n src/libcamera/software_isp/debayer_egl.cpp          |  2 +-\n src/libcamera/software_isp/swstats_cpu.cpp          | 13 +++----------\n 3 files changed, 5 insertions(+), 12 deletions(-)","diff":"diff --git a/include/libcamera/internal/software_isp/swstats_cpu.h b/include/libcamera/internal/software_isp/swstats_cpu.h\nindex b5348c6fe..c9ed1d0a6 100644\n--- a/include/libcamera/internal/software_isp/swstats_cpu.h\n+++ b/include/libcamera/internal/software_isp/swstats_cpu.h\n@@ -56,7 +56,7 @@ public:\n \tvoid setWindow(const Rectangle &window);\n \tvoid startFrame(uint32_t frame);\n \tvoid finishFrame(uint32_t frame, uint32_t bufferId);\n-\tvoid processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input);\n+\tvoid processFrame(uint32_t frame, uint32_t bufferId, MappedFrameBuffer *input);\n \n \tvoid processLine0(uint32_t frame, unsigned int y, const uint8_t *src[], unsigned int statsBufferIndex = 0)\n \t{\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 696498a58..d15f3cd48 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -555,7 +555,7 @@ void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \tmetadata.planes()[0].bytesused = output->planes()[0].length;\n \n \t/* Calculate stats for the whole frame */\n-\tstats_->processFrame(frame, 0, input);\n+\tstats_->processFrame(frame, 0, &in);\n \tdmaSyncers.clear();\n \n \tegl_.syncOutput();\ndiff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp\nindex 0815ec9a3..b182a1a2b 100644\n--- a/src/libcamera/software_isp/swstats_cpu.cpp\n+++ b/src/libcamera/software_isp/swstats_cpu.cpp\n@@ -543,23 +543,16 @@ void SwStatsCpu::processBayerFrame2(MappedFrameBuffer &in)\n  *\n  * This may only be called after a successful setWindow() call.\n  */\n-void SwStatsCpu::processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input)\n+void SwStatsCpu::processFrame(uint32_t frame, uint32_t bufferId, MappedFrameBuffer *input)\n {\n-\tif (frame % kStatPerNumFrames) {\n+\tif (!input || frame % kStatPerNumFrames) {\n \t\tfinishFrame(frame, bufferId);\n \t\treturn;\n \t}\n \n \tbench_.startFrame();\n \tstartFrame(frame);\n-\n-\tMappedFrameBuffer in(input, MappedFrameBuffer::MapFlag::Read);\n-\tif (!in.isValid()) {\n-\t\tLOG(SwStatsCpu, Error) << \"mmap-ing buffer(s) failed\";\n-\t\treturn;\n-\t}\n-\n-\t(this->*processFrame_)(in);\n+\t(this->*processFrame_)(*input);\n \tfinishFrame(frame, bufferId);\n \tbench_.finishFrame();\n }\n","prefixes":["v4","4/5"]}