Patch Detail
Show a patch.
GET /api/1.1/patches/22886/?format=api
{ "id": 22886, "url": "https://patchwork.libcamera.org/api/1.1/patches/22886/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22886/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20250227105733.187611-4-keke.li@amlogic.com>", "date": "2025-02-27T10:57:25", "name": "[v3,03/11] include: linux: Add c3-isp-config.h", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "eb81a8e633646e9a2a5d9b9d520a0927bd904b13", "submitter": { "id": 217, "url": "https://patchwork.libcamera.org/api/1.1/people/217/?format=api", "name": "Keke Li", "email": "keke.li@amlogic.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22886/mbox/", "series": [ { "id": 5027, "url": "https://patchwork.libcamera.org/api/1.1/series/5027/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5027", "date": "2025-02-27T10:57:22", "name": "Add Amlogic C3 ISP pipeline handler and IPA", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5027/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22886/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22886/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 A59BABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 Feb 2025 10:57:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4CA0068753;\n\tThu, 27 Feb 2025 11:57:48 +0100 (CET)", "from mail-sh.amlogic.com (unknown [58.32.228.46])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0517F68754\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Feb 2025 11:57:41 +0100 (CET)", "from droid10.amlogic.com (10.18.11.213) by mail-sh.amlogic.com\n\t(10.18.11.5) with Microsoft SMTP Server id 15.1.2507.39;\n\tThu, 27 Feb 2025 18:57:37 +0800" ], "From": "Keke Li <keke.li@amlogic.com>", "To": "<libcamera-devel@lists.libcamera.org>", "CC": "<kieran.bingham@ideasonboard.com>, <laurent.pinchart@ideasonboard.com>, \n\t<dan.scally@ideasonboard.com>, Keke Li <keke.li@amlogic.com>", "Subject": "[PATCH v3 03/11] include: linux: Add c3-isp-config.h", "Date": "Thu, 27 Feb 2025 18:57:25 +0800", "Message-ID": "<20250227105733.187611-4-keke.li@amlogic.com>", "X-Mailer": "git-send-email 2.29.0", "In-Reply-To": "<20250227105733.187611-1-keke.li@amlogic.com>", "References": "<20250227105733.187611-1-keke.li@amlogic.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[10.18.11.213]", "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 header file describing the C3 ISP's 3A statistics and\nparameters structures so that they can be used by the new IPA module.\n\nThe header is a temporary addition and has been taken from the v6 of\nthe patchset for the C3 ISP driver submitted to linux-media, found at\nthe link below:\n\nhttps://lore.kernel.org/linux-media/20250227-c3isp-v6-7-f72e19084d0d@amlogic.com/\n\nSigned-off-by: Keke Li <keke.li@amlogic.com>\n---\n include/linux/c3-isp-config.h | 564 ++++++++++++++++++++++++++++++++++\n 1 file changed, 564 insertions(+)\n create mode 100644 include/linux/c3-isp-config.h", "diff": "diff --git a/include/linux/c3-isp-config.h b/include/linux/c3-isp-config.h\nnew file mode 100644\nindex 00000000..ed085ea6\n--- /dev/null\n+++ b/include/linux/c3-isp-config.h\n@@ -0,0 +1,564 @@\n+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */\n+/*\n+ * Copyright (C) 2024 Amlogic, Inc. All rights reserved\n+ */\n+\n+#ifndef _UAPI_C3_ISP_CONFIG_H_\n+#define _UAPI_C3_ISP_CONFIG_H_\n+\n+#include <linux/types.h>\n+\n+/*\n+ * Frames are split into zones of almost equal width and height - a zone is a\n+ * rectangular tile of a frame. The metering blocks within the ISP collect\n+ * aggregated statistics per zone.\n+ */\n+#define C3_ISP_AE_MAX_ZONES (17 * 15)\n+#define C3_ISP_AF_MAX_ZONES (17 * 15)\n+#define C3_ISP_AWB_MAX_ZONES (32 * 24)\n+\n+/* The maximum number of point on the diagonal of the frame for statistics */\n+#define C3_ISP_AE_MAX_PT_NUM 18\n+#define C3_ISP_AF_MAX_PT_NUM 18\n+#define C3_ISP_AWB_MAX_PT_NUM 33\n+\n+/**\n+ * struct c3_isp_awb_zone_stats - AWB statistics of a zone\n+ *\n+ * AWB zone stats is aligned with 8 bytes\n+ *\n+ * @rg: the ratio of R / G in a zone\n+ * @bg: the ratio of B / G in a zone\n+ * @pixel_sum: the total number of pixels used in a zone\n+ */\n+struct c3_isp_awb_zone_stats {\n+\t__u16 rg;\n+\t__u16 bg;\n+\t__u32 pixel_sum;\n+};\n+\n+/**\n+ * struct c3_isp_awb_stats - Auto white balance statistics information.\n+ *\n+ * AWB statistical information of all zones.\n+ *\n+ * @stats: array of auto white balance statistics\n+ */\n+struct c3_isp_awb_stats {\n+\tstruct c3_isp_awb_zone_stats stats[C3_ISP_AWB_MAX_ZONES];\n+} __attribute__((aligned(16)));\n+\n+/**\n+ * struct c3_isp_ae_zone_stats - AE statistics of a zone\n+ *\n+ * AE zone stats is aligned with 8 bytes.\n+ * This is a 5-bin histogram and the total sum is normalized to 0xffff.\n+ * So hist2 = 0xffff - (hist0 + hist1 + hist3 + hist4)\n+ *\n+ * @hist0: the global normalized pixel count for bin 0\n+ * @hist1: the global normalized pixel count for bin 1\n+ * @hist3: the global normalized pixel count for bin 3\n+ * @hist4: the global normalized pixel count for bin 4\n+ */\n+struct c3_isp_ae_zone_stats {\n+\t__u16 hist0;\n+\t__u16 hist1;\n+\t__u16 hist3;\n+\t__u16 hist4;\n+};\n+\n+/**\n+ * struct c3_isp_ae_stats - Exposure statistics information\n+ *\n+ * AE statistical information consists of all blocks information and a 1024-bin\n+ * histogram.\n+ *\n+ * @stats: array of auto exposure block statistics\n+ * @reserved: undefined buffer space\n+ * @hist: a 1024-bin histogram for the entire image\n+ */\n+struct c3_isp_ae_stats {\n+\tstruct c3_isp_ae_zone_stats stats[C3_ISP_AE_MAX_ZONES];\n+\t__u32 reserved[2];\n+\t__u32 hist[1024];\n+} __attribute__((aligned(16)));\n+\n+/**\n+ * struct c3_isp_af_zone_stats - AF statistics of a zone\n+ *\n+ * AF zone stats is aligned with 8 bytes.\n+ * The zonal accumulated contrast metrics are stored in floating point format\n+ * with 16 bits mantissa and 5 or 6 bits exponent. Apart from contrast metrics\n+ * we accumulate squared image and quartic image data over the zone.\n+ *\n+ * @i2_mat: the mantissa of zonal squared image pixel sum\n+ * @i4_mat: the mantissa of zonal quartic image pixel sum\n+ * @e4_mat: the mantissa of zonal multi-directional quartic edge sum\n+ * @e4_exp: the exponent of zonal multi-directional quartic edge sum\n+ * @i2_exp: the exponent of zonal squared image pixel sum\n+ * @i4_exp: the exponent of zonal quartic image pixel sum\n+ */\n+struct c3_isp_af_zone_stats {\n+\t__u16 i2_mat;\n+\t__u16 i4_mat;\n+\t__u16 e4_mat;\n+\t__u16 e4_exp : 5;\n+\t__u16 i2_exp : 5;\n+\t__u16 i4_exp : 6;\n+};\n+\n+/**\n+ * struct c3_isp_af_stats - Auto Focus statistics information\n+ *\n+ * AF statistical information of each zone\n+ *\n+ * @stats: array of auto focus block statistics\n+ * @reserved: undefined buffer space\n+ */\n+struct c3_isp_af_stats {\n+\tstruct c3_isp_af_zone_stats stats[C3_ISP_AF_MAX_ZONES];\n+\t__u32 reserved[2];\n+} __attribute__((aligned(16)));\n+\n+/**\n+ * struct c3_isp_stats_info - V4L2_META_FMT_C3ISP_STATS\n+ *\n+ * Contains ISP statistics\n+ *\n+ * @awb: auto white balance stats\n+ * @ae: auto exposure stats\n+ * @af: auto focus stats\n+ */\n+struct c3_isp_stats_info {\n+\tstruct c3_isp_awb_stats awb;\n+\tstruct c3_isp_ae_stats ae;\n+\tstruct c3_isp_af_stats af;\n+};\n+\n+/**\n+ * enum c3_isp_params_buffer_version - C3 ISP parameters block versioning\n+ *\n+ * @C3_ISP_PARAMS_BUFFER_V0: First version of C3 ISP parameters block\n+ */\n+enum c3_isp_params_buffer_version {\n+\tC3_ISP_PARAMS_BUFFER_V0,\n+};\n+\n+/**\n+ * enum c3_isp_params_block_type - Enumeration of C3 ISP parameter blocks\n+ *\n+ * Each block configures a specific processing block of the C3 ISP.\n+ * The block type allows the driver to correctly interpret the parameters block\n+ * data.\n+ *\n+ * @C3_ISP_PARAMS_BLOCK_AWB_GAINS: White balance gains\n+ * @C3_ISP_PARAMS_BLOCK_AWB_CONFIG: AWB statistic format configuration for all\n+ * blocks that control how stats are generated\n+ * @C3_ISP_PARAMS_BLOCK_AE_CONFIG: AE statistic format configuration for all\n+ * blocks that control how stats are generated\n+ * @C3_ISP_PARAMS_BLOCK_AF_CONFIG: AF statistic format configuration for all\n+ * blocks that control how stats are generated\n+ * @C3_ISP_PARAMS_BLOCK_PST_GAMMA: post gamma parameters\n+ * @C3_ISP_PARAMS_BLOCK_CCM: Color correction matrix parameters\n+ * @C3_ISP_PARAMS_BLOCK_CSC: Color space conversion parameters\n+ * @C3_ISP_PARAMS_BLOCK_BLC: Black level correction parameters\n+ * @C3_ISP_PARAMS_BLOCK_SENTINEL: First non-valid block index\n+ */\n+enum c3_isp_params_block_type {\n+\tC3_ISP_PARAMS_BLOCK_AWB_GAINS,\n+\tC3_ISP_PARAMS_BLOCK_AWB_CONFIG,\n+\tC3_ISP_PARAMS_BLOCK_AE_CONFIG,\n+\tC3_ISP_PARAMS_BLOCK_AF_CONFIG,\n+\tC3_ISP_PARAMS_BLOCK_PST_GAMMA,\n+\tC3_ISP_PARAMS_BLOCK_CCM,\n+\tC3_ISP_PARAMS_BLOCK_CSC,\n+\tC3_ISP_PARAMS_BLOCK_BLC,\n+\tC3_ISP_PARAMS_BLOCK_SENTINEL\n+};\n+\n+#define C3_ISP_PARAMS_BLOCK_FL_DISABLE (1U << 0)\n+#define C3_ISP_PARAMS_BLOCK_FL_ENABLE (1U << 1)\n+\n+/**\n+ * struct c3_isp_params_block_header - C3 ISP parameter block header\n+ *\n+ * This structure represents the common part of all the ISP configuration\n+ * blocks. Each parameters block shall embed an instance of this structure type\n+ * as its first member, followed by the block-specific configuration data. The\n+ * driver inspects this common header to discern the block type and its size and\n+ * properly handle the block content by casting it to the correct block-specific\n+ * type.\n+ *\n+ * The @type field is one of the values enumerated by\n+ * :c:type:`c3_isp_params_block_type` and specifies how the data should be\n+ * interpreted by the driver. The @size field specifies the size of the\n+ * parameters block and is used by the driver for validation purposes. The\n+ * @flags field is a bitmask of per-block flags C3_ISP_PARAMS_FL*.\n+ *\n+ * When userspace wants to disable an ISP block the\n+ * C3_ISP_PARAMS_BLOCK_FL_DISABLED bit should be set in the @flags field. In\n+ * this case userspace may optionally omit the remainder of the configuration\n+ * block, which will be ignored by the driver.\n+ *\n+ * When a new configuration of an ISP block needs to be applied userspace\n+ * shall fully populate the ISP block and omit setting the\n+ * C3_ISP_PARAMS_BLOCK_FL_DISABLED bit in the @flags field.\n+ *\n+ * Userspace is responsible for correctly populating the parameters block header\n+ * fields (@type, @flags and @size) and the block-specific parameters.\n+ *\n+ * For example:\n+ *\n+ * .. code-block:: c\n+ *\n+ *\tvoid populate_pst_gamma(struct c3_isp_params_block_header *block) {\n+ *\t\tstruct c3_isp_params_pst_gamma *gamma =\n+ *\t\t\t(struct c3_isp_params_pst_gamma *)block;\n+ *\n+ *\t\tgamma->header.type = C3_ISP_PARAMS_BLOCK_PST_GAMMA;\n+ *\t\tgamma->header.flags = C3_ISP_PARAMS_BLOCK_FL_ENABLE;\n+ *\t\tgamma->header.size = sizeof(*gamma);\n+ *\n+ *\t\tfor (unsigned int i = 0; i < 129; i++)\n+ *\t\t\tgamma->pst_gamma_lut[i] = i;\n+ *\t}\n+ *\n+ * @type: The parameters block type from :c:type:`c3_isp_params_block_type`\n+ * @flags: A bitmask of block flags\n+ * @size: Size (in bytes) of the parameters block, including this header\n+ */\n+struct c3_isp_params_block_header {\n+\t__u16 type;\n+\t__u16 flags;\n+\t__u32 size;\n+};\n+\n+/**\n+ * struct c3_isp_params_awb_gains - Gains for auto-white balance\n+ *\n+ * This struct allows users to configure the gains for white balance.\n+ * There are four gain settings corresponding to each colour channel in\n+ * the bayer domain. All of the gains are stored in Q4.8 format.\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_AWB_GAINS\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: The C3 ISP parameters block header\n+ * @gr_gain: Multiplier for Gr channel (Q4.8 format)\n+ * @r_gain: Multiplier for R channel (Q4.8 format)\n+ * @b_gain: Multiplier for B channel (Q4.8 format)\n+ * @gb_gain: Multiplier for Gb channel (Q4.8 format)\n+ */\n+struct c3_isp_params_awb_gains {\n+\tstruct c3_isp_params_block_header header;\n+\t__u16 gr_gain;\n+\t__u16 r_gain;\n+\t__u16 b_gain;\n+\t__u16 gb_gain;\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * enum c3_isp_params_awb_tap_points - Tap points for the AWB statistics\n+ * @C3_ISP_AWB_STATS_TAP_OFE: immediately after the optical frontend block\n+ * @C3_ISP_AWB_STATS_TAP_GE: immediately after the green equal block\n+ * @C3_ISP_AWB_STATS_TAP_BEFORE_WB: immediately before the white balance block\n+ * @C3_ISP_AWB_STATS_TAP_AFTER_WB: immediately after the white balance block\n+ */\n+enum c3_isp_params_awb_tap_points {\n+\tC3_ISP_AWB_STATS_TAP_OFE = 0,\n+\tC3_ISP_AWB_STATS_TAP_GE,\n+\tC3_ISP_AWB_STATS_TAP_BEFORE_WB,\n+\tC3_ISP_AWB_STATS_TAP_AFTER_WB,\n+};\n+\n+/**\n+ * struct c3_isp_params_awb_config - Stats settings for auto-white balance\n+ *\n+ * This struct allows the configuration of the statistics generated for auto\n+ * white balance.\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_AWB_CONFIG\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @tap_point: the tap point from enum c3_isp_params_awb_tap_point\n+ * @satur_vald: AWB statistic over saturation control\n+ *\t\tvalue: 0: disable, 1: enable\n+ * @horiz_zones_num: active number of hotizontal zones [0..32]\n+ * @vert_zones_num: active number of vertical zones [0..24]\n+ * @rg_min: minimum R/G ratio (Q4.8 format)\n+ * @rg_max: maximum R/G ratio (Q4.8 format)\n+ * @bg_min: minimum B/G ratio (Q4.8 format)\n+ * @bg_max: maximum B/G ratio (Q4.8 format)\n+ * @rg_low: R/G ratio trim low (Q4.8 format)\n+ * @rg_high: R/G ratio trim hight (Q4.8 format)\n+ * @bg_low: B/G ratio trim low (Q4.8 format)\n+ * @bg_high: B/G ratio trim high (Q4.8 format)\n+ * @zone_weight: array of weights for AWB statistics zones [0..15]\n+ * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888]\n+ * @vert_coord: the vertical coordinate of points on the diagonal [0..2240]\n+ */\n+struct c3_isp_params_awb_config {\n+\tstruct c3_isp_params_block_header header;\n+\t__u8 tap_point;\n+\t__u8 satur_vald;\n+\t__u8 horiz_zones_num;\n+\t__u8 vert_zones_num;\n+\t__u16 rg_min;\n+\t__u16 rg_max;\n+\t__u16 bg_min;\n+\t__u16 bg_max;\n+\t__u16 rg_low;\n+\t__u16 rg_high;\n+\t__u16 bg_low;\n+\t__u16 bg_high;\n+\t__u8 zone_weight[C3_ISP_AWB_MAX_ZONES];\n+\t__u16 horiz_coord[C3_ISP_AWB_MAX_PT_NUM];\n+\t__u16 vert_coord[C3_ISP_AWB_MAX_PT_NUM];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * enum c3_isp_params_ae_tap_points - Tap points for the AE statistics\n+ * @C3_ISP_AE_STATS_TAP_GE: immediately after the green equal block\n+ * @C3_ISP_AE_STATS_TAP_MLS: immediately after the mesh lens shading block\n+ */\n+enum c3_isp_params_ae_tap_points {\n+\tC3_ISP_AE_STATS_TAP_GE = 0,\n+\tC3_ISP_AE_STATS_TAP_MLS,\n+};\n+\n+/**\n+ * struct c3_isp_params_ae_config - Stats settings for auto-exposure\n+ *\n+ * This struct allows the configuration of the statistics generated for\n+ * auto exposure.\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_AE_CONFIG\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @horiz_zones_num: active number of horizontal zones [0..17]\n+ * @vert_zones_num: active number of vertical zones [0..15]\n+ * @tap_point: the tap point from enum c3_isp_params_ae_tap_point\n+ * @zone_weight: array of weights for AE statistics zones [0..15]\n+ * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888]\n+ * @vert_coord: the vertical coordinate of points on the diagonal [0..2240]\n+ * @reserved: applications must zero this array\n+ */\n+struct c3_isp_params_ae_config {\n+\tstruct c3_isp_params_block_header header;\n+\t__u8 tap_point;\n+\t__u8 horiz_zones_num;\n+\t__u8 vert_zones_num;\n+\t__u8 zone_weight[C3_ISP_AE_MAX_ZONES];\n+\t__u16 horiz_coord[C3_ISP_AE_MAX_PT_NUM];\n+\t__u16 vert_coord[C3_ISP_AE_MAX_PT_NUM];\n+\t__u16 reserved[3];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * enum c3_isp_params_af_tap_points - Tap points for the AF statistics\n+ * @C3_ISP_AF_STATS_TAP_SNR: immediately after the spatial noise reduce block\n+ * @C3_ISP_AF_STATS_TAP_DMS: immediately after the demosaic block\n+ */\n+enum c3_isp_params_af_tap_points {\n+\tC3_ISP_AF_STATS_TAP_SNR = 0,\n+\tC3_ISP_AF_STATS_TAP_DMS,\n+};\n+\n+/**\n+ * struct c3_isp_params_af_config - Stats settings for auto-focus\n+ *\n+ * This struct allows the configuration of the statistics generated for\n+ * auto focus.\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_AF_CONFIG\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @tap_point: the tap point from enum c3_isp_params_af_tap_point\n+ * @horiz_zones_num: active number of hotizontal zones [0..17]\n+ * @vert_zones_num: active number of vertical zones [0..15]\n+ * @reserved: applications must zero this array\n+ * @horiz_coord: the horizontal coordinate of points on the diagonal [0..2888]\n+ * @vert_coord: the vertical coordinate of points on the diagonal [0..2240]\n+ */\n+struct c3_isp_params_af_config {\n+\tstruct c3_isp_params_block_header header;\n+\t__u8 tap_point;\n+\t__u8 horiz_zones_num;\n+\t__u8 vert_zones_num;\n+\t__u8 reserved[5];\n+\t__u16 horiz_coord[C3_ISP_AF_MAX_PT_NUM];\n+\t__u16 vert_coord[C3_ISP_AF_MAX_PT_NUM];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct c3_isp_params_pst_gamma - Post gamma configuration\n+ *\n+ * This struct allows the configuration of the look up table for\n+ * post gamma. The gamma curve consists of 129 points, so need to\n+ * set lut[129].\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_PST_GAMMA\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @lut: lookup table for P-Stitch gamma [0..1023]\n+ * @reserved: applications must zero this array\n+ */\n+struct c3_isp_params_pst_gamma {\n+\tstruct c3_isp_params_block_header header;\n+\t__u16 lut[129];\n+\t__u16 reserved[3];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct c3_isp_params_ccm - ISP CCM configuration\n+ *\n+ * This struct allows the configuration of the matrix for\n+ * color correction. The matrix consists of 3 x 3 points,\n+ * so need to set matrix[3][3].\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_CCM\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @matrix: a 3 x 3 matrix used for color correction,\n+ * the value of matrix[x][y] is orig_value x 256. [-4096..4095]\n+ * @reserved: applications must zero this array\n+ */\n+struct c3_isp_params_ccm {\n+\tstruct c3_isp_params_block_header header;\n+\t__s16 matrix[3][3];\n+\t__u16 reserved[3];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct c3_isp_params_csc - ISP Color Space Conversion configuration\n+ *\n+ * This struct allows the configuration of the matrix for color space\n+ * conversion. The matrix consists of 3 x 3 points, so need to set matrix[3][3].\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_CSC\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @matrix: a 3x3 matrix used for the color space conversion,\n+ * the value of matrix[x][y] is orig_value x 256. [-4096..4095]\n+ * @reserved: applications must zero this array\n+ */\n+struct c3_isp_params_csc {\n+\tstruct c3_isp_params_block_header header;\n+\t__s16 matrix[3][3];\n+\t__u16 reserved[3];\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct c3_isp_params_blc - ISP Black Level Correction configuration\n+ *\n+ * This struct allows the configuration of the block level offset for each\n+ * color channel.\n+ *\n+ * header.type should be set to C3_ISP_PARAMS_BLOCK_BLC\n+ * from :c:type:`c3_isp_params_block_type`\n+ *\n+ * @header: the C3 ISP parameters block header\n+ * @gr_ofst: Gr blc offset (Q4.12 format)\n+ * @r_ofst: R blc offset (Q4.12 format)\n+ * @b_ofst: B blc offset (Q4.12 format)\n+ * @gb_ofst: Gb blc offset(Q4.12 format)\n+ */\n+struct c3_isp_params_blc {\n+\tstruct c3_isp_params_block_header header;\n+\t__u16 gr_ofst;\n+\t__u16 r_ofst;\n+\t__u16 b_ofst;\n+\t__u16 gb_ofst;\n+};\n+\n+/**\n+ * define C3_ISP_PARAMS_MAX_SIZE - Maximum size of all C3 ISP Parameters\n+ *\n+ * Though the parameters for the C3 ISP are passed as optional blocks, the\n+ * driver still needs to know the absolute maximum size so that it can allocate\n+ * a buffer sized appropriately to accommodate userspace attempting to set all\n+ * possible parameters in a single frame.\n+ */\n+#define C3_ISP_PARAMS_MAX_SIZE \\\n+\t(sizeof(struct c3_isp_params_awb_gains) + \\\n+\t sizeof(struct c3_isp_params_awb_config) + \\\n+\t sizeof(struct c3_isp_params_ae_config) + \\\n+\t sizeof(struct c3_isp_params_af_config) + \\\n+\t sizeof(struct c3_isp_params_pst_gamma) + \\\n+\t sizeof(struct c3_isp_params_ccm) + \\\n+\t sizeof(struct c3_isp_params_csc) + \\\n+\t sizeof(struct c3_isp_params_blc))\n+\n+/**\n+ * struct c3_isp_params_cfg - C3 ISP configuration parameters\n+ *\n+ * This struct contains the configuration parameters of the C3 ISP\n+ * algorithms, serialized by userspace into an opaque data buffer. Each\n+ * configuration parameter block is represented by a block-specific structure\n+ * which contains a :c:type:`c3_isp_param_block_header` entry as first\n+ * member. Userspace populates the @data buffer with configuration parameters\n+ * for the blocks that it intends to configure. As a consequence, the data\n+ * buffer effective size changes according to the number of ISP blocks that\n+ * userspace intends to configure.\n+ *\n+ * The parameters buffer is versioned by the @version field to allow modifying\n+ * and extending its definition. Userspace should populate the @version field to\n+ * inform the driver about the version it intends to use. The driver will parse\n+ * and handle the @data buffer according to the data layout specific to the\n+ * indicated revision and return an error if the desired revision is not\n+ * supported.\n+ *\n+ * For each ISP block that userspace wants to configure, a block-specific\n+ * structure is appended to the @data buffer, one after the other without gaps\n+ * in between nor overlaps. Userspace shall populate the @total_size field with\n+ * the effective size, in bytes, of the @data buffer.\n+ *\n+ * The expected memory layout of the parameters buffer is::\n+ *\n+ *\t+-------------------- struct c3_isp_params_cfg ---- ------------------+\n+ *\t| version = C3_ISP_PARAM_BUFFER_V0; |\n+ *\t| data_size = sizeof(struct c3_isp_params_awb_gains) + |\n+ *\t| sizeof(struct c3_isp_params_awb_config); |\n+ *\t| +------------------------- data ---------------------------------+ |\n+ *\t| | +------------ struct c3_isp_params_awb_gains) ------------------+ |\n+ *\t| | | +--------- struct c3_isp_params_block_header header -----+ | | |\n+ *\t| | | | type = C3_ISP_PARAMS_BLOCK_AWB_GAINS; | | | |\n+ *\t| | | | flags = C3_ISP_PARAMS_BLOCK_FL_NONE; | | | |\n+ *\t| | | | size = sizeof(struct c3_isp_params_awb_gains); | | | |\n+ *\t| | | +---------------------------------------------------------+ | | |\n+ *\t| | | gr_gain = ...; | | |\n+ *\t| | | r_gain = ...; | | |\n+ *\t| | | b_gain = ...; | | |\n+ *\t| | | gb_gain = ...; | | |\n+ *\t| | +------------------ struct c3_isp_params_awb_config ----------+ | |\n+ *\t| | | +---------- struct c3_isp_param_block_header header ------+ | | |\n+ *\t| | | | type = C3_ISP_PARAMS_BLOCK_AWB_CONFIG; | | | |\n+ *\t| | | | flags = C3_ISP_PARAMS_BLOCK_FL_NONE; | | | |\n+ *\t| | | | size = sizeof(struct c3_isp_params_awb_config) | | | |\n+ *\t| | | +---------------------------------------------------------+ | | |\n+ *\t| | | tap_point = ...; | | |\n+ *\t| | | satur_vald = ...; | | |\n+ *\t| | | horiz_zones_num = ...; | | |\n+ *\t| | | vert_zones_num = ...; | | |\n+ *\t| | +-------------------------------------------------------------+ | |\n+ *\t| +-----------------------------------------------------------------+ |\n+ *\t+---------------------------------------------------------------------+\n+ *\n+ * @version: The C3 ISP parameters buffer version\n+ * @data_size: The C3 ISP configuration data effective size, excluding this\n+ * header\n+ * @data: The C3 ISP configuration blocks data\n+ */\n+struct c3_isp_params_cfg {\n+\t__u32 version;\n+\t__u32 data_size;\n+\t__u8 data[C3_ISP_PARAMS_MAX_SIZE];\n+};\n+\n+#endif\n", "prefixes": [ "v3", "03/11" ] }