From patchwork Wed Nov 18 18:16:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29029 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 AF4F7C3355 for ; Wed, 18 Nov 2026 18:17:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E9306A910; Wed, 18 Nov 2026 19:17:59 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TuXA+7Bk"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CA316A906 for ; Wed, 18 Nov 2026 19:17:58 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 433141D18; Wed, 18 Nov 2026 19:15:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025729; bh=mdjfOOSJJiRGHbBjH7v6nHv8bNidwHfF5C6q6U1iygA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TuXA+7BkM5/nM0de5zFIR/7uz/a1QIssXCxGH+4ljIqF/TV+GWW+MhZUuhRu5fAEl sShkeJS+J17epQzGxWyVJQbjnc4rhluO5cH0s9s2UUT+IYfLj3y9uRM+7+2PBEaf1S Gw8mY4Iwcd+5a7WkWrO8EIkyXEnd+2Flcd9yZNsY= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:51 +0530 Subject: [PATCH v4 1/8] ipa: rpi: Drop unused params argument from platformPrepareIsp() MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-1-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4069; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=mdjfOOSJJiRGHbBjH7v6nHv8bNidwHfF5C6q6U1iygA=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evE7489nVqypnfq9OoQPw3jsi/CchCI9mQqA iUpf8SZgVaJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rxAAKCRBD3pH5JJpx RScEEADTOFWwxm2AyWfsrkG6vLOkwj/NDPGR/AloT53Cy2vx0cfjsvBOiklUKFDYP5ejZxKSH7I i1vvJy7OTmMjiKQll8kNMrDo/BG3QTZgzRxsgzib4M2CV8HOKIM+GlGfwpd8xjyzrGD9LsKr+HY uJoCr9p56wYj3Nq4WMukLi5v0Q69XxTt2ehClxb3K4bUytpucD66qNAxeaw+QUt4mZF6xuDyuvR qGvVihLLFvLeQSoxFlpyDRfcHQ08MaTN/Gv2foZv3V97YwCLe5GS+sa3w3s1GSTIYCfISyXiIWA FjBtDpdOAGyO6xkslSSn7dqEZM/VE73OO+NGfrjX45IusIjwGhB6CNKRWid76G6tXFhsNB3dNYC OpVQxwm1J1tgbwC93jOuAdm5YEG8t68J6FvR1xmlLCUEpwx7i84ji/e0KOJFlRclYrGLzedTd56 fmjsbKC5zm/pvrXprsXvsNIEBzDKnre698xyPOJM2+G1sPfy+lhZTU/1M1C1Js+dgXGplP7AvNR YEHqK1VxvXWXamy0+jt8BA9yP9Ls07aa6ZmvWD3BS+RBLyytNwo56Sbfb1wh6JkJQqCYs/U2iOZ PQxGi0H5V1Lh86TbVW0aL1EKXTK0SOgcbyeXr5xTJ1HZBRlzj4dAc7CocANEoaYnqK4BRy/tyOy WhdDTqFQ++bUHMw== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" In IPABase::platformPrepareIsp() we pass PrepareParams but none of the IPAs (vc4 and pisp) use them. So drop it. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- src/ipa/rpi/common/ipa_base.cpp | 2 +- src/ipa/rpi/common/ipa_base.h | 3 +-- src/ipa/rpi/pisp/pisp.cpp | 6 ++---- src/ipa/rpi/vc4/vc4.cpp | 5 ++--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index c284834440c8..2ee28c9a5005 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -501,7 +501,7 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) if (processPending_) { controller_.prepare(&rpiMetadata); /* Actually prepare the ISP parameters for the frame. */ - platformPrepareIsp(params, rpiMetadata); + platformPrepareIsp(rpiMetadata); platformPrepareAgc(rpiMetadata); } else platformPrepareAgc(rpiMetadata); diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h index 0d7842f1f742..1c375669c9f7 100644 --- a/src/ipa/rpi/common/ipa_base.h +++ b/src/ipa/rpi/common/ipa_base.h @@ -87,8 +87,7 @@ private: virtual int32_t platformStart(const ControlList &controls, StartResult *result) = 0; virtual int32_t platformConfigure(const ConfigParams ¶ms, ConfigResult *result) = 0; - virtual void platformPrepareIsp(const PrepareParams ¶ms, - RPiController::Metadata &rpiMetadata) = 0; + virtual void platformPrepareIsp(RPiController::Metadata &rpiMetadata) = 0; virtual void platformPrepareAgc(RPiController::Metadata &rpiMetadata) = 0; virtual RPiController::StatisticsPtr platformProcessStats(std::span mem) = 0; diff --git a/src/ipa/rpi/pisp/pisp.cpp b/src/ipa/rpi/pisp/pisp.cpp index 835934d57897..ed31867786f6 100644 --- a/src/ipa/rpi/pisp/pisp.cpp +++ b/src/ipa/rpi/pisp/pisp.cpp @@ -232,8 +232,7 @@ private: int32_t platformStart(const ControlList &controls, StartResult *result) override; int32_t platformConfigure(const ConfigParams ¶ms, ConfigResult *result) override; - void platformPrepareIsp(const PrepareParams ¶ms, - RPiController::Metadata &rpiMetadata) override; + void platformPrepareIsp(RPiController::Metadata &rpiMetadata) override; void platformPrepareAgc(RPiController::Metadata &rpiMetadata) override; RPiController::StatisticsPtr platformProcessStats(std::span mem) override; @@ -354,8 +353,7 @@ int32_t IpaPiSP::platformConfigure([[maybe_unused]] const ConfigParams ¶ms, return 0; } -void IpaPiSP::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, - RPiController::Metadata &rpiMetadata) +void IpaPiSP::platformPrepareIsp(RPiController::Metadata &rpiMetadata) { std::scoped_lock l(rpiMetadata); diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp index 122657b2d0a8..298cf8829258 100644 --- a/src/ipa/rpi/vc4/vc4.cpp +++ b/src/ipa/rpi/vc4/vc4.cpp @@ -59,7 +59,7 @@ private: int32_t platformStart(const ControlList &controls, StartResult *result) override; int32_t platformConfigure(const ConfigParams ¶ms, ConfigResult *result) override; - void platformPrepareIsp(const PrepareParams ¶ms, RPiController::Metadata &rpiMetadata) override; + void platformPrepareIsp(RPiController::Metadata &rpiMetadata) override; void platformPrepareAgc([[maybe_unused]] RPiController::Metadata &rpiMetadata) override; RPiController::StatisticsPtr platformProcessStats(std::span mem) override; @@ -144,8 +144,7 @@ int32_t IpaVc4::platformConfigure(const ConfigParams ¶ms, [[maybe_unused]] C return 0; } -void IpaVc4::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, - RPiController::Metadata &rpiMetadata) +void IpaVc4::platformPrepareIsp(RPiController::Metadata &rpiMetadata) { ControlList &ctrls = ctrls_; From patchwork Wed Nov 18 18:16:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29030 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 9B93CC3355 for ; Wed, 18 Nov 2026 18:18:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E54C6A90F; Wed, 18 Nov 2026 19:18:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZChCB6hm"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C8C126A8C7 for ; Wed, 18 Nov 2026 19:18:02 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EF04A34; Wed, 18 Nov 2026 19:15:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025734; bh=n7nWDYcfXkudhwlhtMKwE3ho8nKqHCGIfeLEzFZ6yQU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZChCB6hmklZXhT8AiRHTGCx2AJwGZ+ogSkqPPe3v49+3venjF265NZWEvlu5fZWH/ rY1wjYKgY02cgiosGt/53JTnzOxgVRDyRVz0NOriR0oyuUzkcBJ+HBzyIq30NLSH4y LAhO6TsBQ2I9lbTE9953r9r7uXW1anDmDQSmCb6U= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:52 +0530 Subject: [PATCH v4 2/8] include: uapi: bcm2835-isp: Add extensible parameter buffer interface MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-2-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=9346; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=n7nWDYcfXkudhwlhtMKwE3ho8nKqHCGIfeLEzFZ6yQU=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evF3mEp4A4bDmmIqxTLQZPOpBBbZKUG788gq frH/PqvCv6JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rxQAKCRBD3pH5JJpx Rc8ZD/9E0TAbMWDLZp89e2HGMWH8OYizM3QCuZWJP0G3ayVUt3PnUFGi4a4c+Y+okvyLZ8unyG2 UcifQt8yBBpZtpSfX8PtCVo6HpXayVY3azOSbeABcY+DNRWEiJONOLkwu7j4167juIMhPgzPcKZ h3eCg1eSSU/l45nbOGZYu+MLVu3YDaTQGqN1P5dkTCGOT/MAmATAYnVnpjcmj3z56xUbeQo13S1 X9z8xfFwfKqsIsZxe0Vc/Y0Kb67EUBFv3tqCGfHv/uldzMjopzzk50AQyowo2kEibGA9o5e9zsJ z3wTeRSla/3zogXBh7nAvPY9izrgh3sY/MgpCNOBAq3GKuuqgemVbmFJbbbIsNFkJm4+0rz4BVi jTWwO77styaa6MnadMXHivjbUmOH6OvWgz/sUA/0xe2EMiMi9Gy8hMQ1KG5rwyGFAcdYpOV6qMc O/W58HeVLcu4zM/+fwNIRJy2rhAgR7E2IZETSXYRfMC7D5ABoct6bUGyfuzCgXRJNvf3mF/+0SF tTkRRR+1iz9WzUIWIJ0HE6jX0R7MZ02cMwWdhw+UKwUSJ8sYl/gyeo8PxJLmv5wNPv52hychANc FxwGVMeWpssx2MEqBNhCI6NbqMXVyr0E6KiprPwsa+motZeGhzgu/JknYSTkoaZ7NrpxSeR8K8t 6jxVlopJ3VwHtug== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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 mainline BCM2835 ISP driver expects per-frame configuration via parameter buffers rather than V4L2 controls; keep the legacy control IDs in place for now so libcamera keeps compiling during the switch. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- include/linux/bcm2835-isp.h | 213 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/videodev2.h | 1 + 2 files changed, 214 insertions(+) diff --git a/include/linux/bcm2835-isp.h b/include/linux/bcm2835-isp.h index 5f0f78e3e93f..c49854cfa004 100644 --- a/include/linux/bcm2835-isp.h +++ b/include/linux/bcm2835-isp.h @@ -14,6 +14,7 @@ #define __BCM2835_ISP_H_ #include +#include #define V4L2_CID_USER_BCM2835_ISP_CC_MATRIX \ (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0001) @@ -258,6 +259,218 @@ struct bcm2835_isp_dpc { __u32 strength; }; +/** + * struct bcm2835_isp_awb_gains - AWB gains configuration. + * + * @r_gain: Red channel AWB gain. + * @b_gain: Blue channel AWB gain. + */ +struct bcm2835_isp_awb_gains { + struct bcm2835_isp_rational r_gain; + struct bcm2835_isp_rational b_gain; +}; + +/** + * struct bcm2835_isp_digital_gain - Digital gain configuration. + * + * @gain: Digital gain value. + */ +struct bcm2835_isp_digital_gain { + struct bcm2835_isp_rational gain; +}; + +/* + * BCM2835 ISP extensible parameters buffer definitions. + * + * The extensible parameters mechanism allows userspace to submit ISP + * configuration parameters as a buffer containing a series of tagged + * blocks rather than individual V4L2 controls. This enables atomic + * application of multiple parameters in a single operation. + */ + +/** + * enum bcm2835_isp_param_buffer_version - BCM2835 ISP parameters buffer version + * + * @BCM2835_ISP_PARAM_BUFFER_V1: First version of parameters buffer format + */ +enum bcm2835_isp_param_buffer_version { + BCM2835_ISP_PARAM_BUFFER_V1 = V4L2_ISP_PARAMS_VERSION_V1, +}; + +/** + * enum bcm2835_isp_param_block_type - BCM2835 ISP parameter block types + * + * This enumeration defines the types of parameters blocks that can be + * included in the extensible parameters buffer. Each block type corresponds + * to a specific ISP processing block configuration. + * + * @BCM2835_ISP_PARAM_BLOCK_BLACK_LEVEL: Black level configuration + * @BCM2835_ISP_PARAM_BLOCK_GEQ: Green equalisation configuration + * @BCM2835_ISP_PARAM_BLOCK_GAMMA: Gamma curve configuration + * @BCM2835_ISP_PARAM_BLOCK_DENOISE: Denoise configuration + * @BCM2835_ISP_PARAM_BLOCK_SHARPEN: Sharpening configuration + * @BCM2835_ISP_PARAM_BLOCK_DPC: Defective pixel correction configuration + * @BCM2835_ISP_PARAM_BLOCK_CDN: Colour denoise configuration + * @BCM2835_ISP_PARAM_BLOCK_CC_MATRIX: Colour correction matrix configuration + * @BCM2835_ISP_PARAM_BLOCK_LENS_SHADING: Lens shading table configuration + * @BCM2835_ISP_PARAM_BLOCK_AWB_GAINS: AWB gains configuration + * @BCM2835_ISP_PARAM_BLOCK_DIGITAL_GAIN: Digital gain configuration + */ +enum bcm2835_isp_param_block_type { + BCM2835_ISP_PARAM_BLOCK_BLACK_LEVEL, + BCM2835_ISP_PARAM_BLOCK_GEQ, + BCM2835_ISP_PARAM_BLOCK_GAMMA, + BCM2835_ISP_PARAM_BLOCK_DENOISE, + BCM2835_ISP_PARAM_BLOCK_SHARPEN, + BCM2835_ISP_PARAM_BLOCK_DPC, + BCM2835_ISP_PARAM_BLOCK_CDN, + BCM2835_ISP_PARAM_BLOCK_CC_MATRIX, + BCM2835_ISP_PARAM_BLOCK_LENS_SHADING, + BCM2835_ISP_PARAM_BLOCK_AWB_GAINS, + BCM2835_ISP_PARAM_BLOCK_DIGITAL_GAIN, +}; + +/** + * struct bcm2835_isp_params_black_level - Black level parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_BLACK_LEVEL) + * @black_level: Black level configuration + */ +struct bcm2835_isp_params_black_level { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_black_level black_level; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_geq - Green equalisation parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_GEQ) + * @geq: Green equalisation configuration + */ +struct bcm2835_isp_params_geq { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_geq geq; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_gamma - Gamma parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_GAMMA) + * @gamma: Gamma curve configuration + */ +struct bcm2835_isp_params_gamma { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_gamma gamma; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_denoise - Denoise parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_DENOISE) + * @denoise: Denoise configuration + */ +struct bcm2835_isp_params_denoise { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_denoise denoise; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_sharpen - Sharpen parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_SHARPEN) + * @sharpen: Sharpening configuration + */ +struct bcm2835_isp_params_sharpen { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_sharpen sharpen; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_dpc - Defective pixel correction parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_DPC) + * @dpc: DPC configuration + */ +struct bcm2835_isp_params_dpc { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_dpc dpc; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_cdn - Colour denoise parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_CDN) + * @cdn: Colour denoise configuration + */ +struct bcm2835_isp_params_cdn { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_cdn cdn; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_cc_matrix - Colour correction matrix parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_CC_MATRIX) + * @ccm: Colour correction matrix configuration + */ +struct bcm2835_isp_params_cc_matrix { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_custom_ccm ccm; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_lens_shading - Lens shading parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_LENS_SHADING) + * @ls: Lens shading configuration (includes dmabuf fd for table data) + */ +struct bcm2835_isp_params_lens_shading { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_lens_shading ls; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_awb_gains - AWB gains parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_AWB_GAINS) + * @awb_gains: AWB gains configuration + */ +struct bcm2835_isp_params_awb_gains { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_awb_gains awb_gains; +} __attribute__((aligned(8))); + +/** + * struct bcm2835_isp_params_digital_gain - Digital gain parameters block + * + * @header: Block header (type = BCM2835_ISP_PARAM_BLOCK_DIGITAL_GAIN) + * @digital_gain: Digital gain configuration + */ +struct bcm2835_isp_params_digital_gain { + struct v4l2_isp_params_block_header header; + struct bcm2835_isp_digital_gain digital_gain; +} __attribute__((aligned(8))); + +/** + * define BCM2835_ISP_PARAMS_MAX_SIZE - Maximum size of all ISP parameters + * + * This defines the maximum size needed to accommodate all possible parameter + * blocks in a single buffer. Drivers use this to allocate appropriately + * sized buffers. + */ +#define BCM2835_ISP_PARAMS_MAX_SIZE \ + (sizeof(struct bcm2835_isp_params_black_level) + \ + sizeof(struct bcm2835_isp_params_geq) + \ + sizeof(struct bcm2835_isp_params_gamma) + \ + sizeof(struct bcm2835_isp_params_denoise) + \ + sizeof(struct bcm2835_isp_params_sharpen) + \ + sizeof(struct bcm2835_isp_params_dpc) + \ + sizeof(struct bcm2835_isp_params_cdn) + \ + sizeof(struct bcm2835_isp_params_cc_matrix) + \ + sizeof(struct bcm2835_isp_params_lens_shading) + \ + sizeof(struct bcm2835_isp_params_awb_gains) + \ + sizeof(struct bcm2835_isp_params_digital_gain)) + /* * ISP statistics structures. * diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 8bccad84ff83..60133dcf90f5 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -845,6 +845,7 @@ struct v4l2_pix_format { #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */ #define V4L2_META_FMT_SENSOR_DATA v4l2_fourcc('S', 'E', 'N', 'S') /* Sensor Ancillary metadata */ #define V4L2_META_FMT_BCM2835_ISP_STATS v4l2_fourcc('B', 'S', 'T', 'A') /* BCM2835 ISP image statistics output */ +#define V4L2_META_FMT_BCM2835_ISP_PARAMS v4l2_fourcc('B', 'C', 'M', 'P') /* BCM2835 ISP params */ /* Vendor specific - used for RK_ISP1 camera sub-system */ #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */ From patchwork Wed Nov 18 18:16:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29031 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 9B07BC3355 for ; Wed, 18 Nov 2026 18:18:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 606B66A910; Wed, 18 Nov 2026 19:18:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XmFJApOA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A576A6A8C7 for ; Wed, 18 Nov 2026 19:18:07 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DA04C34; Wed, 18 Nov 2026 19:15:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025739; bh=yAZmujjnWHA1vgbAa6C9cnXwIDAqoMsv/Znf6aEg0Zc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XmFJApOAYDwQDHrr2mJgVjkpSNKuCnlht1gqdPrPIYQ90VVKJi32sz7ZAfmy3nxDa 1Vhw2avsCEN9aW15S6QbymONA0XlGrq33AYuLHLUt2KY48o81XOcUDIK427Er1v97J vZOo90fEy1NMQQnXMQNpUmJwPD1YMIy1t1bTTuts= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:53 +0530 Subject: [PATCH v4 3/8] ipa: rpi: vc4: Add Bcm2835Params helper MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-3-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2656; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=yAZmujjnWHA1vgbAa6C9cnXwIDAqoMsv/Znf6aEg0Zc=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evGMYaimxgJmHkh8rHmfVQtqJVy20C2i8wSI TRu+mvoffKJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rxgAKCRBD3pH5JJpx RRFKD/4/SlQVbmr1xxQ4TT4wo1O/NtisZb+x8PYSl34lxZI620Ot0L/DcPGLKIqRfVtl21U4Cs3 bRPZzL09ycDZri9a6Scl9mFebcxCR0BQp6dbzcz2t9sn2zIy8YEAJf74WK4qF9DqQ7cfx7d6utO EuK2i21A9KTDnfDir4T3+A3f1XGnDgJxV2edYLlpnpGVq5W/I7Sd1KqvYVK15jf2bwq5E3pkeGf +IAbheqXgbQqx4Dazmq5GGQiHSnUsRcWKMMjNJW4J+NvuKeFdWwo8ZQZ2r1t5CeD4Z6FnsfPWbp 4aPRHWiU/xkJp2LqBSJ7W3vSrj5Tg0KWyzXnx3/H/K3HZ9L+13UAhwkhsj37SaLDR7c8mI1bl+x 04p+ILVFFGPs6mVTf3ip2NCtB4srVKPEzYju4J812FaHG+ZBezXHt+JeC5DWVPR9Oz5BvrI/k+P /yT1ZxW4uoKE0zYnUkHK76Gu/ehEQHQpb8rDF/3x+jrFOLuVju8BpxOM9Srcvd011JeaW3gM/mE sknkLyTyCfLvIec3UeUfoSYoX0F0xmSD6dDyMzuePP5MstkeaI2G6Is1EV2mqb8T2gSQwJRaZ3J Cu4uk81MBvkLXMOa12ZV+3MD2xe9y6ImqOD8MUnHWNiBrwluQ+PuhEsOZcQPOYWLJGvSfajzQ+t UdCc8HnZReUSqVA== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" Implement Bcm2835Params to derive from V4L2Params. The mainline driver uses extensible V4L2 parameter for configuration instead of custom V4L2 controls. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- src/ipa/rpi/vc4/params.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/ipa/rpi/vc4/params.h b/src/ipa/rpi/vc4/params.h new file mode 100644 index 000000000000..3eb7794e7c79 --- /dev/null +++ b/src/ipa/rpi/vc4/params.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2026, Ideas On Board + * + * Raspberry Pi VC4/BCM2835 ISP Parameters + */ + +#pragma once + +#include + +#include + +#include + +namespace libcamera { + +namespace ipa::RPi { + +enum class BlockType : uint16_t { + BlackLevel, + Geq, + Gamma, + Denoise, + Sharpen, + Dpc, + Cdn, + CcMatrix, + LensShading, + AwbGains, + DGain, +}; + +namespace details { + +template +struct block_type { +}; + +#define BCM2835_DEFINE_BLOCK_TYPE(id, structName, blockId) \ + template<> \ + struct block_type { \ + using type = struct bcm2835_isp_params_##structName; \ + static constexpr bcm2835_isp_param_block_type blockType = \ + BCM2835_ISP_PARAM_BLOCK_##blockId; \ + }; + +BCM2835_DEFINE_BLOCK_TYPE(BlackLevel, black_level, BLACK_LEVEL) +BCM2835_DEFINE_BLOCK_TYPE(Geq, geq, GEQ) +BCM2835_DEFINE_BLOCK_TYPE(Gamma, gamma, GAMMA) +BCM2835_DEFINE_BLOCK_TYPE(Denoise, denoise, DENOISE) +BCM2835_DEFINE_BLOCK_TYPE(Sharpen, sharpen, SHARPEN) +BCM2835_DEFINE_BLOCK_TYPE(Dpc, dpc, DPC) +BCM2835_DEFINE_BLOCK_TYPE(Cdn, cdn, CDN) +BCM2835_DEFINE_BLOCK_TYPE(CcMatrix, cc_matrix, CC_MATRIX) +BCM2835_DEFINE_BLOCK_TYPE(LensShading, lens_shading, LENS_SHADING) +BCM2835_DEFINE_BLOCK_TYPE(AwbGains, awb_gains, AWB_GAINS) +BCM2835_DEFINE_BLOCK_TYPE(DGain, digital_gain, DIGITAL_GAIN) + +struct params_traits { + using id_type = BlockType; + template + using id_to_details = block_type; +}; + +} /* namespace details */ + +class Bcm2835Params : public V4L2Params +{ +public: + Bcm2835Params(std::span data) : + V4L2Params(data, BCM2835_ISP_PARAM_BUFFER_V1) + { + } +}; + +} /* namespace ipa::RPi */ + +} /* namespace libcamera */ From patchwork Wed Nov 18 18:16:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29032 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 CE372C3355 for ; Wed, 18 Nov 2026 18:18:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7D0D36A918; Wed, 18 Nov 2026 19:18:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tMvgiicA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7477B6A8C7 for ; Wed, 18 Nov 2026 19:18:12 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 933EC34; Wed, 18 Nov 2026 19:15:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025744; bh=zrOcQaNDBrjAZcspdtsp3YwMSGcSU2gDuwqm5/A3S68=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tMvgiicACFrVztsWpFKzflgHnz1ojMyXMtTIJ5Ull7ipv3Qd641YBzycMH4Gvq6tQ +kjHCp1pRdXx04WpoUZIamT4PXupt326hx7gRSBx1M+7JMso/It8YhM53ahQ9jEltS vX/2FVMH0UYwSXthMBWI6iwR0vy1npb/Sb/Zkx+w= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:54 +0530 Subject: [PATCH v4 4/8] ipa: rpi: Allow sharing params buffer to the IPA MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-4-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7108; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=zrOcQaNDBrjAZcspdtsp3YwMSGcSU2gDuwqm5/A3S68=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evHYdWgAjUtI2Q79f2z27po57W3gWEWiDpFA KIXb+YAjMWJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rxwAKCRBD3pH5JJpx RaEWD/0edsSSOsUPfOVgeIthpe/5ZrYmvkSt9o560ly53yrWto99XZwZKpV2hmc0NWF/Yz7b4sp 0eQ+5ycBUyuPkfF0GQ2eT9Crej5odsT5LzFhOPhHww11CKVeHRJGokWmB+5Z9KVq+2BX5X3T5v6 GMqsSop6UHoQ8hxPRabTZhJVkoNn+cDIS9zdvGKqlBpFVmILbOJUcHxgKNZ7w0XbPzOk4qeNfrR h0EFXWH7dcOcFqCRskW8MfRlp6f7YNiMAnl08mRuQwgKZRuEqqIT6Mv71MwDvmBKE8RTe71TYLn RcFF4IOcRz9NWakdlw71rsxhdNm4pyh6kZ8f7mFjW8ionJRINRuzrdjzkUE3tvYUWCmtL/h28FR 1LBF/0sD3AKHOIrwtTxzzTIqYd/Q9fGCgFIwUwPPiBfDmGyUZxQT6HR5MBhRmazgv3HfVxMNH9e FvRa+CGouHY1R5JtJtiCvkIR0d/TQUMH0QO0WaDY3DRGeaCl08DMozGlGnIhQ+yb8c/fiFADvix 4j6Yua8iwHenyI3WjBtxYc24xNTcfueUJ7mbSgWZawW0TppMGnuXlMrpwwqlzFXVULORQY822/h FlOp69oUKsel2dWNLA1g1NLuARxQ8d17phlI+KJky5ks39AXR0DWFWTMOWIHReMl8T828fgQZBp O36A4LvaIGxu+yQ== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" While the VC4 IPA currently writes control values for configuration, the mainline driver expects a parameter buffer. In preparation for the migration, add plumbing to pass the parameter buffer to the IPA, while reporting back how many bytes were filled through the prepareIspComplete() callback. This is unused for now, VC4 will use it in subsequent commits. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- include/libcamera/ipa/raspberrypi.mojom | 6 ++++-- src/ipa/rpi/common/ipa_base.cpp | 11 ++++++++++- src/ipa/rpi/common/ipa_base.h | 4 ++++ src/libcamera/pipeline/rpi/pisp/pisp.cpp | 6 ++++-- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 6 ++++-- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 1b7e03582e0e..84566648d213 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -33,6 +33,7 @@ struct BufferIds { uint32 bayer; uint32 embedded; uint32 stats; + uint32 params; }; struct ConfigParams { @@ -219,15 +220,16 @@ interface IPARPiEventInterface { /** * \fn prepareIspComplete() * \brief Signal completion of \a prepareIsp - * \param[in] buffers Bayer and embedded buffers actioned. + * \param[in] buffers Bayer, embedded and parameter buffers actioned. * \param[in] stitchSwapBuffers Whether the stitch block buffers need to be swapped. + * \param[in] paramsBytesUsed Number of bytes used in the parameter buffer * * This asynchronous event is signalled to the pipeline handler once * the \a prepareIsp signal has completed, and the ISP is ready to start * processing the frame. The embedded data buffer may be recycled after * this event. */ - prepareIspComplete(BufferIds buffers, bool stitchSwapBuffers); + prepareIspComplete(BufferIds buffers, bool stitchSwapBuffers, uint32 paramsBytesUsed); /** * \fn processStatsComplete() diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 2ee28c9a5005..c23d9b28e258 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -418,6 +418,7 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) unsigned int ipaContext = params.ipaContext % rpiMetadata_.size(); RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext]; std::span embeddedBuffer; + std::span paramsBuffer; rpiMetadata.clear(); fillDeviceStatus(params.sensorControls, ipaContext); @@ -441,6 +442,13 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) embeddedBuffer = it->second.planes()[0]; } + if (params.buffers.params) { + auto it = buffers_.find(params.buffers.params); + ASSERT(it != buffers_.end()); + paramsBuffer = it->second.planes()[0]; + platformParamsBufferInit(paramsBuffer); + } + /* * AGC wants to know the algorithm status from the time it actioned the * sensor exposure/gain changes. So fetch it from the metadata list @@ -513,7 +521,8 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) reportMetadata(ipaContext); /* Ready to push the input buffer into the ISP. */ - prepareIspComplete.emit(params.buffers, stitchSwapBuffers_); + prepareIspComplete.emit(params.buffers, stitchSwapBuffers_, + platformParamsBytesUsed()); } void IpaBase::processStats(const ProcessParams ¶ms) diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h index 1c375669c9f7..88773e1ac759 100644 --- a/src/ipa/rpi/common/ipa_base.h +++ b/src/ipa/rpi/common/ipa_base.h @@ -79,6 +79,8 @@ protected: /* Whether the stitch block (if available) needs to swap buffers. */ bool stitchSwapBuffers_; + virtual size_t platformParamsBytesUsed() const { return 0; } + private: /* Number of metadata objects available in the context list. */ static constexpr unsigned int numMetadataContexts = 16; @@ -87,7 +89,9 @@ private: virtual int32_t platformStart(const ControlList &controls, StartResult *result) = 0; virtual int32_t platformConfigure(const ConfigParams ¶ms, ConfigResult *result) = 0; + virtual void platformParamsBufferInit([[maybe_unused]] std::span paramsBuffer) {} virtual void platformPrepareIsp(RPiController::Metadata &rpiMetadata) = 0; + virtual void platformPrepareAgc(RPiController::Metadata &rpiMetadata) = 0; virtual RPiController::StatisticsPtr platformProcessStats(std::span mem) = 0; diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp index 159c6b05ee7b..d0103adbe17c 100644 --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp @@ -759,7 +759,8 @@ public: void beOutputDequeue(FrameBuffer *buffer); void processStatsComplete(const ipa::RPi::BufferIds &buffers); - void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers); + void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers, + unsigned int paramsBytesUsed); void setCameraTimeout(uint32_t maxFrameLengthMs); /* Array of CFE and ISP device streams and associated buffers/streams. */ @@ -1885,7 +1886,8 @@ void PiSPCameraData::setCameraTimeout(uint32_t maxFrameLengthMs) cfe_[Cfe::Output0].dev()->setDequeueTimeout(timeout); } -void PiSPCameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers) +void PiSPCameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers, + [[maybe_unused]] unsigned int paramsBytesUsed) { unsigned int embeddedId = buffers.embedded & RPi::MaskID; unsigned int bayerId = buffers.bayer & RPi::MaskID; diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 200e3b58724a..dca2c1c12549 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -79,7 +79,8 @@ public: void ispOutputDequeue(FrameBuffer *buffer); void processStatsComplete(const ipa::RPi::BufferIds &buffers); - void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers); + void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers, + unsigned int paramsBytesUsed); void setIspControls(const ControlList &controls); void setCameraTimeout(uint32_t maxFrameLengthMs); @@ -863,7 +864,8 @@ void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers) } void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, - [[maybe_unused]] bool stitchSwapBuffers) + [[maybe_unused]] bool stitchSwapBuffers, + [[maybe_unused]] unsigned int paramsBytesUsed) { unsigned int embeddedId = buffers.embedded & RPi::MaskID; unsigned int bayer = buffers.bayer & RPi::MaskID; From patchwork Wed Nov 18 18:16:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29033 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 E6810C3355 for ; Wed, 18 Nov 2026 18:18:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90AFB6A90F; Wed, 18 Nov 2026 19:18:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pXO1mvm6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E2506A8C7 for ; Wed, 18 Nov 2026 19:18:17 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7841634; Wed, 18 Nov 2026 19:15:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025748; bh=15NNvbH0lkt7B55C3dn7mhOO3X47Yko9xcjAVicmhCo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pXO1mvm69ib5QalMdcJiiCOwKFO2t+QcwpWctyWC/SfX9zdZDnnDc330os6zmqWD9 W4i/ByJ3sZagEUJ9XE88/n7v6v1SYp1niLLnJrTQJr9w9wVz8MvhJ1PBdcLBGR+p52 VnCUwgiQc0RF5lrOvuqHBEwo+/89bWYG2x6b4ogE= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:55 +0530 Subject: [PATCH v4 5/8] pipeline: rpi: vc4: Configure format on Unicam subdev MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-5-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7539; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=gyIMq+ogvcArlu0p0zbMP8ot1OQ3hrhyoWzrjmrdeNY=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evIlTZxZxHOIe/xp4bo9cMDwDPl2K8yfiFWB 0ANexaYSn2JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3ryAAKCRBD3pH5JJpx RYX3EACsosKGpMMlFFamBQxL3rwtYyPNuv9ZOTsltQMeVRDhVAHy++ZHhQ8QL8jl8oiinOp7fiV zorVwz1AF/gbHNlJoRoPorHMo4q0QrX6uWJ0YEUD7trI5HP96z9sgI8sKRy8i8EAkmBZZ3+JC/e PjP8+wAHMb2YNPkmXKJ9mGkcZA/3XknA+Bhx2epY38JkKb+zClB+mhDohptWvFWABirg8b3xtXm y3CYXDJpLuck7aa5bMOWGSYLNYFz5vQDI9ZH/U4o3fvPAM4sTKbuGh1HBJoBNwTKJDeB6owKQ4X iINz/vDQkkweN06ygR1h4T0VGg1CmznqY1MRdPJek17VHYSqp79MEDrV6xn/dBbCYG6/1lrw6u0 qjX3u29U6Sp7vetemt637lrKKjvWS37tMtKrUgROpaIM27q4I6eb5McgrcvXB2pfGwEMNrQbll1 PyHQBqzisoIMLtX1LzavlwdElGksYCqUI6P2oeJt/te+9VdLuhH2uPyvSR1K91It0LlQuHq1zJk wuNOUdkyaE6Feu5IL1ocHoaG9zi1yxlteCs5NlCAyHNNQphTtjs0NVef5Lhk7RY8vJ/Obl9h9ej 0h0Z/dDUEjDT81z+1TdwmX6ZNtK6JTWtDcX/o5cwG925CgnVadENhF1zt9QY/lLNYWYoCRF8bSh XHcs5uceC9mCmQQ== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" From: Laurent Pinchart The mainline Unicam driver creates a V4L2 subdevice, which needs to be configured. Create and open a corresponding V4L2Subdevice instance and configure the format on its sink pad in the platformConfigure() function. Presence of the Unicam subdev is required, to avoid extra complexity. This drops support for the driver from the Raspberry Pi downstream kernel. Users are expected to update their kernel to use the mainline Unicam driver. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 100 ++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 9 deletions(-) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index dca2c1c12549..27cd59248451 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -15,6 +15,7 @@ #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/dma_buf_allocator.h" +#include "libcamera/internal/v4l2_subdevice.h" #include "../common/pipeline_base.h" #include "../common/rpi_stream.h" @@ -33,6 +34,10 @@ namespace { enum class Unicam : unsigned int { Image, Embedded }; enum class Isp : unsigned int { Input, Output0, Output1, Stats }; +static constexpr unsigned int kUnicamSinkPad = 0; +static constexpr unsigned int kUnicamSourceImagePad = 1; +static constexpr unsigned int kUnicamSourceMetadataPad = 2; + } /* namespace */ class Vc4CameraData final : public RPi::CameraData @@ -84,6 +89,8 @@ public: void setIspControls(const ControlList &controls); void setCameraTimeout(uint32_t maxFrameLengthMs); + std::unique_ptr unicamSubdev_; + /* Array of Unicam and ISP device streams and associated buffers/streams. */ RPi::Device unicam_; RPi::Device isp_; @@ -204,7 +211,7 @@ bool PipelineHandlerVc4::match(DeviceEnumerator *enumerator) std::unique_ptr cameraData = std::make_unique(this); int ret = RPi::PipelineHandlerBase::registerCamera(cameraData, - unicamDevice, "unicam-image", + unicamDevice, "unicam", ispDevice, entity); if (ret) LOG(RPI, Error) << "Failed to register camera " @@ -316,16 +323,19 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer if (!data->dmaHeap_.isValid()) return -ENOMEM; + MediaEntity *unicamSubdev = unicam->getEntityByName("unicam"); MediaEntity *unicamImage = unicam->getEntityByName("unicam-image"); MediaEntity *ispOutput0 = isp->getEntityByName("bcm2835-isp0-output0"); MediaEntity *ispCapture1 = isp->getEntityByName("bcm2835-isp0-capture1"); MediaEntity *ispCapture2 = isp->getEntityByName("bcm2835-isp0-capture2"); MediaEntity *ispCapture3 = isp->getEntityByName("bcm2835-isp0-capture3"); - if (!unicamImage || !ispOutput0 || !ispCapture1 || !ispCapture2 || !ispCapture3) + if (!unicamSubdev || !unicamImage || !ispOutput0 || !ispCapture1 || + !ispCapture2 || !ispCapture3) return -ENOENT; - /* Locate and open the unicam video streams. */ + /* Create the unicam subdev and video streams. */ + data->unicamSubdev_ = std::make_unique(unicamSubdev); data->unicam_[Unicam::Image] = RPi::Stream("Unicam Image", unicamImage); /* An embedded data node will not be present if the sensor does not support it. */ @@ -364,6 +374,10 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer * The below grouping is just for convenience so that we can easily * iterate over all streams in one go. */ + int ret = data->unicamSubdev_->open(); + if (ret < 0) + return ret; + data->streams_.push_back(&data->unicam_[Unicam::Image]); if (data->sensorMetadata_) data->streams_.push_back(&data->unicam_[Unicam::Embedded]); @@ -372,7 +386,7 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer data->streams_.push_back(&stream); for (auto stream : data->streams_) { - int ret = stream->dev()->open(); + ret = stream->dev()->open(); if (ret) return ret; } @@ -543,9 +557,54 @@ int Vc4CameraData::platformPipelineConfigure(const std::unique_ptr &r int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfig) { + /* + * 1. Configure the Unicam subdev. + * + * Start by setting up routes, and then set the formats on the sink pad + * streams. They will be automatically propagated to the source pads by + * the kernel. + */ + + const V4L2Subdevice::Stream imageStream{ + kUnicamSinkPad, + sensor_->imageStream().stream + }; + const V4L2Subdevice::Stream embeddedDataStream{ + kUnicamSinkPad, + sensor_->embeddedDataStream().value_or(V4L2Subdevice::Stream{}).stream + }; + + V4L2Subdevice::Routing routing; + + routing.emplace_back(imageStream, V4L2Subdevice::Stream{ kUnicamSourceImagePad, 0 }, + V4L2_SUBDEV_ROUTE_FL_ACTIVE); + + if (sensorMetadata_) + routing.emplace_back(embeddedDataStream, + V4L2Subdevice::Stream{ kUnicamSourceMetadataPad, 0 }, + V4L2_SUBDEV_ROUTE_FL_ACTIVE); + + int ret = unicamSubdev_->setRouting(&routing); + if (ret) + return ret; + + V4L2SubdeviceFormat subdevFormat = rpiConfig->sensorFormat_; + ret = unicamSubdev_->setFormat(imageStream, &subdevFormat); + if (ret) + return ret; + + if (sensorMetadata_) { + subdevFormat = sensor_->embeddedDataFormat(); + ret = unicamSubdev_->setFormat(embeddedDataStream, &subdevFormat); + if (ret) + return ret; + } + + /* + * 2. Configure the Unicam video devices. + */ const std::vector &rawStreams = rpiConfig->rawStreams_; const std::vector &outStreams = rpiConfig->outStreams_; - int ret; V4L2VideoDevice *unicam = unicam_[Unicam::Image].dev(); V4L2DeviceFormat unicamFormat; @@ -569,14 +628,37 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi if (ret) return ret; - ret = isp_[Isp::Input].dev()->setFormat(&unicamFormat); - if (ret) - return ret; - LOG(RPI, Info) << "Sensor: " << sensor_->id() << " - Selected sensor format: " << rpiConfig->sensorFormat_ << " - Selected unicam format: " << unicamFormat; + /* + * Configure the Unicam embedded data output format only if the sensor + * supports it. + */ + if (sensorMetadata_) { + V4L2SubdeviceFormat embeddedFormat = sensor_->embeddedDataFormat(); + V4L2DeviceFormat format{}; + format.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA); + format.planes[0].size = embeddedFormat.size.width * embeddedFormat.size.height; + + LOG(RPI, Debug) << "Setting embedded data format " << format; + ret = unicam_[Unicam::Embedded].dev()->setFormat(&format); + if (ret) { + LOG(RPI, Error) << "Failed to set format on Unicam embedded: " + << format; + return ret; + } + } + + /* + * 3. Configure the ISP. + */ + + ret = isp_[Isp::Input].dev()->setFormat(&unicamFormat); + if (ret) + return ret; + /* Use a sensible small default size if no output streams are configured. */ Size maxSize = outStreams.empty() ? Size(320, 240) : outStreams[0].cfg->size; V4L2DeviceFormat format; From patchwork Wed Nov 18 18:16:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29034 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 C87CCC3355 for ; Wed, 18 Nov 2026 18:18:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E6E76A910; Wed, 18 Nov 2026 19:18:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Gcw30CfG"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D34B46A8C7 for ; Wed, 18 Nov 2026 19:18:21 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E04934; Wed, 18 Nov 2026 19:15:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025753; bh=YpKWKw/mkvhPKfkAY3Hr2PH0M29cPzh13C5WN3pTxn4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Gcw30CfGrc3fp8ytxZR9ZrU8ghCaRrGRj3hdotxuFFArmJpItaBEIp8esV6us8hx/ 9hwIGbo1mo5DyH6RHNnmJpT9F34rP1jc7L29SyaEPBduj3rSEYGKPW1WE/rB6VUVFY F0DTy5iKL2HfRzr3aFDJUGLTf91GjdskYY2LYVYI= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:56 +0530 Subject: [PATCH v4 6/8] pipeline: rpi: vc4: Switch to mainline media topology for bcm2835-isp MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-6-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6750; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=YpKWKw/mkvhPKfkAY3Hr2PH0M29cPzh13C5WN3pTxn4=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evJPGWKTn/gA/ti4P5yhmC6CwL9HR9odBDSH n7KkupqFTOJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3ryQAKCRBD3pH5JJpx RXg3D/4/VqgJFyCIIngs7OlnHZgtg5vvk+g9YhWGunU1irt6WXEToBpmXSmTU1N/qCwvhj0hVVs IZGZMO5PGOBzdqhYI/E1UT7FNPIBNXmN1IFEtUZu3hT+9czZtHHTHn0QY8/idJ3u3r22qt1mSa4 s7RCUUV10QWA8Tbuke6PE5BOnvdjeApAQ66EpPrHEpmqoc78fOv8Aqx9QgD97juPeTLoSrNGxQ6 Igmf/7ARJTZXPEMIf19elFfJvbs8eMr2jkoHbwKrcB6zcq8QbmLC19FEdc8bOxEbNsugpCiqOZ8 o9AM/vQYHY1gNXzI+8wJVD6e7YqpUjkIDwXM8XcKhkHzXfREfyPWsR+N4it9pHH5f9FdsXppqkJ hIPaKNMejSA1nKblB1xwVD2BdTqVjHfpKk9kfvzicPzKoX6lFOqe9wWDQcP3xEOxnAo3nm3dZcw Fz4LrI0IWc47gusEk+Gfh80wwkRg+XxMx95a6RusEamZp9orFJYtaMJAMLkU216c3oa5JtxHAsw xgH1Ooyp2PJRItoUAfJ6qjqiYcLS0Ade+LipFHVIMeVKpBT+rXYVRn9fIEd0d//7TXaLvZWsCuQ qf5r3+rUqa9uogYoATu7PkOxa/LkspxRIli7KjgzvAdTSjaMjL3hivz+BJQQmvY/CXChIWPoMnK qjrvIZa1sAfcJbw== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" Switch from the downstream driver's video node naming scheme of bcm2835-isp0-output0,capture1..3 to the mainline scheme of bcm2835-isp-output0,capture0..1,stats2. Users are expected to update their kernel to use the mainline VC4 driver. For now we only initialize the new bcm2835-isp-params video node. Filling and queueing buffers to the node will be handled in a subsequent commit. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- src/libcamera/pipeline/rpi/common/rpi_stream.h | 1 + src/libcamera/pipeline/rpi/vc4/vc4.cpp | 49 +++++++++++++++++++------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h index 300a352a7d39..cc18dcc8fa8d 100644 --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h @@ -30,6 +30,7 @@ enum BufferMask { MaskStats = 0x010000, MaskEmbeddedData = 0x020000, MaskBayerData = 0x040000, + MaskParams = 0x080000, }; struct BufferObject { diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 27cd59248451..d242157d58c5 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -32,7 +32,7 @@ using StreamParams = RPi::RPiCameraConfiguration::StreamParams; namespace { enum class Unicam : unsigned int { Image, Embedded }; -enum class Isp : unsigned int { Input, Output0, Output1, Stats }; +enum class Isp : unsigned int { Input, Output0, Output1, Stats, Params }; static constexpr unsigned int kUnicamSinkPad = 0; static constexpr unsigned int kUnicamSourceImagePad = 1; @@ -93,7 +93,7 @@ public: /* Array of Unicam and ISP device streams and associated buffers/streams. */ RPi::Device unicam_; - RPi::Device isp_; + RPi::Device isp_; /* DMAHEAP allocation helper. */ DmaBufAllocator dmaHeap_; @@ -267,6 +267,13 @@ int PipelineHandlerVc4::allocateBuffers(Camera *camera) std::max(data->config_.minUnicamBuffers, minBuffers - numRawBuffers); + } else if (stream == &data->isp_[Isp::Params]) { + /* + * Parameter buffers are dequeued immediately after + * sending the commands to VC4 firmware. Ideally, 1 + * buffer would be sufficient, but allot 2 to be safe. + */ + numBuffers = 2; } else if (stream == &data->unicam_[Unicam::Embedded]) { /* * Embedded data buffers are (currently) for internal use, and @@ -303,10 +310,11 @@ int PipelineHandlerVc4::allocateBuffers(Camera *camera) } /* - * Pass the stats and embedded data buffers to the IPA. No other - * buffers need to be passed. + * Pass the stats, embedded data and parameter buffers to the IPA. No + * other buffers need to be passed. */ mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPi::MaskStats); + mapBuffers(camera, data->isp_[Isp::Params].getBuffers(), RPi::MaskParams); if (data->sensorMetadata_) mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), RPi::MaskEmbeddedData); @@ -325,13 +333,14 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer MediaEntity *unicamSubdev = unicam->getEntityByName("unicam"); MediaEntity *unicamImage = unicam->getEntityByName("unicam-image"); - MediaEntity *ispOutput0 = isp->getEntityByName("bcm2835-isp0-output0"); - MediaEntity *ispCapture1 = isp->getEntityByName("bcm2835-isp0-capture1"); - MediaEntity *ispCapture2 = isp->getEntityByName("bcm2835-isp0-capture2"); - MediaEntity *ispCapture3 = isp->getEntityByName("bcm2835-isp0-capture3"); + MediaEntity *ispOutput0 = isp->getEntityByName("bcm2835-isp-output0"); + MediaEntity *ispCapture0 = isp->getEntityByName("bcm2835-isp-capture0"); + MediaEntity *ispCapture1 = isp->getEntityByName("bcm2835-isp-capture1"); + MediaEntity *ispStats = isp->getEntityByName("bcm2835-isp-stats2"); + MediaEntity *ispParams = isp->getEntityByName("bcm2835-isp-params"); - if (!unicamSubdev || !unicamImage || !ispOutput0 || !ispCapture1 || - !ispCapture2 || !ispCapture3) + if (!unicamSubdev || !unicamImage || !ispOutput0 || !ispCapture0 || + !ispCapture1 || !ispStats || !ispParams) return -ENOENT; /* Create the unicam subdev and video streams. */ @@ -348,9 +357,12 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer /* Tag the ISP input stream as an import stream. */ data->isp_[Isp::Input] = RPi::Stream("ISP Input", ispOutput0, StreamFlag::ImportOnly); - data->isp_[Isp::Output0] = RPi::Stream("ISP Output0", ispCapture1); - data->isp_[Isp::Output1] = RPi::Stream("ISP Output1", ispCapture2); - data->isp_[Isp::Stats] = RPi::Stream("ISP Stats", ispCapture3); + data->isp_[Isp::Output0] = RPi::Stream("ISP Output0", ispCapture0); + data->isp_[Isp::Output1] = RPi::Stream("ISP Output1", ispCapture1); + data->isp_[Isp::Stats] = RPi::Stream("ISP Stats", ispStats); + /* Tag the ISP params stream as MMAP (for writing into it in the IPA) and recurrent. */ + data->isp_[Isp::Params] = RPi::Stream("ISP Params", ispParams, + StreamFlag::RequiresMmap | StreamFlag::Recurrent); /* Wire up all the buffer connections. */ data->unicam_[Unicam::Image].dev()->bufferReady.connect(data, &Vc4CameraData::unicamBufferDequeue); @@ -358,6 +370,7 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer data->isp_[Isp::Output0].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue); data->isp_[Isp::Output1].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue); data->isp_[Isp::Stats].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue); + data->isp_[Isp::Params].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue); if (data->sensorMetadata_ ^ !!data->unicam_[Unicam::Embedded].dev()) { LOG(RPI, Warning) << "Mismatch between Unicam and CamHelper for embedded data usage!"; @@ -758,6 +771,16 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi return ret; } + /* ISP parameters input format. */ + format = {}; + format.fourcc = V4L2PixelFormat(V4L2_META_FMT_BCM2835_ISP_PARAMS); + ret = isp_[Isp::Params].dev()->setFormat(&format); + if (ret) { + LOG(RPI, Error) << "Failed to set format on ISP params stream: " + << format; + return ret; + } + /* * Configure the Unicam embedded data output format only if the sensor * supports it. From patchwork Wed Nov 18 18:16:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29035 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 795E0C3355 for ; Wed, 18 Nov 2026 18:18:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3B0CA6A92A; Wed, 18 Nov 2026 19:18:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tx+Scqvc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F61B6A8C7 for ; Wed, 18 Nov 2026 19:18:27 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1412134; Wed, 18 Nov 2026 19:15:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025758; bh=Ggm65Vh0rvaxP9GuOm5chK2Vs2dlXY2hzzGAjU0f9So=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tx+ScqvcTlM1lR3IzqwJMwycbF+C60B4r4iJ/H2agm7Iks3SJ2q64voezrla0XEmA eTjSmOFKCPnBwc/RUaLx3bVtoBfwp2cxHJ4fjolgBsLS2ebczXn5Jgzlr+BbiogY1e 2fQZWw3TeUrEW0ZYl6miDWxWjylnqeb59YWXUcbM= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:57 +0530 Subject: [PATCH v4 7/8] pipeline/ipa: rpi: vc4: Switch configuration from controls to param buffer MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-7-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=25042; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=Ggm65Vh0rvaxP9GuOm5chK2Vs2dlXY2hzzGAjU0f9So=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evKVgV2DzDtZFt/pPLC0f+DmQsxU3Tc8J/jf MicY5u+dP2JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rygAKCRBD3pH5JJpx RYrsD/9L+ZbGldKp4ty3rE/COiJlPzqqj/BTlrAmdwaPnIOGaSfGS6oa3w0QyvkA3hKndtZBveS v/gNGpOwh/S7oIvIP8B3qHZXJkhrrawwWDjhq8Vb8uHTYV3VKRDkmDxGwcX6EF/03Z5kqGgYn9o xXgVf3mOaoc6SY+SkGL5sr1Efk2hIis3Jdy76nu48u+WQ73qtgrZf3fL/HtLcyNpPYwUTgVUkV/ nKDAgrqMVu0UtAamWSepOxb2VTC75apfQRVXeSO5JhLTOpgj6zWog83cQDmfJxWF79Q1k8PPJsL ByrgQ0fRsJa3NqMn/oU/Ht/hDfsTyI199JWuaIm2mFSIrGVCE03HCoVYoxtHfWt1EyX9PO9R46o 0H5oHKg8bB4mjple2+YVydRnRtMqy1isQYzxC3bKJ80aYn+Km3RwWwoczE72BifgXDKhZ1kqZie yWCyL7QZmaLJtgWpcSDRDpSSHpGHhvKrDDD2mik5K3nXczRdGGxEwyaKHVqgN6TULez0GqfmfUH jvPRFKo097jb8OH1XP0BjL7tYd8fpXxA0bJrBTYK96tdVpu9sHMk+9JLIcNz9/U4xnFURYNBraH BtYsbHWN9oyTMdcKcu6S+wjKHw1TzY7SwejV7p6pgqvDc0d+Gi3TqLKr5J8GnPRLb9MfXxKbZTi hBi5CxfGSKTQ6Ow== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" Let each algorithm write directly into typed parameter blocks using the Bcm2835Params helper. Acquire a parameter buffer in tryRunPipeline(), pass it to the IPA through BufferIds::params, and queue it back to the ISP once the IPA reports how many bytes it filled. Also patch the lens-shading dmabuf fd in the params buffer, similar to what setIspControls() did before. Finally, drop the dead-code that was used to configure the custom V4L2 controls for ISP configuration. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- include/libcamera/ipa/raspberrypi.mojom | 12 -- src/ipa/rpi/vc4/vc4.cpp | 215 ++++++++++++++------------------ src/libcamera/pipeline/rpi/vc4/vc4.cpp | 87 +++++++++---- 3 files changed, 156 insertions(+), 158 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 84566648d213..255811fd6302 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -39,7 +39,6 @@ struct BufferIds { struct ConfigParams { uint32 transform; libcamera.ControlInfoMap sensorControls; - libcamera.ControlInfoMap ispControls; libcamera.ControlInfoMap lensControls; /* VC4 specific */ libcamera.SharedFD lsTableHandle; @@ -254,17 +253,6 @@ interface IPARPiEventInterface { */ metadataReady(libcamera.ControlList metadata); - /** - * \fn setIspControls() - * \brief Signal ISP controls to be applied. - * \param[in] controls List of controls to be applied. - * - * This asynchronous event is signalled to the pipeline handler during - * the \a prepareISP signal after all algorithms have been run and the - * IPA requires ISP controls to be applied for the frame. - */ - setIspControls(libcamera.ControlList controls); - /** * \fn setDelayedControls() * \brief Signal Sensor controls to be applied. diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp index 298cf8829258..e1075235f663 100644 --- a/src/ipa/rpi/vc4/vc4.cpp +++ b/src/ipa/rpi/vc4/vc4.cpp @@ -5,6 +5,7 @@ * Raspberry Pi VC4/BCM2835 ISP IPA. */ +#include #include #include #include @@ -30,6 +31,7 @@ #include "controller/lux_status.h" #include "controller/noise_status.h" #include "controller/sharpen_status.h" +#include "params.h" namespace libcamera { @@ -59,34 +61,38 @@ private: int32_t platformStart(const ControlList &controls, StartResult *result) override; int32_t platformConfigure(const ConfigParams ¶ms, ConfigResult *result) override; + void platformParamsBufferInit(std::span paramsBuffer) override; void platformPrepareIsp(RPiController::Metadata &rpiMetadata) override; void platformPrepareAgc([[maybe_unused]] RPiController::Metadata &rpiMetadata) override; RPiController::StatisticsPtr platformProcessStats(std::span mem) override; void handleControls(const ControlList &controls) override; - bool validateIspControls(); - void applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls); - void applyDG(double digitalGain, const struct AwbStatus *awbStatus, ControlList &ctrls); - void applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls); - void applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, ControlList &ctrls); - void applyGamma(const struct ContrastStatus *contrastStatus, ControlList &ctrls); - void applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls); - void applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList &ctrls); - void applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls); - void applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls); - void applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls); + void applyAWB(const struct AwbStatus *awbStatus, Bcm2835Params ¶ms); + void applyDG(double digitalGain, const struct AwbStatus *awbStatus, Bcm2835Params ¶ms); + void applyCCM(const struct CcmStatus *ccmStatus, Bcm2835Params ¶ms); + void applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, Bcm2835Params ¶ms); + void applyGamma(const struct ContrastStatus *contrastStatus, Bcm2835Params ¶ms); + void applyGEQ(const struct GeqStatus *geqStatus, Bcm2835Params ¶ms); + void applyDenoise(const struct DenoiseStatus *denoiseStatus, Bcm2835Params ¶ms); + void applySharpen(const struct SharpenStatus *sharpenStatus, Bcm2835Params ¶ms); + void applyDPC(const struct DpcStatus *dpcStatus, Bcm2835Params ¶ms); + void applyLS(const struct AlscStatus *lsStatus, Bcm2835Params ¶ms); void applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls); void resampleTable(uint16_t dest[], const std::vector &src, int destW, int destH); - /* VC4 ISP controls. */ - ControlInfoMap ispCtrls_; - ControlList ctrls_; + size_t platformParamsBytesUsed() const override + { + return (ispParams_.has_value()) ? ispParams_->bytesused() : 0; + } /* LS table allocation passed in from the pipeline handler. */ SharedFD lsTableHandle_; void *lsTable_; + /* Params buffer for the current frame. */ + std::optional ispParams_; + /* Remember the most recent AWB values. */ AwbStatus lastAwbStatus_; }; @@ -113,13 +119,6 @@ int32_t IpaVc4::platformStart([[maybe_unused]] const ControlList &controls, int32_t IpaVc4::platformConfigure(const ConfigParams ¶ms, [[maybe_unused]] ConfigResult *result) { - ispCtrls_ = params.ispControls; - ctrls_ = ControlList(ispCtrls_); - if (!validateIspControls()) { - LOG(IPARPI, Error) << "ISP control validation failed."; - return -1; - } - /* Store the lens shading table pointer and handle if available. */ if (params.lsTableHandle.isValid()) { /* Remove any previous table, if there was one. */ @@ -144,50 +143,54 @@ int32_t IpaVc4::platformConfigure(const ConfigParams ¶ms, [[maybe_unused]] C return 0; } +void IpaVc4::platformParamsBufferInit(std::span paramsBuffer) +{ + /* Initialize the extensible parameter buffer */ + ispParams_.emplace(paramsBuffer); +} + void IpaVc4::platformPrepareIsp(RPiController::Metadata &rpiMetadata) { - ControlList &ctrls = ctrls_; - /* Lock the metadata buffer to avoid constant locks/unlocks. */ std::unique_lock lock(rpiMetadata); AwbStatus *awbStatus = rpiMetadata.getLocked("awb.status"); if (awbStatus) { - applyAWB(awbStatus, ctrls); + applyAWB(awbStatus, *ispParams_); lastAwbStatus_ = *awbStatus; } CcmStatus *ccmStatus = rpiMetadata.getLocked("ccm.status"); if (ccmStatus) - applyCCM(ccmStatus, ctrls); + applyCCM(ccmStatus, *ispParams_); AlscStatus *lsStatus = rpiMetadata.getLocked("alsc.status"); if (lsStatus) - applyLS(lsStatus, ctrls); + applyLS(lsStatus, *ispParams_); ContrastStatus *contrastStatus = rpiMetadata.getLocked("contrast.status"); if (contrastStatus) - applyGamma(contrastStatus, ctrls); + applyGamma(contrastStatus, *ispParams_); BlackLevelStatus *blackLevelStatus = rpiMetadata.getLocked("black_level.status"); if (blackLevelStatus) - applyBlackLevel(blackLevelStatus, ctrls); + applyBlackLevel(blackLevelStatus, *ispParams_); GeqStatus *geqStatus = rpiMetadata.getLocked("geq.status"); if (geqStatus) - applyGEQ(geqStatus, ctrls); + applyGEQ(geqStatus, *ispParams_); DenoiseStatus *denoiseStatus = rpiMetadata.getLocked("denoise.status"); if (denoiseStatus) - applyDenoise(denoiseStatus, ctrls); + applyDenoise(denoiseStatus, *ispParams_); SharpenStatus *sharpenStatus = rpiMetadata.getLocked("sharpen.status"); if (sharpenStatus) - applySharpen(sharpenStatus, ctrls); + applySharpen(sharpenStatus, *ispParams_); DpcStatus *dpcStatus = rpiMetadata.getLocked("dpc.status"); if (dpcStatus) - applyDPC(dpcStatus, ctrls); + applyDPC(dpcStatus, *ispParams_); const AfStatus *afStatus = rpiMetadata.getLocked("af.status"); if (afStatus) { @@ -204,10 +207,7 @@ void IpaVc4::platformPrepareAgc(RPiController::Metadata &rpiMetadata) double digitalGain = delayedAgcStatus ? delayedAgcStatus->digitalGain : agcStatus_.digitalGain; AwbStatus *awbStatus = rpiMetadata.getLocked("awb.status"); - applyDG(digitalGain, awbStatus, ctrls_); - - setIspControls.emit(ctrls_); - ctrls_ = ControlList(ispCtrls_); + applyDG(digitalGain, awbStatus, *ispParams_); } RPiController::StatisticsPtr IpaVc4::platformProcessStats(std::span mem) @@ -324,48 +324,26 @@ void IpaVc4::handleControls(const ControlList &controls) } } -bool IpaVc4::validateIspControls() +void IpaVc4::applyAWB(const struct AwbStatus *awbStatus, Bcm2835Params ¶ms) { - static const uint32_t ctrls[] = { - V4L2_CID_RED_BALANCE, - V4L2_CID_BLUE_BALANCE, - V4L2_CID_DIGITAL_GAIN, - V4L2_CID_USER_BCM2835_ISP_CC_MATRIX, - V4L2_CID_USER_BCM2835_ISP_GAMMA, - V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL, - V4L2_CID_USER_BCM2835_ISP_GEQ, - V4L2_CID_USER_BCM2835_ISP_DENOISE, - V4L2_CID_USER_BCM2835_ISP_SHARPEN, - V4L2_CID_USER_BCM2835_ISP_DPC, - V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, - V4L2_CID_USER_BCM2835_ISP_CDN, - }; + auto block = params.block(); - for (auto c : ctrls) { - if (ispCtrls_.find(c) == ispCtrls_.end()) { - LOG(IPARPI, Error) << "Unable to find ISP control " - << utils::hex(c); - return false; - } - } - - return true; -} - -void IpaVc4::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls) -{ LOG(IPARPI, Debug) << "Applying WB R: " << awbStatus->gainR << " B: " << awbStatus->gainB; - ctrls.set(V4L2_CID_RED_BALANCE, - static_cast(awbStatus->gainR * 1000)); - ctrls.set(V4L2_CID_BLUE_BALANCE, - static_cast(awbStatus->gainB * 1000)); + block->awb_gains.r_gain.num = static_cast(awbStatus->gainR * 1000); + block->awb_gains.r_gain.den = 1000; + block->awb_gains.b_gain.num = static_cast(awbStatus->gainB * 1000); + block->awb_gains.b_gain.den = 1000; + + block.setEnabled(true); } void IpaVc4::applyDG(double digitalGain, - const struct AwbStatus *awbStatus, ControlList &ctrls) + const struct AwbStatus *awbStatus, Bcm2835Params ¶ms) { + auto block = params.block(); + if (awbStatus) { /* * We must apply sufficient extra digital gain to stop any of the channel gains being @@ -379,13 +357,16 @@ void IpaVc4::applyDG(double digitalGain, digitalGain *= extraGain; } - ctrls.set(V4L2_CID_DIGITAL_GAIN, - static_cast(digitalGain * 1000)); + block->digital_gain.gain.num = static_cast(digitalGain * 1000); + block->digital_gain.gain.den = 1000; + + block.setEnabled(true); } -void IpaVc4::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls) +void IpaVc4::applyCCM(const struct CcmStatus *ccmStatus, Bcm2835Params ¶ms) { - bcm2835_isp_custom_ccm ccm; + auto block = params.block(); + bcm2835_isp_custom_ccm &ccm = block->ccm; for (int i = 0; i < 9; i++) { ccm.ccm.ccm[i / 3][i % 3].den = 1000; @@ -395,29 +376,29 @@ void IpaVc4::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls) ccm.enabled = 1; ccm.ccm.offsets[0] = ccm.ccm.offsets[1] = ccm.ccm.offsets[2] = 0; - ControlValue c(std::span{ reinterpret_cast(&ccm), - sizeof(ccm) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_CC_MATRIX, c); + block.setEnabled(true); } -void IpaVc4::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, ControlList &ctrls) +void IpaVc4::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, + Bcm2835Params ¶ms) { - bcm2835_isp_black_level blackLevel; + auto block = params.block(); + bcm2835_isp_black_level &blackLevel = block->black_level; blackLevel.enabled = 1; blackLevel.black_level_r = blackLevelStatus->blackLevelR; blackLevel.black_level_g = blackLevelStatus->blackLevelG; blackLevel.black_level_b = blackLevelStatus->blackLevelB; - ControlValue c(std::span{ reinterpret_cast(&blackLevel), - sizeof(blackLevel) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL, c); + block.setEnabled(true); } -void IpaVc4::applyGamma(const struct ContrastStatus *contrastStatus, ControlList &ctrls) +void IpaVc4::applyGamma(const struct ContrastStatus *contrastStatus, + Bcm2835Params ¶ms) { const unsigned int numGammaPoints = controller_.getHardwareConfig().numGammaPoints; - struct bcm2835_isp_gamma gamma; + auto block = params.block(); + struct bcm2835_isp_gamma &gamma = block->gamma; for (unsigned int i = 0; i < numGammaPoints - 1; i++) { int x = i < 16 ? i * 1024 @@ -431,30 +412,28 @@ void IpaVc4::applyGamma(const struct ContrastStatus *contrastStatus, ControlList gamma.y[numGammaPoints - 1] = 65535; gamma.enabled = 1; - ControlValue c(std::span{ reinterpret_cast(&gamma), - sizeof(gamma) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_GAMMA, c); + block.setEnabled(true); } -void IpaVc4::applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls) +void IpaVc4::applyGEQ(const struct GeqStatus *geqStatus, Bcm2835Params ¶ms) { - bcm2835_isp_geq geq; + auto block = params.block(); + bcm2835_isp_geq &geq = block->geq; geq.enabled = 1; geq.offset = geqStatus->offset; geq.slope.den = 1000; geq.slope.num = 1000 * geqStatus->slope; - ControlValue c(std::span{ reinterpret_cast(&geq), - sizeof(geq) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_GEQ, c); + block.setEnabled(true); } -void IpaVc4::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList &ctrls) +void IpaVc4::applyDenoise(const struct DenoiseStatus *denoiseStatus, Bcm2835Params ¶ms) { + auto blockDenoise = params.block(); using RPiController::DenoiseMode; - bcm2835_isp_denoise denoise; + bcm2835_isp_denoise &denoise = blockDenoise->denoise; DenoiseMode mode = static_cast(denoiseStatus->mode); denoise.enabled = mode != DenoiseMode::Off; @@ -463,9 +442,11 @@ void IpaVc4::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList denoise.slope.den = 1000; denoise.strength.num = 1000 * denoiseStatus->strength; denoise.strength.den = 1000; + blockDenoise.setEnabled(denoise.enabled); /* Set the CDN mode to match the SDN operating mode. */ - bcm2835_isp_cdn cdn; + auto blockCdn = params.block(); + bcm2835_isp_cdn &cdn = blockCdn->cdn; switch (mode) { case DenoiseMode::ColourFast: cdn.enabled = 1; @@ -479,18 +460,13 @@ void IpaVc4::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList cdn.enabled = 0; } - ControlValue c(std::span{ reinterpret_cast(&denoise), - sizeof(denoise) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_DENOISE, c); - - c = ControlValue(std::span{ reinterpret_cast(&cdn), - sizeof(cdn) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_CDN, c); + blockCdn.setEnabled(cdn.enabled); } -void IpaVc4::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls) +void IpaVc4::applySharpen(const struct SharpenStatus *sharpenStatus, Bcm2835Params ¶ms) { - bcm2835_isp_sharpen sharpen; + auto block = params.block(); + bcm2835_isp_sharpen &sharpen = block->sharpen; sharpen.enabled = 1; sharpen.threshold.num = 1000 * sharpenStatus->threshold; @@ -500,24 +476,21 @@ void IpaVc4::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList sharpen.limit.num = 1000 * sharpenStatus->limit; sharpen.limit.den = 1000; - ControlValue c(std::span{ reinterpret_cast(&sharpen), - sizeof(sharpen) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_SHARPEN, c); + block.setEnabled(true); } -void IpaVc4::applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls) +void IpaVc4::applyDPC(const struct DpcStatus *dpcStatus, Bcm2835Params ¶ms) { - bcm2835_isp_dpc dpc; + auto block = params.block(); + bcm2835_isp_dpc &dpc = block->dpc; dpc.enabled = 1; dpc.strength = dpcStatus->strength; - ControlValue c(std::span{ reinterpret_cast(&dpc), - sizeof(dpc) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_DPC, c); + block.setEnabled(true); } -void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) +void IpaVc4::applyLS(const struct AlscStatus *lsStatus, Bcm2835Params ¶ms) { /* * Program lens shading tables into pipeline. @@ -541,7 +514,14 @@ void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) /* We're going to supply corner sampled tables, 16 bit samples. */ w++, h++; - bcm2835_isp_lens_shading ls = { + + if (!lsTableHandle_.isValid() || !lsTable_ || w * h * 4 * sizeof(uint16_t) > MaxLsGridSize) { + LOG(IPARPI, Error) << "Do not have a correctly allocated lens shading table!"; + return; + } + + auto block = params.block(); + block->ls = { .enabled = 1, .grid_cell_size = cellSize, .grid_width = w, @@ -554,11 +534,6 @@ void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) .gain_format = GAIN_FORMAT_U4P10 }; - if (!lsTable_ || w * h * 4 * sizeof(uint16_t) > MaxLsGridSize) { - LOG(IPARPI, Error) << "Do not have a correctly allocate lens shading table!"; - return; - } - if (lsStatus) { /* Format will be u4.10 */ uint16_t *grid = static_cast(lsTable_); @@ -569,9 +544,7 @@ void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) resampleTable(grid + 3 * w * h, lsStatus->b, w, h); } - ControlValue c(std::span{ reinterpret_cast(&ls), - sizeof(ls) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, c); + block.setEnabled(true); } void IpaVc4::applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index d242157d58c5..a84cd0107764 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -86,7 +86,6 @@ public: void processStatsComplete(const ipa::RPi::BufferIds &buffers); void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers, unsigned int paramsBytesUsed); - void setIspControls(const ControlList &controls); void setCameraTimeout(uint32_t maxFrameLengthMs); std::unique_ptr unicamSubdev_; @@ -142,6 +141,8 @@ private: void tryRunPipeline() override; bool findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&embeddedBuffer); + void populateLensShadingFD(const RPi::BufferObject ¶msBufObj); + std::queue bayerQueue_; std::queue embeddedQueue_; }; @@ -412,7 +413,6 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr &camer /* Write up all the IPA connections. */ data->ipa_->processStatsComplete.connect(data, &Vc4CameraData::processStatsComplete); data->ipa_->prepareIspComplete.connect(data, &Vc4CameraData::prepareIspComplete); - data->ipa_->setIspControls.connect(data, &Vc4CameraData::setIspControls); data->ipa_->setCameraTimeout.connect(data, &Vc4CameraData::setCameraTimeout); /* @@ -824,8 +824,6 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi int Vc4CameraData::platformConfigureIpa(ipa::RPi::ConfigParams ¶ms) { - params.ispControls = isp_[Isp::Input].dev()->controls(); - /* Allocate the lens shading table via dmaHeap and pass to the IPA. */ if (!lsTable_.isValid()) { lsTable_ = SharedFD(dmaHeap_.alloc("ls_grid", ipa::RPi::MaxLsGridSize)); @@ -968,17 +966,63 @@ void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers) handleState(); } +/* + * Populate the lens shading table's dmabuf descriptor inside the params buffer. + * + * While the IPA fills the lens shading table, it may run in an isolated + * process context, so it does not populate the dmabuf file descriptor. + * + * Do that here. + */ +void Vc4CameraData::populateLensShadingFD(const RPi::BufferObject ¶msBufObj) +{ + std::span plane = paramsBufObj.mapped->planes()[0]; + auto *paramsBuffer = + reinterpret_cast(plane.data()); + uint8_t *data = paramsBuffer->data; + uint32_t offset = 0; + + while (offset < paramsBuffer->data_size) { + auto *blockHeader = + reinterpret_cast(data + offset); + + if (blockHeader->type == BCM2835_ISP_PARAM_BLOCK_LENS_SHADING) { + auto *lsBlock = + reinterpret_cast(blockHeader); + lsBlock->ls.dmabuf = lsTable_.get(); + return; + } + + offset += blockHeader->size; + } +} + void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, [[maybe_unused]] bool stitchSwapBuffers, - [[maybe_unused]] unsigned int paramsBytesUsed) + unsigned int paramsBytesUsed) { unsigned int embeddedId = buffers.embedded & RPi::MaskID; + unsigned int paramsId = buffers.params & RPi::MaskID; unsigned int bayer = buffers.bayer & RPi::MaskID; FrameBuffer *buffer; if (!isRunning()) return; + /* Queue params buffer */ + const RPi::BufferObject ¶msBufObj = isp_[Isp::Params].getBuffers().at(paramsId); + ASSERT(paramsBufObj.mapped); + populateLensShadingFD(paramsBufObj); + buffer = paramsBufObj.buffer; + buffer->_d()->metadata().planes()[0].bytesused = paramsBytesUsed; + + LOG(RPI, Debug) << "Queue params to ISP, buffer id " << paramsId + << ", timestamp: " << buffer->metadata().timestamp + << ", bytes used: " << paramsBytesUsed; + + isp_[Isp::Params].queueBuffer(buffer); + + /* Queue input buffer */ buffer = unicam_[Unicam::Image].getBuffers().at(bayer & RPi::MaskID).buffer; LOG(RPI, Debug) << "Input re-queue to ISP, buffer id " << (bayer & RPi::MaskID) << ", timestamp: " << buffer->metadata().timestamp; @@ -993,23 +1037,6 @@ void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, handleState(); } -void Vc4CameraData::setIspControls(const ControlList &controls) -{ - ControlList ctrls = controls; - - if (ctrls.contains(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)) { - ControlValue &value = - const_cast(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)); - std::span s = value.data(); - bcm2835_isp_lens_shading *ls = - reinterpret_cast(s.data()); - ls->dmabuf = lsTable_.get(); - } - - isp_[Isp::Input].dev()->setControls(&ctrls); - handleState(); -} - void Vc4CameraData::setCameraTimeout(uint32_t maxFrameLengthMs) { /* @@ -1037,6 +1064,11 @@ void Vc4CameraData::tryRunPipeline() if (!findMatchingBuffers(bayerFrame, embeddedBuffer)) return; + /* Request a parameter buffer, will be released by ispOutputDequeue */ + const RPi::BufferObject ¶mBufObj = isp_[Isp::Params].acquireBuffer(); + if (!paramBufObj.buffer || !paramBufObj.mapped) + return; + /* Take the first request from the queue and action the IPA. */ Request *request = requestQueue_.front(); ASSERT(request->metadata().empty()); @@ -1048,9 +1080,6 @@ void Vc4CameraData::tryRunPipeline() unsigned int bayer = unicam_[Unicam::Image].getBufferId(bayerFrame.buffer); - LOG(RPI, Debug) << "Signalling prepareIsp:" - << " Bayer buffer id: " << bayer; - ipa::RPi::PrepareParams params; params.buffers.bayer = RPi::MaskBayerData | bayer; params.sensorControls = std::move(bayerFrame.controls); @@ -1065,6 +1094,14 @@ void Vc4CameraData::tryRunPipeline() /* Set our state to say the pipeline is active. */ state_ = State::Busy; + unsigned int paramId = isp_[Isp::Params].getBufferId(paramBufObj.buffer); + ASSERT(paramId); + params.buffers.params = RPi::MaskParams | paramId; + + LOG(RPI, Debug) << "Signalling prepareIsp:" + << " Bayer buffer id: " << bayer + << " Param buffer id: " << paramId; + if (embeddedBuffer) { unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer); From patchwork Wed Nov 18 18:16:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 29036 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 41CFFC3355 for ; Wed, 18 Nov 2026 18:18:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E03BA6A92E; Wed, 18 Nov 2026 19:18:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OmIrKLGc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 010146A90F for ; Wed, 18 Nov 2026 19:18:33 +0100 (CET) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c67:cdf:7464:6c04:36e4:ee87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A5FD34; Wed, 18 Nov 2026 19:16:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795025764; bh=fq0sEZd6urvSGaK8+0hogu0k0NCNnkIl/AJfv2213pk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OmIrKLGcJI5oEe/uBWzAvwA04esgirJ9kbHa/zPYigCBZk1aM5/23ugCc7YJbNp+S vA9Vtx187ppFHxvl81TM5lfo8kPk81HA4eRI5ZiLnr7wZnRaky1+1EBuPGwv8L2GRp CcbN+/5Aa+PyBMubgMN+TuZO5WBbx/KkLDu6KuUY= From: Jai Luthra Date: Wed, 18 Nov 2026 23:46:58 +0530 Subject: [PATCH v4 8/8] include: uapi: bcm2835-isp: Drop legacy V4L2 controls MIME-Version: 1.0 Message-Id: <20261118-pi4-upstream-v4-8-93bdc7d925ba@ideasonboard.com> References: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> In-Reply-To: <20261118-pi4-upstream-v4-0-93bdc7d925ba@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Paul Elder , Jacopo Mondi , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=10774; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=fq0sEZd6urvSGaK8+0hogu0k0NCNnkIl/AJfv2213pk=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBq/evLLq/XT9VBQildHP/XTEsfTgE+TZwFOIYlO JLeYoE5/BSJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCav3rywAKCRBD3pH5JJpx RYnREACLFhDGi6EuzySJiayNABZF6bw0oHCl3JcQI8rB8QQTNIJsOYbD6DcSs/7J7hI7gAN/n8J ANSPcE9CA9BISgl0j2QXgm3ePtqqXYe+0E42cK9NZBHe+71AKbIB/C8oUvu4aciYR+hC3655d2c GmQiCkyLmL2q3oATEB5NBY+EtC9ivFz9O3w4tM8EmqpSrtvyFQ5R6RHzdoOwvseclltLeqTu+Bh QsP6S961xz087tgxvJCDGhYS6u4vNVMDasFfGgqNwyIU5zDuDRK71NzIsKUBQV/pWOAr/Zafse3 BIt+vnAH3vCwzjgcf3uKY2TyJJ0HpDcylZBx6BdWRbgiFFrLTLvSjJkbjU+ONt3SRKH4Z5pVkHB 8Pcr8QpsJrGkEiU0KG60TODt9Iw5NNzlVkCF4IXhNUlCxPSafVozq6I6NDvFRMjGyMt7fbuHtSx ihpyBm5RK+YaTH5jmKRlAii/2rUaeiMd+SJA/84pM+3NLD1jInF9iNwGv4o3pUztWTFIgJbtthX eK50RYa7vuM2D3y9vgfX1ug3gsYEbfM+v00oKc1NLysyy/SWOplKUnAgSg4KDQY9RlbtpCuUCQa Hd3zPItPC6aITCGbYj9MctqI3TsTFhRglbBPG5kdnexUDwKOgutevGHPPbxxMLnhDuuRNH/7VGI rYTRsdK/0Bc126Q== X-Developer-Key: i=jai.luthra@ideasonboard.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 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" Now that the VC4 IPA and pipeline handler pass ISP configuration exclusively through parameter buffers, the V4L2_CID_USER_BCM2835_ISP_* custom controls are unused. Drop them, and clean up the struct documentation that still referenced the controls. Also sync with the latest header posted for mainline, and move the header under the include/linux/media/broadcom subdirectory to match. Reviewed-by: Paul Elder Tested-by: Paul Elder Signed-off-by: Jai Luthra --- include/linux/{ => media/broadcom}/bcm2835-isp.h | 67 +++++++----------------- include/linux/v4l2-controls.h | 3 -- include/linux/videodev2.h | 2 +- src/ipa/rpi/vc4/params.h | 2 +- src/ipa/rpi/vc4/vc4.cpp | 2 +- src/libcamera/control_ids_rpi.yaml | 2 +- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 2 +- 7 files changed, 24 insertions(+), 56 deletions(-) diff --git a/include/linux/bcm2835-isp.h b/include/linux/media/broadcom/bcm2835-isp.h similarity index 86% rename from include/linux/bcm2835-isp.h rename to include/linux/media/broadcom/bcm2835-isp.h index c49854cfa004..d15a4ed18404 100644 --- a/include/linux/bcm2835-isp.h +++ b/include/linux/media/broadcom/bcm2835-isp.h @@ -4,7 +4,7 @@ * * BCM2835 ISP driver - user space header file. * - * Copyright © 2019-2020 Raspberry Pi Ltd + * Copyright © 2019-2026 Raspberry Pi (Trading) Ltd. * * Author: Naushir Patuck (naush@raspberrypi.com) * @@ -13,30 +13,11 @@ #ifndef __BCM2835_ISP_H_ #define __BCM2835_ISP_H_ -#include #include -#define V4L2_CID_USER_BCM2835_ISP_CC_MATRIX \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0001) -#define V4L2_CID_USER_BCM2835_ISP_LENS_SHADING \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0002) -#define V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0003) -#define V4L2_CID_USER_BCM2835_ISP_GEQ \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0004) -#define V4L2_CID_USER_BCM2835_ISP_GAMMA \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0005) -#define V4L2_CID_USER_BCM2835_ISP_DENOISE \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0006) -#define V4L2_CID_USER_BCM2835_ISP_SHARPEN \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0007) -#define V4L2_CID_USER_BCM2835_ISP_DPC \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0008) -#define V4L2_CID_USER_BCM2835_ISP_CDN \ - (V4L2_CID_USER_BCM2835_ISP_BASE + 0x0009) /* - * All structs below are directly mapped onto the equivalent structs in - * drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h + * All structs below are directly mapped from struct + * mmal_parameter_isp_parameters in include/linux/raspberrypi/mmal-parameters.h * for convenience. */ @@ -63,8 +44,7 @@ struct bcm2835_isp_ccm { }; /** - * struct bcm2835_isp_custom_ccm - Custom CCM applied with the - * V4L2_CID_USER_BCM2835_ISP_CC_MATRIX ctrl. + * struct bcm2835_isp_custom_ccm - Custom CCM configuration. * * @enabled: Enable custom CCM. * @ccm: Custom CCM coefficients and offsets. @@ -76,8 +56,7 @@ struct bcm2835_isp_custom_ccm { /** * enum bcm2835_isp_gain_format - format of the gains in the lens shading - * tables used with the - * V4L2_CID_USER_BCM2835_ISP_LENS_SHADING ctrl. + * tables. * * @GAIN_FORMAT_U0P8_1: Gains are u0.8 format, starting at 1.0 * @GAIN_FORMAT_U1P7_0: Gains are u1.7 format, starting at 0.0 @@ -100,9 +79,7 @@ enum bcm2835_isp_gain_format { }; /** - * struct bcm2835_isp_lens_shading - Lens shading tables supplied with the - * V4L2_CID_USER_BCM2835_ISP_LENS_SHADING - * ctrl. + * struct bcm2835_isp_lens_shading - Lens shading tables. * * @enabled: Enable lens shading. * @grid_cell_size: Size of grid cells in samples (16, 32, 64, 128 or 256). @@ -129,13 +106,13 @@ struct bcm2835_isp_lens_shading { }; /** - * struct bcm2835_isp_black_level - Sensor black level set with the - * V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL ctrl. + * struct bcm2835_isp_black_level - Sensor black level configuration. * * @enabled: Enable black level. * @black_level_r: Black level for red channel. * @black_level_g: Black level for green channels. * @black_level_b: Black level for blue channel. + * @padding: Unused padding. */ struct bcm2835_isp_black_level { __u32 enabled; @@ -146,8 +123,7 @@ struct bcm2835_isp_black_level { }; /** - * struct bcm2835_isp_geq - Green equalisation parameters set with the - * V4L2_CID_USER_BCM2835_ISP_GEQ ctrl. + * struct bcm2835_isp_geq - Green equalisation parameters. * * @enabled: Enable green equalisation. * @offset: Fixed offset of the green equalisation threshold. @@ -162,13 +138,12 @@ struct bcm2835_isp_geq { #define BCM2835_NUM_GAMMA_PTS 33 /** - * struct bcm2835_isp_gamma - Gamma parameters set with the - * V4L2_CID_USER_BCM2835_ISP_GAMMA ctrl. + * struct bcm2835_isp_gamma - Gamma parameters. * * @enabled: Enable gamma adjustment. - * @X: X values of the points defining the gamma curve. + * @x: X values of the points defining the gamma curve. * Values should be scaled to 16 bits. - * @Y: Y values of the points defining the gamma curve. + * @y: Y values of the points defining the gamma curve. * Values should be scaled to 16 bits. */ struct bcm2835_isp_gamma { @@ -180,9 +155,9 @@ struct bcm2835_isp_gamma { /** * enum bcm2835_isp_cdn_mode - Mode of operation for colour denoise. * - * @CDN_MODE_FAST: Fast (but lower quality) colour denoise + * @CDN_MODE_FAST: Fast (but lower quality) colour denoise * algorithm, typically used for video recording. - * @CDN_HIGH_QUALITY: High quality (but slower) colour denoise + * @CDN_MODE_HIGH_QUALITY: High quality (but slower) colour denoise * algorithm, typically used for stills capture. */ enum bcm2835_isp_cdn_mode { @@ -191,11 +166,10 @@ enum bcm2835_isp_cdn_mode { }; /** - * struct bcm2835_isp_cdn - Colour denoise parameters set with the - * V4L2_CID_USER_BCM2835_ISP_CDN ctrl. + * struct bcm2835_isp_cdn - Colour denoise parameters. * * @enabled: Enable colour denoise. - * @cdn_mode: Colour denoise operating mode (see enum &bcm2835_isp_cdn_mode) + * @mode: Colour denoise operating mode (see enum &bcm2835_isp_cdn_mode) */ struct bcm2835_isp_cdn { __u32 enabled; @@ -203,8 +177,7 @@ struct bcm2835_isp_cdn { }; /** - * struct bcm2835_isp_denoise - Denoise parameters set with the - * V4L2_CID_USER_BCM2835_ISP_DENOISE ctrl. + * struct bcm2835_isp_denoise - Denoise parameters. * * @enabled: Enable denoise. * @constant: Fixed offset of the noise threshold. @@ -219,8 +192,7 @@ struct bcm2835_isp_denoise { }; /** - * struct bcm2835_isp_sharpen - Sharpen parameters set with the - * V4L2_CID_USER_BCM2835_ISP_SHARPEN ctrl. + * struct bcm2835_isp_sharpen - Sharpen parameters. * * @enabled: Enable sharpening. * @threshold: Threshold at which to start sharpening pixels. @@ -248,8 +220,7 @@ enum bcm2835_isp_dpc_mode { }; /** - * struct bcm2835_isp_dpc - Defective pixel correction (DPC) parameters set - * with the V4L2_CID_USER_BCM2835_ISP_DPC ctrl. + * struct bcm2835_isp_dpc - Defective pixel correction (DPC) parameters. * * @enabled: Enable DPC. * @strength: DPC strength (see enum &bcm2835_isp_dpc_mode). diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h index c0d9cab3c71e..aff5280b63cc 100644 --- a/include/linux/v4l2-controls.h +++ b/include/linux/v4l2-controls.h @@ -178,9 +178,6 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0) -/* The base for the bcm2835-isp driver controls. - * We reserve 16 controls for this driver. */ -#define V4L2_CID_USER_BCM2835_ISP_BASE (V4L2_CID_USER_BASE + 0x10e0) /* * The base for Allegro driver controls. * We reserve 16 controls for this driver. diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 60133dcf90f5..e14c78ed51b2 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -844,7 +844,7 @@ struct v4l2_pix_format { #define V4L2_META_FMT_UVC_MSXU_1_5 v4l2_fourcc('U', 'V', 'C', 'M') /* UVC MSXU metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */ #define V4L2_META_FMT_SENSOR_DATA v4l2_fourcc('S', 'E', 'N', 'S') /* Sensor Ancillary metadata */ -#define V4L2_META_FMT_BCM2835_ISP_STATS v4l2_fourcc('B', 'S', 'T', 'A') /* BCM2835 ISP image statistics output */ +#define V4L2_META_FMT_BCM2835_ISP_STATS v4l2_fourcc('B', 'S', 'T', 'A') /* BCM2835 ISP stats */ #define V4L2_META_FMT_BCM2835_ISP_PARAMS v4l2_fourcc('B', 'C', 'M', 'P') /* BCM2835 ISP params */ /* Vendor specific - used for RK_ISP1 camera sub-system */ diff --git a/src/ipa/rpi/vc4/params.h b/src/ipa/rpi/vc4/params.h index 3eb7794e7c79..d7b9c668dae4 100644 --- a/src/ipa/rpi/vc4/params.h +++ b/src/ipa/rpi/vc4/params.h @@ -9,7 +9,7 @@ #include -#include +#include #include diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp index e1075235f663..eaa589cfb702 100644 --- a/src/ipa/rpi/vc4/vc4.cpp +++ b/src/ipa/rpi/vc4/vc4.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml index 31a1356415df..9a03c1b515a3 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -28,7 +28,7 @@ controls: This is sent in the Request metadata if the StatsOutputEnable is set to true. The statistics struct definition can be found in - include/linux/bcm2835-isp.h. + include/linux/media/broadcom/bcm2835-isp.h. \sa StatsOutputEnable diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index a84cd0107764..c419337f895f 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include