From patchwork Wed Jul 22 11:23:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 27437 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 7052BBDE17 for ; Wed, 22 Jul 2026 11:24:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1E7C967E95; Wed, 22 Jul 2026 13:24:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Sqc/Q1CI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E6FD67E8A for ; Wed, 22 Jul 2026 13:24:50 +0200 (CEST) Received: from mail.ideasonboard.com (unknown [IPv6:2401:4900:1c68:25d4:fa24:78d1:31:7a56]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E922227; Wed, 22 Jul 2026 13:23:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1784719430; bh=Tom9zcr7m+uVm3IWfbKXSceiwM1Aev3qwGzYHJZHOFE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Sqc/Q1CIqT1xRl6UTMEIAGtuS3YHaYd6P5qaSbWaKw+lcncsMZTFQTw8Vn9kmmsE8 gLwcuhyYtf2RETx5IAxxQClR70mqcizy3bVffYsmtCLeMrky8Af4BLcik8Jp89I2Dx 7R4lgkwr5M2Ou2jC7pYRbwyWaozELw0qQgDVJJPo= From: Jai Luthra Date: Wed, 22 Jul 2026 16:53:18 +0530 Subject: [PATCH v2 2/8] include: uapi: bcm2835-isp: Add extensible parameter buffer interface MIME-Version: 1.0 Message-Id: <20260722-pi4-upstream-v2-2-eb44d3c6fd92@ideasonboard.com> References: <20260722-pi4-upstream-v2-0-eb44d3c6fd92@ideasonboard.com> In-Reply-To: <20260722-pi4-upstream-v2-0-eb44d3c6fd92@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart , Kieran Bingham , Jacopo Mondi , Daniel Scally , Jai Luthra X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=9226; i=jai.luthra@ideasonboard.com; h=from:subject:message-id; bh=Tom9zcr7m+uVm3IWfbKXSceiwM1Aev3qwGzYHJZHOFE=; b=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBqYKhpL2pRuan0OHdzOq/zZQL52urYiXgT+Ng97 4n49b5FuG6JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCamCoaQAKCRBD3pH5JJpx RcOFD/4xw3OcrppbyJ3wClwVVIo5VaIv08lRW/jGlKEYKdg6aqHd/3atUVXG/YFS8DUkq9aXtpa O6rEDbUoHBn2DapqKf/ULmg9oDlql74laiemOWDFpY5y+hp7BcCyoCmUJNok6cXJkMpg9DOS9Ju uVN/8oPF70kdb9ezsagOtw5NfXci1sl/WXNiem7zbl1DFSqoU7SkuMeqmJC7B5By6C/tVZ6AztB OcgOh59hvKIu3HMv06+Wh3SRlg+nPalV90hKimyprPIRy/cUVJwZQIUnPXxrBY15RMD9l6rVl+O 2E9WvV2387Bf6Ztl0zPmn/RDdLU7848KzYw4AOQfSiNVyqRdKECFkrk8HUvWVfz2reCF211rmq/ AXq0et7xTxrfxkWOKfIUIADxfMw6GX/TUoI4dA3zrRWUd8sRXbwB5LAQbviRX6CPlKWcpuhHUNX x4zjLiskIKEzwlTjY1OJX34hEgpXXFia9zCjwiRJjzKsUtrLGE1i4NrkSxhUpOjhcRYkZnPNKqW dBoYLESmSopzrHuGdo8E+6PHVukhTs7a+nGljuc/sfcBW36hDMLYkjk4duKdNWj9AMqXtLSP0Pv QmH9MPgrBtYPUKcAm5D2TDTZLUniru6s3FAzkYWzisdBewx1p6u7PLLo8paGruh08f9j2TMoxE6 QDwFnBWUnl0wlrQ== 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. 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 5f0f78e3e..c49854cfa 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 8bccad84f..60133dcf9 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 */