From patchwork Wed Oct 15 01:22:24 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: 24657 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 7B23FBF415 for ; Wed, 15 Oct 2025 01:23:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E1C9D60632; Wed, 15 Oct 2025 03:23:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Bik/fmAP"; dkim-atps=neutral Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00FEC6061D for ; Wed, 15 Oct 2025 03:23:07 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-63babfdb52cso4419460a12.3 for ; Tue, 14 Oct 2025 18:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760491386; x=1761096186; 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=WKIwKbS/EjWJeU3jpVyRd0DduiSXuAV1yXbTpM8/ki4=; b=Bik/fmAP+HB3nHUoMS7mom/lqWcDIH4lXt/t6SivO+9xhy6+1HHWWdg6P6aEbYSjpZ t8n8GUSMt8rjWXuwaDJ5XJt+JgOTSmvxJFFWMpa2pYGXnWidDoO3sl8eyBFnHDtz/nx4 WOFvG9j5gPTx+xEf4WlsXxDvmwnO432KZWFiCzuuzjhF5FEZE6FaepzDAW2HuY0b3Xkh eTF21ngU8NjybvqAHUpYNs6azcrpWdhztQGi85nAow3qxrOY8SkzhDF00aJIDfLcWxjC xcFNx8/cSPbXGiOzTchbHf5hY6+JXZIHbrzmh7sa4qSxlG9bjyOEBefrJZuj2G2GVVwl fHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760491386; x=1761096186; 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=WKIwKbS/EjWJeU3jpVyRd0DduiSXuAV1yXbTpM8/ki4=; b=WZaAZSgF3eVXd9YlZvljJCLHfcw/82uWAYs6y89gb6j+A/T6YfL8FtV0s4BXSgisOF Hflm4RTKJQ/bzZvBxZYRn5yfXRdBiDAFJVrqltJx9OoHa2YGu4smjNkcnmE0qKrsXpru U2Nbu5IsgWayzoTkJTmkm6csiVmpu7fUjiqH6t8OBkpHbqanv/oEZx/nl7nu+pyoLiWb BtrMhYgFcNIoGp3X4GehiaBA+J94npDt+EoVdQe1pt7huLsmH1kOOGnzpv1qkH6eNedf /IrdIiXyzQo2c/tAn0DRlmQfDJBhUZbKuH9NajzaCz6gcbrcRK5/UWIku1ZT23TSMwaK 0/FA== X-Gm-Message-State: AOJu0YyHXY62fsmgSPeGggAFhUm+dOTD8eWyXGVapPv4l0zaBtzpPuRm vVezHmSCD4vKzwsjeZJAd/YepSJ/+ebHhy1nizpi+vB6qWRavDQSS8wRrCenbnzsHPHnKfH8VVm ZWaGR X-Gm-Gg: ASbGncsCjGT7ubkg4n2tIL0J0ufMFN2tfWAHQ5Zh7UQ9WDZ5sMnj4u7HZ2X7wq+NDr/ ohvzWbdBRtb9hofNSJWCpgF27RL1pQgitbG2KOoqWlPkBUfr40+j25mhnwg44amKwt+VsBPenmN CtCuttNuiTORvGgb7d9vCouhd7hMuxLWV6Z8Gqarf2Yqme/oLZiTVmA8WH5DQm9dV6nAiQyTfth IABUyCO7lBqclrbo7oBqIqKabzDOpZ9q4TCrWXP2a+alxkJVhmH4UH7Ul/NRHnsdBBROn6ufKXg 8HRe7sIt5SvH066bmA1mFvONC5yziBuQIqffkYP0lm2lhd1+FJmjpQWf1lBnhczZqb052jyBNda FwK08gkcYRXvSzOyqwDww734DPukFtF7pQmX7w31MH3nPKeeHiNUm+Px5/rjUmmAfu0zND4fr5Z dmhz7e6f0Iceg1EvwAxMbIg8JLzwIYVg== X-Google-Smtp-Source: AGHT+IENxzjapHIHlyqqztQrZzyYkGp3ZfsjUoIDsLUtcaaZ7se0ufJdtMJkcsnix54aL5YligUDhQ== X-Received: by 2002:a17:906:4789:b0:b3e:f028:2d57 with SMTP id a640c23a62f3a-b50acc3132amr3152829166b.57.1760491386279; Tue, 14 Oct 2025 18:23:06 -0700 (PDT) Received: from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 18:23:05 -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 v3 12/39] libcamera: software_isp: Move DMA Sync code to Debayer base class Date: Wed, 15 Oct 2025 02:22:24 +0100 Message-ID: <20251015012251.17508-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015012251.17508-1-bryan.odonoghue@linaro.org> References: <20251015012251.17508-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 Signed-off-by: Bryan O'Donoghue Reviewed-by: Kieran Bingham --- 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 cf74b92b..847067aa 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -214,4 +214,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 c04c289d..98d88fb3 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" @@ -96,6 +97,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 6be5cdbd..8f1b4e53 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);