From patchwork Fri Nov 20 11:42:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danius Kalvaitis X-Patchwork-Id: 29059 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 AEC57C3355 for ; Fri, 20 Nov 2026 11:43:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2EBF76A946; Fri, 20 Nov 2026 12:43:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=kurokesu.com header.i=@kurokesu.com header.b="WC1e/t7Z"; dkim-atps=neutral Received: from srv2.kurokesu.com (srv2.kurokesu.com [89.47.166.45]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DD2736A931 for ; Fri, 20 Nov 2026 12:42:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by srv2.kurokesu.com (Postfix) with ESMTP id 557887D20; Fri, 20 Nov 2026 13:42:58 +0200 (EET) Authentication-Results: srv2.kurokesu.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=kurokesu.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurokesu.com; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from; s= default; t=1795174977; x=1796989378; bh=9bQgcN7p/H3ez1e0W7w8Q/LX 1puuT+8WAkEKZXiKPYk=; b=WC1e/t7ZRa8bEdDAEK0mxgMdPxV50jDSdzK5lnHo n4L6GvTSG/AbjWts966UvC0sCUHV7eifGQsrYM4YjWQmtwQ8OaETTnI/5iMNHs70 XbFdSbwGv5tWhaDyFAAk0wyuXrnYT8XOAvHgkwbU6wIjQKmEZDkyNWs70tHmepWt tNo= X-Virus-Scanned: Debian amavisd-new at srv2.kurokesu.com Received: from srv2.kurokesu.com ([127.0.0.1]) by localhost (srv2.kurokesu.com [127.0.0.1]) (amavisd-new, port 10026) with LMTP id OO8xqS6qj16f; Fri, 20 Nov 2026 13:42:57 +0200 (EET) Received: from shelfpi.vpn2.kurokesu.com (unknown [84.15.183.117]) (Authenticated sender: danius@kurokesu.com) by srv2.kurokesu.com (Postfix) with ESMTPSA id 7D0CE7D28; Fri, 20 Nov 2026 13:42:57 +0200 (EET) From: Danius Kalvaitis To: libcamera-devel@lists.libcamera.org Cc: naush@raspberrypi.com, david.plowman@raspberrypi.com, laurent.pinchart@ideasonboard.com, jai.luthra@ideasonboard.com, aso.fam429@gmail.com, Danius Kalvaitis Subject: [PATCH 1/2] pipeline: rpi: Pass sensor HDR state to the IPA Date: Fri, 20 Nov 2026 13:42:32 +0200 Message-ID: <20261120114233.86270-2-danius@kurokesu.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261120114233.86270-1-danius@kurokesu.com> References: <20261120114233.86270-1-danius@kurokesu.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" Some sensors switch HDR through V4L2_CID_WIDE_DYNAMIC_RANGE without changing mode size or bit depth. The IPA currently cannot tell such HDR and linear modes apart, although they need different processing, such as decompanding. Read the control at configure time and store its state in CameraMode for camera helpers and control algorithms. Signed-off-by: Danius Kalvaitis --- include/libcamera/ipa/raspberrypi.mojom | 1 + src/ipa/rpi/common/ipa_base.cpp | 1 + src/ipa/rpi/controller/camera_mode.h | 2 ++ src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 1b7e03582..8213bb882 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -37,6 +37,7 @@ struct BufferIds { struct ConfigParams { uint32 transform; + bool sensorHdr; 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 c28483444..319d6bf44 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_.sensorHdr = params.sensorHdr; /* 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 61162b327..5eb05705e 100644 --- a/src/ipa/rpi/controller/camera_mode.h +++ b/src/ipa/rpi/controller/camera_mode.h @@ -56,4 +56,6 @@ struct CameraMode { /* Mode specific analogue gain limits */ double minAnalogueGain; double maxAnalogueGain; + /* sensor HDR state */ + bool sensorHdr; }; diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index d6ce2dbf5..b9347235a 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1236,6 +1236,16 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config Transform transform = config->orientation / Orientation::Rotate0; params.transform = static_cast(transform); + /* + * Sensor HDR may not change mode size or bit depth, so tell the IPA + * if it is enabled. + */ + if (sensor_->controls().count(V4L2_CID_WIDE_DYNAMIC_RANGE)) { + ControlList ctrls = sensor_->getControls({ { V4L2_CID_WIDE_DYNAMIC_RANGE } }); + if (!ctrls.empty()) + params.sensorHdr = ctrls.get(V4L2_CID_WIDE_DYNAMIC_RANGE).get(); + } + /* Ready the IPA - it must know about the sensor resolution. */ ret = ipa_->configure(sensorInfo_, params, result); if (ret < 0) {