From patchwork Tue Apr 22 21:59:10 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: 23230 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 D7D7EC331F for ; Tue, 22 Apr 2025 21:59:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CABA368B4D; Tue, 22 Apr 2025 23:59:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gr9iCbVw"; dkim-atps=neutral Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A86868B38 for ; Tue, 22 Apr 2025 23:59:40 +0200 (CEST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-39ee651e419so3305100f8f.3 for ; Tue, 22 Apr 2025 14:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745359179; x=1745963979; 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=HecQjDX8odq8vh0GEKVOyqoBNzt/soNQ5HnQV1kdZcU=; b=gr9iCbVwfdaLlcIyeb25Saw2HeESwK1JWeA+bzbWiWI6Lmbj/3dARq12tATBNiWcmv 41nvueZVDU2uS1tSaIqPjjja2YdtqfjF91dcyvuShQ295VbzmcGUd6zhrogHS7/TcOIp KfxgXKEMM8SzvLu8bXdWBr1f36kzxdlZYovvE+gb7Yn53G4H6VmmvuoKv6vrM00vZNic OKOfHChE8+dYArjpmptSI9LBm1WsK8/Ghk3b0aw/KKg2Z2QbJa7ipe5KQFSshapnUxHV +5VOTKC7xbMFGs4p0bDQXmIzMGZriz0F8KUtqSlBf5XIxTHvWv6e898YZFDMctdRtheC R4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359179; x=1745963979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HecQjDX8odq8vh0GEKVOyqoBNzt/soNQ5HnQV1kdZcU=; b=MYvuMHQfPeMMYQquxtUpRjOHt/lOe6RCDiURHRdbYw97DsNo52w/lfHKLgU9yoR86E l8DoIwPqBVpNSZdcRwS57sKjXEr0ChxK3JjmibQIWJXkaQ4UnJ+ucKK+t+jjNzXcQ43X Nqa3Gzmd1/j9Y3ISNuqnc92GljYCk8sRUWHHpcmey/r8cue1zvwDlMKkkqu+Vw11/lR/ MptRdTWP7ykqP6uw3kaj6mRPC9R3qGNNtU55nn5B7+MeKlnTdTv9lqK93BkOrsT96aiI yPTXbxtTQeaNJ3lfdMUAWwMjjGpqQ83e5tcFttr3GwVsdMZjVNZehtkqy0JHscqKi79p F4sQ== X-Gm-Message-State: AOJu0YzJYISgyNXi0Zs1bwPYUdUCEh17V+wWPWCmeirhvwQ0nBhOQn2a CvItQzCXs+X4OVpzGBKeM94GJeww9otneTmqOeYhQgFGea69cQdVBfXvbFhtGJ+xFdnmGISUbY4 XqS4= X-Gm-Gg: ASbGncsOiRaT/OywQCgJEhk4XCqTbjKcC7mKsUZvTrUGR1NYonw0V968azbq27gNaK6 Yxa6jziaMKWg2v3mhKFWNXzi9hRV1WSFNGu9ALcNLLNhRL1ojH+7vZnPh2nMzAcZHq2J+Ujm4RO Y+7jzJTjQQFn1Zgh1tro+ESHIl1sKTZq22h+IuOmzqr9wc8oJIhhui7BkVGSGEtAj/7l0UMuR6O bkXHTJuFYkKqspN7Rv0up4aHDpGmDG2BNOJ8QSH/oXrI6/KOkb8XCcSnd3m9sp4NYunlHnIRNxT EwrUrLUCq5+Lrxv16qBW+RUWM4fPlE4RYrFXX3GDgdv0mV0rfLtS803OCzHLD9yTPfwWtDW8aW8 /TeSxKRk4KSq9KxX+54Vg X-Google-Smtp-Source: AGHT+IEGU+TzHtJXKaxOds8dOYgc4To9Q4jKhwW6GsSrwqBYIXW3BQbApvL5/9yNzU8xFMog+gGNiw== X-Received: by 2002:a05:6000:40dc:b0:39e:cbca:922f with SMTP id ffacd0b85a97d-39efba3655cmr11768385f8f.12.1745359179434; Tue, 22 Apr 2025 14:59:39 -0700 (PDT) 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-44092d2eccesm2726615e9.20.2025.04.22.14.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 14:59:38 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org, bod.linux@nxsw.ie Subject: [PATCH 17/27] libcamera: software_isp: Move DMA sync code to common place in Debayer base Date: Tue, 22 Apr 2025 22:59:10 +0100 Message-ID: <20250422215920.4297-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250422215920.4297-1-bryan.odonoghue@linaro.org> References: <20250422215920.4297-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" The DMA Sync code is directly reusable in eGLISP move to the Debayer base class to facilitate reuse. 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 3d883b28..25cfd1a1 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -203,4 +203,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 9cebcbe8..c8ce14f0 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/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); }; diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index baec4799..987f225f 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/mapped_framebuffer.h" @@ -748,11 +747,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);