Patch Detail
Show a patch.
GET /api/patches/26921/?format=api
{ "id": 26921, "url": "https://patchwork.libcamera.org/api/patches/26921/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26921/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260618-rppx1-ipa-v1-6-32337264cfcd@ideasonboard.com>", "date": "2026-06-18T10:18:45", "name": "[06/14] include: linux: Add uAPI file for Dreamchip RPP-X1", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4ec8af6498982a909c0f034593a8f8c6dcc7e0c7", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26921/mbox/", "series": [ { "id": 6003, "url": "https://patchwork.libcamera.org/api/series/6003/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6003", "date": "2026-06-18T10:18:39", "name": "libcamera: Add support for R-Car Gen4 and RPP-X1 ISP", "version": 1, "mbox": "https://patchwork.libcamera.org/series/6003/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26921/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26921/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6ECB8C3304\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 10:19:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 969B5629DF;\n\tThu, 18 Jun 2026 12:19:02 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3CA162988\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 12:18:56 +0200 (CEST)", "from [192.168.125.177] (mob-109-113-4-199.net.vodafone.it\n\t[109.113.4.199])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 70669DF3;\n\tThu, 18 Jun 2026 12:18:21 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Vk0iWCAY\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781777901;\n\tbh=7KnAlTUERTSBesKy8vBBMYA7iy8uY418g5ZiePex/Yk=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=Vk0iWCAYJkDmHfqdqCoKktnsnIqXFV1NB2CqrNxONMPg6xcpGtX9SZM7aArILL3MW\n\tDN5hJztIhBrstmyLczfmQnGhJpeQRXV1EbDrFhCrWXmjuw5ciyG7MMKUuNUTSLz/Sx\n\tsbl11f334gvzjXkp0POCR88FT9+H9UQYl+4v3SFo=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Thu, 18 Jun 2026 12:18:45 +0200", "Subject": "[PATCH 06/14] include: linux: Add uAPI file for Dreamchip RPP-X1", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260618-rppx1-ipa-v1-6-32337264cfcd@ideasonboard.com>", "References": "<20260618-rppx1-ipa-v1-0-32337264cfcd@ideasonboard.com>", "In-Reply-To": "<20260618-rppx1-ipa-v1-0-32337264cfcd@ideasonboard.com>", "To": "=?utf-8?q?Niklas_S=C3=B6derlund?=\n\t<niklas.soderlund+renesas@ragnatech.se>, \n\tlibcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=28646;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=7KnAlTUERTSBesKy8vBBMYA7iy8uY418g5ZiePex/Yk=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqM8YJhMGoVn/3RZDrgBklDzv1qTsw7qgbycLHl\n\tMYR5fdSAGSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCajPGCQAKCRByNAaPFqFW\n\tPOoIEACTSkLJjKiZKjWznsgn++NGU6SX0pYBQik84WftaEUStLg3CS1H55sstu+WoGMhRfsccap\n\t/OdFBKfsIlR8KASpHaaLN9yW/a51PveFyFouV5FEyp9uU5waco060GMyR7a6ONoH1S7l66NrHKR\n\thksuZ40LIAc5wUFHARifnvGiun6u/vh76AUb7TxP1HAa9LhmKLvAsygqvCplE64wZ38F0O1QeH1\n\tJlAz2tGf43+u1AEuhH5jwzN4pl77PmjPBADvM3KP7tigPFbJ33LgpVk0iZLxFIwUeqSRrsJeUGG\n\tthUOJ+NyMPo22d4/HggpN4wvcNuhXEjRMHBQTlho0z6nUtZKJO2PgQEDkM5wung4We901KGrELS\n\tsljBepNcgEpUIHL+BGICMGA2ujco/IyjlmKUsW1zv+mld80C87ZR6l56LJmN6XkTq1mcE7qiiWt\n\tb9QpDsk6AIpbFDIvlnhgWVv7xbApN8hwuQ7XHa1n+4YpClyApQc1scX5YZMpYHfi2kM3H00vAU5\n\t9AcFQiA+SA8YZ58RQhXmtwATuyermEkjwQtvK25T1fl5QI+B1A/XmlTml8vr2qVFbk65i/PWR71\n\tNLA/AqOJMHYG+despH+fPTDt54vj87qNHD9M77T/uA4IaL+zHIQ043f25n3g6mjz6PaTCAeCzPE\n\tOFFDenoi4olqmwQ==", "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add the uAPI header file for the Dreamchip RPP-X1 ISP integrated\nin the Renesas R-Car V4H SoC.\n\nThe header is not yet upstream but is currently available at:\nhttps://patchwork.linuxtv.org/project/linux-media/list/?series=26362\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/linux/media/dreamchip/rppx1-config.h | 710 +++++++++++++++++++++++++++\n 1 file changed, 710 insertions(+)", "diff": "diff --git a/include/linux/media/dreamchip/rppx1-config.h b/include/linux/media/dreamchip/rppx1-config.h\nnew file mode 100644\nindex 000000000000..0042c86090f6\n--- /dev/null\n+++ b/include/linux/media/dreamchip/rppx1-config.h\n@@ -0,0 +1,710 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+/*\n+ * Dreamchip RPP-X1 ISP Driver - Userspace API\n+ *\n+ * Copyright (C) 2026 Renesas Electronics Corp.\n+ * Copyright (C) 2026 Ideas on Board Oy\n+ * Copyright (C) 2026 Ragnatech AB\n+ */\n+\n+#ifndef __UAPI_RPP_X1_CONFIG_H\n+#define __UAPI_RPP_X1_CONFIG_H\n+\n+#include <linux/media/v4l2-isp.h>\n+\n+/**\n+ * struct rppx1_window - Measurement window\n+ *\n+ * RPP-X1 measurement window. Different blocks use a window or multiple\n+ * windows for measurement purposes. This defines a common type for all of\n+ * them. The number of relevant bits depends on the block where the window is\n+ * used and is specified in the per-block description\n+ *\n+ * @h_offs: horizontal offset from the left of the frame in pixels\n+ * @v_offs: vertical offset from the top of the frame in pixels\n+ * @h_size: horizontal size of the window in pixels\n+ * @v_size: vertical size of the window in pixels\n+ */\n+struct rppx1_window {\n+\t__u16 h_offs;\n+\t__u16 v_offs;\n+\t__u16 h_size;\n+\t__u16 v_size;\n+};\n+\n+/**\n+ * enum rppx1_meas_chan - Measurement point for the Histogram and EXM Modules\n+ *\n+ * Measurement points for the RPP-X1 Histogram measurement module and Exposure\n+ * measurement module.\n+ *\n+ * All tap points are available for the PRE1/PRE2 pipes. Only\n+ * RPPX1_MEAS_CHAN_SEL4 and RPPX1_MEAS_CHAN_SEL7 are available for the\n+ * MAIN_POST pipe.\n+ *\n+ * @RPPX1_MEAS_CHAN_SEL0: after input acquisition\n+ * @RPPX1_MEAS_CHAN_SEL1: after black level subtraction\n+ * @RPPX1_MEAS_CHAN_SEL2: after sensor gamma linearization\n+ * @RPPX1_MEAS_CHAN_SEL3: after lens shading correction\n+ * @RPPX1_MEAS_CHAN_SEL4: after auto white balance gains\n+ * @RPPX1_MEAS_CHAN_SEL5: after defect pixel correction\n+ * @RPPX1_MEAS_CHAN_SEL6: after denoise pre-filter\n+ * @RPPX1_MEAS_CHAN_SEL7: after demosaicing\n+ */\n+enum rppx1_meas_chan {\n+\tRPPX1_MEAS_CHAN_SEL0,\n+\tRPPX1_MEAS_CHAN_SEL1,\n+\tRPPX1_MEAS_CHAN_SEL2,\n+\tRPPX1_MEAS_CHAN_SEL3,\n+\tRPPX1_MEAS_CHAN_SEL4,\n+\tRPPX1_MEAS_CHAN_SEL5,\n+\tRPPX1_MEAS_CHAN_SEL6,\n+\tRPPX1_MEAS_CHAN_SEL7,\n+};\n+\n+/* ---------------------------------------------------------------------------\n+ * Parameter Structures\n+ *\n+ * The same ISP block might be instantiated in multiple pipeliness and operate\n+ * on a different bitdepth/precision. For fields of varying length among\n+ * different instances of the same block, use a data type that can accommodate\n+ * the larger bitdepth/precision.\n+ */\n+\n+/**\n+ * enum rppx1_params_block_type - RPP-X1 extensible params block types\n+ *\n+ * NOTE: Only append to the enumeration as the numbers are uAPI.\n+ *\n+ * @RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST: AWB Measurement Configuration\n+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1: PRE1 pipe White Balance Gains\n+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2: PRE2 White Balance Gains\n+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST: MAIN_POST White Balance Gains\n+ * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1: PRE1 pipe Exposure Measurement\n+ * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2: PRE2 pipe Exposure Measurement\n+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1: PRE1 pipe Histogram Measurement\n+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2: PRE2 pipe Histogram Measurement\n+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_POST: POST pipe Histogram Measurement\n+ * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1: PRE1 pipe Black Level Subtraction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2: PRE2 pipe Black Level Subtraction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST: POST pipe Color Correction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1: PRE1 pipe Lens Shading Correction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2: PRE2 pipe Lens Shading Correction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_GA_HV: Human Vision Pipe Gamma Out Correction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_GA_MV: Machine Vision Gamma Out Correction\n+ * @RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1: PRE1 pipe Linearization (Sensor De-gamma)\n+ * @RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2: PRE2 pipe Linearization (Sensor De-gamma)\n+ */\n+enum rppx1_params_block_type {\n+\tRPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST,\n+\tRPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2,\n+\tRPPX1_PARAMS_BLOCK_TYPE_AWBG_POST,\n+\tRPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2,\n+\tRPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2,\n+\tRPPX1_PARAMS_BLOCK_TYPE_HIST_POST,\n+\tRPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2,\n+\tRPPX1_PARAMS_BLOCK_TYPE_CCOR_POST,\n+\tRPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2,\n+\tRPPX1_PARAMS_BLOCK_TYPE_GA_HV,\n+\tRPPX1_PARAMS_BLOCK_TYPE_GA_MV,\n+\tRPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1,\n+\tRPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2,\n+};\n+\n+/**\n+ * enum rppx1_wbmeas_mode - AWB measurement mode\n+ *\n+ * @RPPX1_WBMEAS_MODE_YCBCR: YCbCr measurement mode\n+ * @RPPX1_WBMEAS_MODE_RGB: RGB measurement mode\n+ */\n+enum rppx1_wbmeas_mode {\n+\tRPPX1_WBMEAS_MODE_YCBCR,\n+\tRPPX1_WBMEAS_MODE_RGB,\n+};\n+\n+/**\n+ * struct rppx1_wbmeas_params - AWB measurement configuration\n+ *\n+ * The Auto-White Balance measurement module is available on the MAIN_POST pipe.\n+ * It supports two measurement modes, selected by the @mode field. The\n+ * measurement window is programmed through the @wnd field.\n+ *\n+ * To support measurement in YCbCr mode a color conversion matrix with\n+ * programmable offset is available in the @ccor_coeff and @ccor_offs fields.\n+ * The color conversion matrix coefficients are represented as 16 bits signed\n+ * Q4.12 numbers ranging from -8 to +7.99. The per-color channel offsets are\n+ * represented as 25 bits 2's complement integer numbers ranging from -16777216\n+ * to +16777215.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST)\n+ * @mode: measurement mode (from enum rppx1_wbmeas_mode)\n+ * @ymax_cmp: enable Y_MAX compare using @max_y\n+ * @wnd: measurement window\n+ * @frames: number of frames for mean value calculation (0 = 1 frame)\n+ * @ref_cr_max_r: reference Cr or max red value in RGB mode, 24 bits\n+ * @ref_cb_max_b: reference Cb or max blue value in RGB mode, 24 bits\n+ * @min_y_max_g: luminance minimum value or max green value in RGB mode, 24 bits\n+ * @max_y: luminance maximum value, only valid if @mode is set to YCbCr and\n+ *\t @ymax_cmp is set to enabled, 24 bits\n+ * @max_csum: chrominance sum maximum value, 24 bits\n+ * @min_c: chrominance minimum value, 24 bits\n+ * @ccor_coeff: coefficients for color conversion matrix, signed 16 bits Q4.6\n+ * @ccor_offs: R-G-B color conversion coefficients, signed 25 bits 2's complement\n+ */\n+struct rppx1_wbmeas_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 mode;\n+\t__u8 ymax_cmp;\n+\tstruct rppx1_window wnd;\n+\t__u8 frames;\n+\t__u32 ref_cr_max_r;\n+\t__u32 ref_cb_max_b;\n+\t__u32 min_y_max_g;\n+\t__u32 max_y;\n+\t__u32 max_csum;\n+\t__u32 min_c;\n+\t__u16 ccor_coeff[3][3];\n+\t__u32 ccor_offs[3];\n+};\n+\n+/**\n+ * struct rppx1_awbg_params - WB gain configuration\n+ *\n+ * The RPP-X1 White Balance Gain module is available in the PRE1 and PRE2\n+ * pre-fusion pipes and in the MAIN_POST post-fusion pipe. Userspace selects\n+ * which pipe to operate by setting the @header.type field to\n+ * RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1, RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2\n+ * or RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST.\n+ *\n+ * The White Balance module allows to specify per-color channel gains, expressed\n+ * as unsigned fixed-point values as 18 bits unsigned integers in Q6.12 format\n+ * with a maximum of 63.999.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1 or\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2 or\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST)\n+ * @gain_red: gain for red component, 18-bit (unsigned Q6.12)\n+ * @gain_green_r: gain for green component in red lines, 18-bit (unsigned Q6.12)\n+ * @gain_blue: gain for blue component, 18-bit (unsigned Q6.12)\n+ * @gain_green_b: gain for green component in blue lines, 18-bit (unsigned Q6.12)\n+ */\n+struct rppx1_awbg_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u32 gain_red;\n+\t__u32 gain_green_r;\n+\t__u32 gain_blue;\n+\t__u32 gain_green_b;\n+};\n+\n+/**\n+ * enum rppx1_exm_mode - Exposure measurement mode\n+ *\n+ * Exaposure measurement mode selection (RGB/Bayer).\n+ *\n+ * @RPPX1_EXP_MEASURING_MODE_DISABLED: no measurement\n+ * @RPPX1_EXP_MEASURING_MODE_RGB: Y/R/G/B measurement\n+ * @RPPX1_EXP_MEASURING_MODE_BAYER: Bayer RGB measurement\n+ */\n+enum rppx1_exm_mode {\n+\tRPPX1_EXP_MEASURING_MODE_DISABLED,\n+\tRPPX1_EXP_MEASURING_MODE_RGB,\n+\tRPPX1_EXP_MEASURING_MODE_BAYER,\n+};\n+\n+/**\n+ * struct rppx1_exm_params - Exposure measurement configuration\n+ *\n+ * The RPP-X1 Exposure measurement unit is available on the PRE1 and PRE2\n+ * pre-fusion pipes. Userspace selects which pipe to operate by setting\n+ * the @header.type field to RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or\n+ * RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2.\n+ *\n+ * Exposure measurement is performed in the RGB or Bayer domain, according to\n+ * the setting of the @mode field. The exposure measurement tap point is\n+ * selected according to the value of @channel_sel.\n+ *\n+ * The exposure measurement is performed on an input window specified in @wnd.\n+ * To each color component a programmable weight coefficient is associated.\n+ * Coefficients are represented as unsigned 8 bits integer values in Q1.7 format\n+ * ranging from 0 to 1.992.\n+ *\n+ * The @last_line fields controls when the exposure measurement completes. It\n+ * is usually programmed to the value of (@wnd.v_offs + @wnd.v_size + 1).\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2)\n+ * @mode: exposure measure mode (from enum rppx1_exm_mode)\n+ * @channel_sel: exposure measurement point (see enum rppx1_meas_chan)\n+ * @last_line: line number for which the exposure measurement completes\n+ * @wnd: measurement window coordinates\n+ * @coeff_r: coefficient for the red Bayer sample or red color channel, Q1.7\n+ * @coeff_g_gr: coefficient for the green/red Bayer sample or green color channel, Q1.7\n+ * @coeff_b: coefficient for the blue Bayer sample or blue color channel, Q1.7\n+ * @coeff_gb: coefficient for the green/blue Bayer sample, unused in RGB mode, Q1.7\n+ */\n+struct rppx1_exm_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u32 mode;\n+\t__u8 channel_sel;\n+\t__u32 last_line;\n+\tstruct rppx1_window wnd;\n+\t__u8 coeff_r;\n+\t__u8 coeff_g_gr;\n+\t__u8 coeff_b;\n+\t__u8 coeff_gb;\n+};\n+\n+/* Histogram */\n+#define RPPX1_HIST_WEIGHT_GRIDS_SIZE 25\n+\n+/**\n+ * enum rppx1_hist_mode - Histogram measurement mode\n+ *\n+ * Histogram measurement mode. Select which channel or combination of channels\n+ * the histogram measurement is performed on.\n+ *\n+ * @RPPX1_HIST_MODE_DISABLE: histogram disabled\n+ * @RPPX1_HIST_MODE_RGB_COMBINED: combined RGB histogram\n+ * @RPPX1_HIST_MODE_R_HISTOGRAM: red channel histogram\n+ * @RPPX1_HIST_MODE_GR_HISTOGRAM: green/red channel histogram\n+ * @RPPX1_HIST_MODE_B_HISTOGRAM: blue channel histogram\n+ * @RPPX1_HIST_MODE_GB_HISTOGRAM: green/blue histogram\n+ */\n+enum rppx1_hist_mode {\n+\tRPPX1_HIST_MODE_DISABLE,\n+\tRPPX1_HIST_MODE_RGB_COMBINED,\n+\tRPPX1_HIST_MODE_R_HISTOGRAM,\n+\tRPPX1_HIST_MODE_GR_HISTOGRAM,\n+\tRPPX1_HIST_MODE_B_HISTOGRAM,\n+\tRPPX1_HIST_MODE_GB_HISTOGRAM,\n+};\n+\n+/**\n+ * struct rppx1_hist_params - Histogram measurement configuration\n+ *\n+ * The RPP-X1 Histogram measurement unit is available on the PRE1, PRE2 and\n+ * MAIN_POST pipes. Userspace selects which pipe to operate by setting the\n+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,\n+ * RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2 or\n+ * RPPX1_PARAMS_BLOCK_TYPE_HIST_POST.\n+ *\n+ * The histogram measurement point is selected using the @channel field while\n+ * histogram measurement mode is selected using the @mode field.\n+ *\n+ * Histogram measurement is performed by programming subsampling factors using\n+ * the @v_stepsize and @h_step_inc fields and by weighted windowing, by\n+ * programming the size of the measurement window @wnd with @weights associated\n+ * to each cell of the 5x5 measurement grid. Weights are represented as 5 bits\n+ * integer values ranging from 0 to 16.\n+ *\n+ * The @last_line fields controls when the histogram measurement completes. It\n+ * is usually programmed to the value of (@wnd.v_offs + @wnd.v_size - 1).\n+ *\n+ * Histogram values are calculated by applying a per-color channel coefficient\n+ * represented as an 8 bits unsigned Q1.7 integer value. The @sample_offs and\n+ * @sample_shift fields allow to reduce the color dynamic range on which\n+ * histogram data are produced.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2 or\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_HIST_POST)\n+ * @mode: histogram measurement mode (from enum rppx1_hist_mode)\n+ * @channel_sel: histogram measurement point (see enum rppx1_meas_chan)\n+ * @wnd: measurement window coordinates\n+ * @weights: weighting factors for each sub-window (5x5 grid)\n+ * @last_line: line number for which the histogram measurement completes\n+ * @v_stepsize: vertical subsampling divider, 7 bits\n+ * @h_step_inc: horizontal subsampling step counter, 17 bits\n+ * @coeff: R-G-B coefficients, 8 bits unsigned Q1.7\n+ * @sample_offs: sample offset, 24 bits\n+ * @sample_shift: sample shift, 4 bits\n+ */\n+struct rppx1_hist_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 mode;\n+\t__u8 channel_sel;\n+\tstruct rppx1_window wnd;\n+\t__u8 weights[RPPX1_HIST_WEIGHT_GRIDS_SIZE];\n+\t__u32 last_line;\n+\t__u32 v_stepsize;\n+\t__u32 h_step_inc;\n+\t__u8 coeff[3];\n+\t__u32 sample_offs;\n+\t__u8 sample_shift;\n+};\n+\n+/**\n+ * struct rppx1_bls_fixed - BLS fixed subtraction values\n+ *\n+ * Fixed black level values subtracted from sensor data per Bayer channel.\n+ * Negative values result in addition.\n+ *\n+ * The PRE1 pipe BLS module operates on a 24-bits input data and fixed black\n+ * levels are stored as a signed 2's complement representation ranging from\n+ * -2^24 to 2^24-1.\n+ *\n+ * The PRE2 pipe BLS module operates on a 12-bits input data and fixed black\n+ * levels are stored as a signed 2's complement representation ranging from\n+ * -2^12 to 2^12-1.\n+ *\n+ * Userspace is expected to provide fixed black level values with a bit-depth\n+ * matching the one of pipe in use.\n+ *\n+ * These subtraction values are matched with the sensor native Bayer components\n+ * ordering according to the cropping configuration on the input port.\n+ *\n+ * @a: subtraction value for channel A\n+ * @b: subtraction value for channel B\n+ * @c: subtraction value for channel C\n+ * @d: subtraction value for channel D\n+ */\n+struct rppx1_bls_fixed {\n+\t__u32 a;\n+\t__u32 b;\n+\t__u32 c;\n+\t__u32 d;\n+};\n+\n+/**\n+ * enum rppx1_bls_mode - BLS subtraction mode\n+ *\n+ * Select if subtracted black level come from fixed or measured values.\n+ *\n+ * @RPPX1_BLS_MODE_FIXED: subtract fixed values\n+ * @RPPX1_BLS_MODE_MEAS: subtract measured values\n+ */\n+enum rppx1_bls_mode {\n+\tRPPX1_BLS_MODE_FIXED,\n+\tRPPX1_BLS_MODE_MEAS,\n+};\n+\n+/**\n+ * enum rppx1_bls_win_en: BLS measurement configuration\n+ *\n+ * Select the measurement window to use for measured black level values.\n+ *\n+ * @RPPX1_BLS_WIN_EN_OFF: disable measurement\n+ * @RPPX1_BLS_WIN_EN_WIN1: Enable measurement from window 1\n+ * @RPPX1_BLS_WIN_EN_WIN2: enable measurement from window 2\n+ * @RPPX1_BLS_WIN_EN_WIN12: enable measurement from window 1 and window 2\n+ */\n+enum rppx1_bls_win_en {\n+\tRPPX1_BLS_WIN_EN_OFF,\n+\tRPPX1_BLS_WIN_EN_WIN1,\n+\tRPPX1_BLS_WIN_EN_WIN2,\n+\tRPPX1_BLS_WIN_EN_WIN12,\n+};\n+\n+/**\n+ * struct rppx1_bls_params - RPP-X1 Black Level Subtraction Module\n+ *\n+ * The RPP-X1 Black Level Subtraction module is available on the PRE1 and PRE2\n+ * pre-fusion pipes. Userspace selects which pipe to operate by setting the\n+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1 or\n+ * RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2.\n+ *\n+ * The BLS module operates on fixed or measured data according to the setting of\n+ * the @mode field. When RPPX1_BLS_MODE_FIXED is used userspace shall provide\n+ * the per-channel black levels in @fixed. When RPPX1_BLS_MODE_MEAS is used\n+ * userspace shall configure the measurement windows @window1 and optionally\n+ * @window2 to select the optically black pixels region in the input frame. The\n+ * @samples fields controls how many measure samples are used for averaging the\n+ * measured black levels.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1 or\n+ *\t type == RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2)\n+ * @mode: BLS subtraction mode (see enum rppx1_bls_mode)\n+ * @en_windows: BLS measurement mode (see rppx1_bls_win_en)\n+ * @samples: log2 of the number of measured pixels per Bayer position\n+ * @window1: BLS measurement window 1 (14 bits)\n+ * @window2: BLS measurement window 2 (14 bits)\n+ * @fixed: fixed subtraction values (see enum rppx1_bls_fixed)\n+ */\n+struct rppx1_bls_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 mode;\n+\t__u8 en_windows;\n+\t__u8 samples;\n+\tstruct rppx1_window window1;\n+\tstruct rppx1_window window2;\n+\tstruct rppx1_bls_fixed fixed;\n+};\n+\n+/**\n+ * struct rppx1_ccor_params - Color CORrection configuration\n+ *\n+ * The CCOR (Color Correction) module is available on the MAIN_POST pipe. It\n+ * performs color space correction on a pixel-per-pixel basis using a 3x3 matrix\n+ * of coefficients and per-color channel offsets.\n+ *\n+ * The matrix coefficients are represented as 16 bits signed fixed point values\n+ * in Q4.12 format ranging from -8 to +7.999.\n+ *\n+ * The per-channel color offsets are represented as 2's complement values\n+ * stored in 25 bits ranging from -16777216 to 16777215.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST)\n+ * @coeff: color correction matrix coefficients, 16 bits signed Q4.12\n+ * @offset: R, G, B offsets, 2's complement 25 bits\n+ */\n+struct rppx1_ccor_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u16 coeff[3][3];\n+\t__u32 offset[3];\n+};\n+\n+/* Lens Shade Correction */\n+#define RPPX1_LSC_SAMPLES_MAX 17\n+#define RPPX1_LSC_NUM_SECTORS 16\n+\n+/**\n+ * struct rppx1_lsc_params - Lens Shading Correction configuration\n+ *\n+ * The RPP-X1 Lens shading correction module is available on the PRE1 and PRE2\n+ * pre-fusion pipes. Userspace selects which pipe to operate by setting the\n+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1 or\n+ * RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2.\n+ *\n+ * The module applies per-color channel correction factors @r_data, @gr_data,\n+ * @gb_data and @b_data as a 16x16 grid mapped on the image. The size of each\n+ * grid segment is expressed by the @x_sect_size and @y_sect_size arrays. Each\n+ * segment shall be at least 8 pixels in size and the sum of all horizontal\n+ * segments @x_sect_size shall match the input frame size width.\n+ *\n+ * The correction factors values are expressed as unsigned Q2.10 integers\n+ * ranging from 1 to 3.999.\n+ *\n+ * Pre-calculated interpolation factors shall be provided in the @x_grad\n+ * and @y_grad fields, expressed as 12 bits integer values.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_LSC)\n+ * @r_data: correction factors for the red channel in Q2.10 format\n+ * @gr_data: correction factors for the green (red) channel in Q2.10 format\n+ * @gb_data: correction factors for the green (blue) channel in Q2.10 format\n+ * @b_data: correction factors for the blue channel in Q2.10 format\n+ * @x_grad: Interpolation gradients for each horizontal sector (12 bits)\n+ * @y_grad: Interpolation gradients for each vertical sector (12 bits)\n+ * @x_sect_size: Horizontal sectors sizes\n+ * @y_sect_size: Vertical sectors sizes\n+ */\n+struct rppx1_lsc_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u16 r_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];\n+\t__u16 gr_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];\n+\t__u16 gb_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];\n+\t__u16 b_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];\n+\t__u16 x_grad[RPPX1_LSC_NUM_SECTORS];\n+\t__u16 y_grad[RPPX1_LSC_NUM_SECTORS];\n+\t__u16 x_sect_size[RPPX1_LSC_NUM_SECTORS];\n+\t__u16 y_sect_size[RPPX1_LSC_NUM_SECTORS];\n+};\n+\n+/* Gamma Out */\n+#define RPPX1_GA_MAX_SAMPLES 17\n+\n+/**\n+ * enum rppx1_ga_seg_mode - Gamma out curve segmentation mode\n+ *\n+ * Segmentation mode of the 16 input sampling points for the Gamma Out\n+ * Correction module.\n+ *\n+ * @RPPX1_GA_SEG_MODE_LOGARITHMIC: logarithmic-like segmentation mode\n+ * @RPPX1_GA_SEG_MODE_EQUIDISTANT: equidistant segmentation mode\n+ */\n+enum rppx1_ga_seg_mode {\n+\tRPPX1_GA_SEG_MODE_LOGARITHMIC,\n+\tRPPX1_GA_SEG_MODE_EQUIDISTANT\n+};\n+\n+/**\n+ * struct rppx1_ga_params - Gamma Out Correction configuration\n+ *\n+ * The Gamma Out Correction module is available on the Human Vision Output\n+ * Pipe (HV) and the Machine Vision Output Pipe (MV). Userspace selects\n+ * which pipe to operate by setting the @header.type field to\n+ * RPPX1_PARAMS_BLOCK_TYPE_GA_HV or RPPX1_PARAMS_BLOCK_TYPE_GA_MV.\n+ *\n+ * The module allows to apply a @gamma_y gamma correction curve to RGB data\n+ * represented as a table of 16 entries. The 16 input sampling points can be\n+ * equidistant or segmented using a logarithmic scale according to the value of\n+ * @mode.\n+ *\n+ * The gamma curve values are 12 bits on the HV output pipe and 24 bits on the\n+ * MV output pipe. Userspace is expected to provide the curve values with a\n+ * bit-depth matching the one of pipe in use.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_GA_HV or\n+ *\t type = RPPX1_PARAMS_BLOCK_TYPE_GA_MV)\n+ * @mode: gamma curve input segmentation mode (see rppx1_ga_seg_mode)\n+ * @gamma_y: gamma out curve y-axis values\n+ */\n+struct rppx1_ga_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u8 mode;\n+\t__u32 gamma_y[RPPX1_GA_MAX_SAMPLES];\n+};\n+\n+/* Linearization (Sensor De-gamma) */\n+#define RPPX1_LIN_SAMPLE_POINTS_NUM 16\n+#define RPPX1_LIN_DEGAMMA_CURVE_NUM 17\n+\n+/**\n+ * struct rppx1_lin_params - Linearization (Sensor De-gamma) configuration\n+ *\n+ * The RPP-X1 linearization module is available on the PRE1 and PRE2 pre-fusion\n+ * pipes. Userspace selects which pipe to operate by setting the @header.type\n+ * field to RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1 or\n+ * RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2.\n+ *\n+ * The LIN module applies the per-color channel de-gamma linearization curves\n+ * @curve_r, @curve_g and @curve_b defined on the input sampling points @dx.\n+ *\n+ * For the PRE1 pipe the de-gamma curves values are 24-bits, for the PRE2 pipe\n+ * the de-gamma curve values are 12-bits.\n+ *\n+ * For the PRE1 pipe de-gamma module sampling points @dx values are in the range\n+ * [0, 15] (4 bits). For the PRE2 pipe de-gamma module sampling points values\n+ * are in the range [0, 7] (3 bits).\n+ *\n+ * Userspace is expected to provide the curve values and sampling points with a\n+ * bit-depth matching the one of pipe in use.\n+ *\n+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1 or\n+ *\t RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2)\n+ * @curve_r: de-gamma linearization curve for red channel\n+ * @curve_g: de-gamma linearization curve for green channel\n+ * @curve_b: de-gamma linearization curve for blue channel\n+ * @dx: input sampling points\n+ */\n+struct rppx1_lin_params {\n+\tstruct v4l2_isp_params_block_header header;\n+\t__u32 curve_r[RPPX1_LIN_DEGAMMA_CURVE_NUM];\n+\t__u32 curve_g[RPPX1_LIN_DEGAMMA_CURVE_NUM];\n+\t__u32 curve_b[RPPX1_LIN_DEGAMMA_CURVE_NUM];\n+\t__u8 dx[RPPX1_LIN_SAMPLE_POINTS_NUM];\n+};\n+\n+/**\n+ * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks\n+ *\n+ * Some types are reported twice as the same block might be instantiated in\n+ * multiple pipes.\n+ */\n+#define RPPX1_PARAMS_MAX_SIZE\t\t\t\t\t\t\\\n+\t(sizeof(struct rppx1_wbmeas_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_awbg_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_awbg_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_awbg_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_exm_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_exm_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_bls_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_bls_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_ccor_params)\t\t\t+\t\\\n+\tsizeof(struct rppx1_lsc_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_lsc_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_ga_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_ga_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_lin_params)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_lin_params))\n+\n+/* ---------------------------------------------------------------------------\n+ * Statistics Structures\n+ *\n+ * The same ISP block might be instantiated in multiple pipeliness and operate\n+ * on a different bitdepth/precision. For fields of varying length among\n+ * different instances of the same block, use a data type that can accommodate\n+ * the larger bitdepth/precision.\n+ */\n+\n+/**\n+ * enum rppx1_stats_block_type - RPP-X1 extensible stats block types\n+ *\n+ * NOTE: Only append to the enumeration as the numbers are uAPI.\n+ *\n+ * @RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST: post-fusion white-balance measurement\n+ * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE1: pre-fusion pipe1 exposure measurement\n+ * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE2: pre-fusion pipe2 exposure measurement\n+ * @RPPX1_STATS_BLOCK_TYPE_HIST_PRE1: pre-fusion pipe1 histogram\n+ * @RPPX1_STATS_BLOCK_TYPE_HIST_PRE2: pre-fusion pipe2 histogram\n+ * @RPPX1_STATS_BLOCK_TYPE_HIST_POST: post-fusion histogram\n+ */\n+enum rppx1_stats_block_type {\n+\tRPPX1_STATS_BLOCK_TYPE_WBMEAS_POST,\n+\tRPPX1_STATS_BLOCK_TYPE_EXM_PRE1,\n+\tRPPX1_STATS_BLOCK_TYPE_EXM_PRE2,\n+\tRPPX1_STATS_BLOCK_TYPE_HIST_PRE1,\n+\tRPPX1_STATS_BLOCK_TYPE_HIST_PRE2,\n+\tRPPX1_STATS_BLOCK_TYPE_HIST_POST,\n+};\n+\n+/**\n+ * struct rppx1_wbmeas_stats - AWB statistics\n+ *\n+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST)\n+ * @cnt: Number of pixels matched\n+ * @mean_y_or_g: mean Y (or G in RGB mode) value, 24-bit\n+ * @mean_cb_or_b: mean Cb (or B in RGB mode) value, 24-bit\n+ * @mean_cr_or_r: mean Cr (or R in RGB mode) value, 24-bit\n+ */\n+struct rppx1_wbmeas_stats {\n+\tstruct v4l2_isp_block_header header;\n+\t__u32 cnt;\n+\t__u32 mean_y_or_g;\n+\t__u32 mean_cb_or_b;\n+\t__u32 mean_cr_or_r;\n+};\n+\n+/* Exposure Measurement */\n+#define RPPX1_EXM_NUM_WIN 25\n+\n+/**\n+ * struct rppx1_exm_stats - Exposure measurement\n+ *\n+ * RPP-X1 exposure measurement calculates the mean value on 25 programmable\n+ * windows on the input picture.\n+ *\n+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_EXM_PRE1)\n+ * @exp_mean: mean luminance values per block, up to 20-bit\n+ */\n+struct rppx1_exm_stats {\n+\tstruct v4l2_isp_block_header header;\n+\t__u32 exp_mean[RPPX1_EXM_NUM_WIN];\n+};\n+\n+/* Histogram */\n+#define RPPX1_HIST_NUM_BINS 32\n+\n+/**\n+ * struct rppx1_hist_stats - Histogram statistics\n+ *\n+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_HIST_POST)\n+ * @hist_bins: accumulation histogram results in unsigned 20-bit Q16.4 format\n+ */\n+struct rppx1_hist_stats {\n+\tstruct v4l2_isp_block_header header;\n+\t__u32 hist_bins[RPPX1_HIST_NUM_BINS];\n+};\n+\n+/**\n+ * RPPX1_STATS_MAX_SIZE - Maximum size of all RPP-X1 statistics\n+ *\n+ * Some types are reported twice as the same block might be instantiated in\n+ * multiple pipes.\n+ */\n+#define RPPX1_STATS_MAX_SIZE\t\t\t\t\t\t\\\n+\t(sizeof(struct rppx1_wbmeas_stats)\t\t\t+\t\\\n+\tsizeof(struct rppx1_exm_stats)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_exm_stats)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_stats)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_stats)\t\t\t\t+\t\\\n+\tsizeof(struct rppx1_hist_stats))\n+\n+#endif /* __UAPI_RPP_X1_CONFIG_H */\n", "prefixes": [ "06/14" ] }