From patchwork Wed Dec 2 16:13:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 29151 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 8F5FFC3355 for ; Thu, 3 Dec 2026 13:01:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0C2E56AB41; Thu, 3 Dec 2026 14:01:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="rsghiXiz"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0BFC96AB33 for ; Thu, 3 Dec 2026 14:01:18 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4a2153c8525so113387685e9.3 for ; Thu, 03 Dec 2026 05:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1796302877; x=1796907677; 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:content-type; bh=3wQX6+SKohOfCBWWl/8e2O4QIN2hq05aJh/Gri5+oek=; b=rsghiXizVNhCscl5R1adkYkMD1HVAXcT7C9dRZoLzdfs1s+FWZWJIvdXNKwZT8sq+Y yIcfgownuY479ZFAEABeXjJa1xRv5l73uOXsnZgyI6Ua6fHzhWXutCiME6iT7FTFvcPp SokLgLtz90AAZN9KT+OPzWRqOGn8TZmsu6neFZIzMCRiekTs59OwDNwnbbHV4Myjtkn5 XpZYHC/lIWMn9YcPUzgkPmqyycqatJM22YPgu/82zJ92w3Ea6CIprUB6ZZGKstpx/aoa vKHjSZRpnayaiNgG+fSVdFEfp7+DC3g4w6RQ1FAreGEu+0OU6TlonueBJXV3BlrWMuNT gQRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796302877; x=1796907677; 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:content-type; bh=3wQX6+SKohOfCBWWl/8e2O4QIN2hq05aJh/Gri5+oek=; b=wxKFyIleyaVJ3DhnMz0fw8jh5jgOxBmG60ETGLal5bLKqcEfEtXB4TuFN3ZFtSTwL7 7NUZ0F5qK96eVeAEmD+MGQ/uCnudtGp2MAoFOs4vgnP4sDsh5uSJC6ccl6qcvgY7cUMJ 40F4hjY4hMG1T/R1+vBZpckCQoZxkeVXaDj3DbeB+aZdVHXhQkVlo35uzhPhsCuycUAV rLi0VvKqr47ORLFE2ChPe6MmXM4Zt3ZLmUM8spJL4K0DndqG0W4pYz6bbtKOHbdVNp9H pw/1AhzNIvAXeNmECNRfPa1Z+QLxkzKEtYWzrG1uflYtz2W+qsyCqqDZLiKi0H6Vqhcx TC+w== X-Gm-Message-State: APuU4Z8kRr4ujXbyXGMYnOFo3nyQHFo2/wtmvkrwGMHg6ci42btTcA7J qBUjzKKX6olD3gY4wkSprju3xrhaTUqUbUOaTULBOJSeijL2RzY3ks53Ovu5Fm+aiBsX3E2COup hcBiyiGU= X-Gm-Gg: AZFdTZf5eDHOMl2F0aHw4ZlbXFeu0aDaB+0VOlgatbjFZpp8RRXqXE7q6S5NV0TS6Ov pcJZVeDYmRZRtH+xjhvQ/OEpT7KQpafugnS69+NwMjDv3kegQAoXeC/bzHB5r5bnDobUhIsv3lf Z2KgyqRwPyLdCp5K0xlI4uMrnlh6Thowr/qnB5gTI999ggcvg9+sQ8M4UrNbaiOXmvpWOGeouCl XM/1FJDPcTch/43U2IU37xFFNksNcNepw/oyadyCWopMJhTFDKQcQkAWwvwNXOmkQZhjxdtIeyy 5JN9tvf7wutLlU02hottRe+osEBG8bIUpXD7qnCMvIV51TpJdRbYWc5utLPcZVJbS7oyx6K3Rjv PZDzQQiwifZh44/odEtyZHo0qwJuiNh/KCWU4Xu5v8+Is7FUsVjVR+HwOtKduBEb+lLaQiHW4OJ GEmJ7A3LSwNQ3Q1GzBCEJGDsL9LOJxqMksfo65ImS5xH0EDIJcB+EeUt1D0BiymTgOXVj5dDieb 4s6lgdCArxjXKeb6wKBiYT9uYgaeDuEDZWqH8efWttEHfhrCttxbU+r1QroJQ4Rd7JP2BPVeoAd KzbmF1SSSOoePbdbMYA8t/WUJLNaWYDyXbrc/zyFeSnqzK/dFf1S2N63nzimXm8B+qjf0KiKbzI TQ9q01jJisjwLihdo4PbjpC8KZ8abAcgsVyjsm+PtV0PnwZgjnA== X-Received: by 2002:a05:600c:c84:b0:4a8:9a2f:d27 with SMTP id 5b1f17b1804b1-4bb8881f47emr887060485e9.25.1796302877412; Thu, 03 Dec 2026 05:01:17 -0800 (PST) Received: from davidp-hailo10.pitowers.org ([2a00:1098:3142:1f:9afe:54ff:fe21:ed41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe005543esm81555685e9.5.2026.12.03.05.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 05:01:17 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH v1 2/5] ipa: rpi: Pass raw buffer format to the IPA Date: Wed, 2 Dec 2026 16:13:24 +0000 Message-ID: <20261203130113.47873-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261203130113.47873-1-david.plowman@raspberrypi.com> References: <20261203130113.47873-1-david.plowman@raspberrypi.com> 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 IPAs may in general need to behave differently based on the raw pixel format, so we should make this information available. This may be particularly important for the new pipeline "stages", where the IPA side may need to do different things based on what it knows its associated stage may do. Signed-off-by: David Plowman --- include/libcamera/ipa/raspberrypi.mojom | 2 ++ src/ipa/rpi/common/ipa_base.cpp | 1 + src/ipa/rpi/controller/camera_mode.h | 3 +++ .../pipeline/rpi/common/pipeline_base.cpp | 14 ++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 1b7e0358..ed048526 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -37,6 +37,8 @@ struct BufferIds { struct ConfigParams { uint32 transform; + uint32 rawFormat; /* raw buffer PixelFormat fourcc, or zero if unknown */ + uint64 rawFormatModifier; /* raw buffer PixelFormat modifier */ libcamera.ControlInfoMap sensorControls; libcamera.ControlInfoMap ispControls; libcamera.ControlInfoMap lensControls; diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index c2848344..2ed80d3e 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -215,6 +215,7 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa setMode(sensorInfo); mode_.transform = static_cast(params.transform); + mode_.rawFormat = PixelFormat(params.rawFormat, params.rawFormatModifier); /* Pass the camera mode to the CamHelper to setup algorithms. */ helper_->setCameraMode(mode_); diff --git a/src/ipa/rpi/controller/camera_mode.h b/src/ipa/rpi/controller/camera_mode.h index 61162b32..400e5938 100644 --- a/src/ipa/rpi/controller/camera_mode.h +++ b/src/ipa/rpi/controller/camera_mode.h @@ -6,6 +6,7 @@ */ #pragma once +#include #include #include @@ -43,6 +44,8 @@ struct CameraMode { libcamera::utils::Duration maxFrameDuration; /* any camera transform *not* reflected already in the camera tuning */ libcamera::Transform transform; + /* PixelFormat of the raw buffers */ + libcamera::PixelFormat rawFormat; /* minimum and maximum frame lengths in units of lines */ uint32_t minFrameLength; uint32_t maxFrameLength; diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index d6ce2dbf..6944d5c4 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1236,6 +1236,20 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config Transform transform = config->orientation / Orientation::Rotate0; params.transform = static_cast(transform); + /* + * Send the format of the raw Bayer buffers, which should match what's + * set on the frontend device, whether buffers are internal or not. + */ + V4L2DeviceFormat frontendFormat; + ret = frontendDevice()->getFormat(&frontendFormat); + if (ret) { + LOG(RPI, Error) << "Failed to get the frontend format"; + return ret; + } + const PixelFormat rawFormat = frontendFormat.fourcc.toPixelFormat(); + params.rawFormat = rawFormat.fourcc(); + params.rawFormatModifier = rawFormat.modifier(); + /* Ready the IPA - it must know about the sensor resolution. */ ret = ipa_->configure(sensorInfo_, params, result); if (ret < 0) {