From patchwork Wed Nov 18 13:15:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 29014 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 C1F52BDE17 for ; Wed, 18 Nov 2026 14:07:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 604126A8FA; Wed, 18 Nov 2026 15:07:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="N5DLmPcG"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 755B66A8C7 for ; Wed, 18 Nov 2026 15:07:23 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-4a5024b3c28so909139f8f.0 for ; Wed, 18 Nov 2026 06:07:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1795010843; x=1795615643; 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=kuKbhBBrKAyp2EoHVRP0b4zpNxPvXXeif5q+6GLLX+4=; b=N5DLmPcGtRu1y6y/X2V1OirPTa9S6JDwxjwPLCh1KDsIbP7lsIVpQbtSVigUcVKgp6 m31IC4Im19+WV3f2RFta7DvGxUCmL/hcK8pImitELu4AYEWhz5CNvEY1bovq4OqB2K80 /yjnHcfbClVKJHw2GIJEjkVNirJM861g57OmR1CD1WS445o3c7imFkfgX7+HSuq62gM+ f0h/9PKusYvq81HqAzRz6S2sLY9AwI20Mw6SJi3Zz9ymuMlddWsEqMUsbtMiGmk1+2RA UTXmD9nMGBhvlV/IX23KuA8vbY9Or6JAjmlBOGwMd61oDvMuTMvI2h6mQecjcAMK/c91 8FXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795010843; x=1795615643; 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=kuKbhBBrKAyp2EoHVRP0b4zpNxPvXXeif5q+6GLLX+4=; b=QZF36airiTJpJmYt/o1fvWd1IkZpKyjmB8hsIWWy6bi+dfAN7Qn8qHaj7+RKfbK2b7 wVfyv6vLvr+YxMfI33YOm6QkrUMVVb3ZeQZmZRcQCFzNA6gsE7I5WIA5stOJZWP1pb1j hP8T0ve3BBMkZqBN3KjBF8S6ain0a9QLV15CUxo/YZByfFHz72fGJa4ooHY58gqQzzd6 va0ooKA04byOUZZgcWUDh/Eefatr+L87w+LHD1AaL/ArqP7ppR8LkEO7mUig17Zt1qhB pGTlRg5R5AdgrLxD9RjXzX9WYufLehubPLWQqCk/CwrEcAw5w6xnp+yxoYxzrYipSV8b Kalg== X-Gm-Message-State: APuU4Z9y2HEkyG7rVJw0zzgVPHdfciBJZoXQtcS/vm+xhA6gZmw1LhEI s+jMtAxt65qPBXE9R28jluDTOC8Y15NkFjfofNIRDWeGLG58NHMY60z+FnUJnTBsdqJ59xFdhZ7 JCbRn X-Gm-Gg: AYBFou0xDi5+7AJsVh9ZtyEXaJiXvWZpzt/zSCPN4S7WS09NT252vCV+TLR8EejI5Gq p0DeBGMNcC+ElWoQyy6xevgq3eSnxZ6XHjJzo6dU5Xryk5ldiRWV8VU2DWeo4FtKuZobQuQ+mRM Co6z7BdHKaUiTsh7Q9ul8sz6dpD2Ib1KUh076ksSDcnxXITK6OwA/jQjkqitHfNSCXsmCmZki/Y AbC+DBQ88IXFkfBwofL3VM5doI343PsJppMly5JkvLaCWEp8X+6/OTngZ/55LdoiD7h5e2hxl31 I+sl2ODzXYrY064pQX6S9H5aHhoLHD9EfCQzhQTl3QIKWAHN6F6wrwL8y89zq8ZF27eN+IcoDw3 vDUOy+PvhjhaLyZctZhKeceZQZVaBvq6kRtyejo4a2KRXjYk0vZakDn0jlUkto/09hCS4PAOhQa Kfmxm66hQaS9RT6g9s67wWqzre3g1igmq+XS+ZG3uekpcCf5ihNkGd/FiXHhrUGF4P8JB2mjQnD flbr7VnDkybavvNcMNyRf0fSP9psZaK1kMQOcS3u/1EKNyoOoqtkA6GV3Ssk7mQ6KxP6UWw83mL Ny+pjFH3/gZJdlWTpcOwhHn12oAV9s3kILvTJW8atOLdwtanQ62QdTtGG/6ptrkDxzjLw5EGBgD DF7MAHFpTKayW6sUVo8bsQX6w6iy9fh+NIZuPje2Leo2KCgeYSrJQsU7SvGcAeJ7VQl4K X-Received: by 2002:a05:600d:82e8:b0:4ba:4928:8aec with SMTP id 5b1f17b1804b1-4bb7da18d83mr47795985e9.9.1795010842797; Wed, 18 Nov 2026 06:07:22 -0800 (PST) Received: from davidp-hailo.pitowers.org ([2a00:1098:3142:1f:2ecf:67ff:fe94:e2e6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb7d29c7b7sm55274085e9.5.2026.11.18.06.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 06:07:22 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH v1 1/3] pipeline: rpi: Pass the raw buffer pixel format to the IPA Date: Wed, 18 Nov 2026 13:15:17 +0000 Message-ID: <20261118140719.46849-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118140719.46849-1-david.plowman@raspberrypi.com> References: <20261118140719.46849-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 Sender: "libcamera-devel" We have to pass both the fourcc and the modifier so that the IPA can reconstruct the PixelFormat faithfully, and we do so whether the raw buffers are internal or external. This is for the benefit of future IPAs that may want to peak at pixel values. 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) {