From patchwork Thu Nov 27 02:22:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25226 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 29F56C3260 for ; Thu, 27 Nov 2025 02:23:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C099460AB8; Thu, 27 Nov 2025 03:23:32 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="phwsoRtw"; dkim-atps=neutral Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 503E8609E0 for ; Thu, 27 Nov 2025 03:23:30 +0100 (CET) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-477b1cc8fb4so1601975e9.1 for ; Wed, 26 Nov 2025 18:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764210210; x=1764815010; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FxhcasCeQZyIjm4rZ1EZcRl2EhvSjHrBdXO0dhQMDwQ=; b=phwsoRtwxMdBgUjIAgdFtPl7pcTHXnQDqPH0sdqvwoUno82zjGjrwPpdYrriNI94WE 0BddhYIkHN6yD3z9NUMRfCbcHhMhOD4MeUAo+5vb31n0l8H38Zg/xminv8dakSBMzeXg MUU5DXWWIvneKKSJqobDODg+GhRhP7yerfOL/gTMYpW3IvRhkbXLPQ3gVV3vjjDHPhw7 lPMHZv+ov1ABbh0aQr0mRTAS++4FdS2q0TavsHJGUevEgdcsCCIT6hWD6RXISFAsEtUi gav03RHp49ytRczkrPiBApR71xNM9+nGdL5bV6D5MhBICJ3bDaUdsKFngXlcPSsqs3HS ZT/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764210210; x=1764815010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FxhcasCeQZyIjm4rZ1EZcRl2EhvSjHrBdXO0dhQMDwQ=; b=NRmIRXRg4sJ9E0Ft7Aj8DbUkzHYaI+s0xpUK6/FICYJ6BVPo67NkLfeUtU6rCIpFnr yaD/HtAwQ+GVzHq2+aJWFM4dSSzCPxD0GBP2aMUR5uVrXHyAKIIa+fnhNqqeQsAF7slW fPhU3Mv3kGWIXhwKEkuonTnNR9nVFcrHzJhrW7OU36OxVS5/780btxiwBEaupIxfiUIm gBiV6D5qoHWiwAaNEvrvfb40G74OSKgNh12iKrblG5fxbhii3UvNwjOcMO52ALHnaEx2 5xJTosuA5zLqiOPxaOpnEDkG1x662Vf3KnCYWswVGk8eJlQgkRGHiSoKTDYPo9vh4UOe SGFA== X-Gm-Message-State: AOJu0Yxda+gqfEqdC8L/NMP0yNPUNmTK/+qgXfVEJeDLOmLm3sq/zQ0L AJmJ10VEsZDi3DmlMorKZHz2yDhu6fcjlAON+3ai2rggVOipAMUYhrLVgzkeTC4dMyJiIAEEEsD XWSrq2OM= X-Gm-Gg: ASbGncvXPLmAIelWop2IW8JFMWmQxwxJmFzmryTJJrfqxcAJqBxpCtMqtptUpX+xuzu GyoTJ+ecwyZPUZJLPgTb8pPzwJkdYTusUvyjCTJNIAQTo8Y3T+NGOQ9mC0pOB+GqghAs7qbfeG7 ZT8qL3fhyk6nyDey2sJizh9tTIippCYkLdiDuHYzqz/fFHp78/t6yPl5Cjg7p4jKH4buHXuofym Rk3BSpsZ5fj30x7FhNwwNV0k+hxNHs0WKVghx3/R1+8+0YYUygF8Uq/PCqIi6ZV5AG+Rm/lz0H3 N0ZUnxpwJLsVcKwoIozNWtLqlET7W8qMpnIY0cPaqdggF7B5kV207LskdeJjYY72vP2tTNSYAKp MQv7vOKnZUFQmakFZsk4UooxK4yxRtT3ktrT0SRUoV8sdEqLVue3u0LFVL26Xcr2fy5/w9roEqV B+6FEqQMWoqRxUEB4EZckIOH+UZA2P1u5TdKgF3T2+CiW0a1TP/wiXkdBfzOoOaax/MRs= X-Google-Smtp-Source: AGHT+IGmXcU0S1DIAOSz/y67/itjsd2YKozqbxgiJcSS5mKbezUQDAnp/wtLNx9XCfDK/OH1JXxWcQ== X-Received: by 2002:a05:600c:c8c:b0:471:d2f:7987 with SMTP id 5b1f17b1804b1-47904b23c04mr76789345e9.26.1764210209717; Wed, 26 Nov 2025 18:23:29 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790b0e21e8sm71549495e9.15.2025.11.26.18.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 18:23:29 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal , Kieran Bingham Subject: [PATCH v2 12/22] libcamera: software_isp: Move DMA Sync code to Debayer base class Date: Thu, 27 Nov 2025 02:22:44 +0000 Message-ID: <20251127022256.178929-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127022256.178929-1-bryan.odonoghue@linaro.org> References: <20251127022256.178929-1-bryan.odonoghue@linaro.org> 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" We can reuse the DMA Sync code in the GPUISP. Move the code we need to the base class. Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 13 +++++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/debayer_cpu.cpp | 6 +----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index cea30af67..544921656 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -364,4 +364,17 @@ void Debayer::setParams(DebayerParams ¶ms) gammaLut_ = params.gammaLut; } +/** + * \fn void Debayer::dmaSyncBegin(DebayerParams ¶ms) + * \brief Common CPU/GPU Dma Sync Buffer begin + */ +void Debayer::dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output) +{ + 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); +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 6903caae8..d2893d81b 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -20,6 +20,7 @@ #include #include +#include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/software_isp/debayer_params.h" @@ -86,6 +87,7 @@ private: protected: void setParams(DebayerParams ¶ms); + void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 6be5cdbd5..8f1b4e53d 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -22,7 +22,6 @@ #include #include "libcamera/internal/bayer_format.h" -#include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/mapped_framebuffer.h" @@ -752,11 +751,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output bench_.startFrame(); std::vector 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); + dmaSyncBegin(dmaSyncers, input, output); setParams(params);