[{"id":30906,"web_url":"https://patchwork.libcamera.org/comment/30906/","msgid":"<uz55627upbrztnnkytphcxda7rgutpurgd3o264zku4uj7yzo7@izvxa57d7x7q>","date":"2024-08-27T06:47:08","subject":"Re: [PATCH v4 1/9] include: linux: Update headers for rkisp1\n\textensible parameters","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Tue, Aug 27, 2024 at 04:40:35AM GMT, Laurent Pinchart wrote:\n> From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n>\n> Update the kernel headers with the definitions for the rkisp1 extensible\n> parameters format.\n>\n> The headers have been generated from the most recent linux-media stage\n> tree master branch, at commit a043ea54bbb9 (\"Merge tag\n> 'next-media-rkisp1-20240814' of\n> git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git\").\n\nWhy not use the official git://linuxtv.org/media_stage.git ?\n\n>\n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Acked-by: Paul Elder <paul.elder@ideasonboard.com>\n> Acked-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  include/linux/README          |   2 +-\n>  include/linux/dma-heap.h      |   2 +-\n>  include/linux/drm_fourcc.h    |  18 ++\n>  include/linux/rkisp1-config.h | 578 ++++++++++++++++++++++++++++++++++\n>  include/linux/v4l2-controls.h |   2 +\n>  include/linux/videodev2.h     |   5 +-\n>  6 files changed, 603 insertions(+), 4 deletions(-)\n>\n> diff --git a/include/linux/README b/include/linux/README\n> index b7795309a216..ef178681f6eb 100644\n> --- a/include/linux/README\n> +++ b/include/linux/README\n> @@ -1,4 +1,4 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>\n> -Files in this directory are imported from v6.10-rc1 of the Linux kernel. Do not\n> +Files in this directory are imported from next-media-rkisp1-20240814-14-ga043ea54bbb9 of the Linux kernel. Do not\n>  modify them manually.\n> diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h\n> index 96b90cf0f8f7..63b1e9ed5200 100644\n> --- a/include/linux/dma-heap.h\n> +++ b/include/linux/dma-heap.h\n> @@ -19,7 +19,7 @@\n>  #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)\n>\n>  /* Currently no heap flags */\n> -#define DMA_HEAP_VALID_HEAP_FLAGS (0)\n> +#define DMA_HEAP_VALID_HEAP_FLAGS (0ULL)\n\nIs this related ?\n\n>\n>  /**\n>   * struct dma_heap_allocation_data - metadata passed from userspace for\n> diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\n> index d8e999400d85..db6798776663 100644\n> --- a/include/linux/drm_fourcc.h\n> +++ b/include/linux/drm_fourcc.h\n> @@ -1556,6 +1556,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n>  #define AMD_FMT_MOD_TILE_VER_GFX10 2\n>  #define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3\n>  #define AMD_FMT_MOD_TILE_VER_GFX11 4\n> +#define AMD_FMT_MOD_TILE_VER_GFX12 5\n>\n>  /*\n>   * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical\n> @@ -1566,6 +1567,8 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n>  /*\n>   * 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has\n>   * GFX9 as canonical version.\n> + *\n> + * 64K_D_2D on GFX12 is identical to 64K_D on GFX11.\n>   */\n>  #define AMD_FMT_MOD_TILE_GFX9_64K_D 10\n>  #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25\n> @@ -1573,6 +1576,21 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n>  #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27\n>  #define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31\n>\n> +/* Gfx12 swizzle modes:\n> + *    0 - LINEAR\n> + *    1 - 256B_2D  - 2D block dimensions\n> + *    2 - 4KB_2D\n> + *    3 - 64KB_2D\n> + *    4 - 256KB_2D\n> + *    5 - 4KB_3D   - 3D block dimensions\n> + *    6 - 64KB_3D\n> + *    7 - 256KB_3D\n> + */\n> +#define AMD_FMT_MOD_TILE_GFX12_256B_2D 1\n> +#define AMD_FMT_MOD_TILE_GFX12_4K_2D 2\n> +#define AMD_FMT_MOD_TILE_GFX12_64K_2D 3\n> +#define AMD_FMT_MOD_TILE_GFX12_256K_2D 4\n> +\n\nI take this as an overall headers update, not just the rkisp1 bits. Is\nthis intentional ?\n\n>  #define AMD_FMT_MOD_DCC_BLOCK_64B 0\n>  #define AMD_FMT_MOD_DCC_BLOCK_128B 1\n>  #define AMD_FMT_MOD_DCC_BLOCK_256B 2\n> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\n> index f87c6bd49a5b..edbc6cb65d1c 100644\n> --- a/include/linux/rkisp1-config.h\n> +++ b/include/linux/rkisp1-config.h\n> @@ -164,6 +164,11 @@\n>  #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS      17\n>  #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS  6\n>\n> +/*\n> + * Compand\n> + */\n> +#define RKISP1_CIF_ISP_COMPAND_NUM_POINTS\t64\n> +\n>  /*\n>   * Measurement types\n>   */\n> @@ -851,6 +856,39 @@ struct rkisp1_params_cfg {\n>  \tstruct rkisp1_cif_isp_isp_other_cfg others;\n>  };\n>\n> +/**\n> + * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS)\n> + * @r: Fixed subtraction value for Bayer pattern R\n> + * @gr: Fixed subtraction value for Bayer pattern Gr\n> + * @gb: Fixed subtraction value for Bayer pattern Gb\n> + * @b: Fixed subtraction value for Bayer pattern B\n> + *\n> + * The values will be subtracted from the sensor values. Note that unlike the\n> + * dedicated BLS block, the BLS values in the compander are 20-bit unsigned.\n> + */\n> +struct rkisp1_cif_isp_compand_bls_config {\n> +\t__u32 r;\n> +\t__u32 gr;\n> +\t__u32 gb;\n> +\t__u32 b;\n> +};\n> +\n> +/**\n> + * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding\n> + * parameters (expand and compression curves)\n> + * @px: Compand curve x-values. Each value stores the distance from the\n> + *      previous x-value, expressed as log2 of the distance on 5 bits.\n> + * @x: Compand curve x-values. The functionality of these parameters are\n> + *     unknown due to do a lack of hardware documentation, but these are left\n> + *     here for future compatibility purposes.\n> + * @y: Compand curve y-values\n> + */\n> +struct rkisp1_cif_isp_compand_curve_config {\n> +\t__u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> +\t__u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> +\t__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> +};\n> +\n>  /*---------- PART2: Measurement Statistics ------------*/\n>\n>  /**\n> @@ -996,4 +1034,544 @@ struct rkisp1_stat_buffer {\n>  \tstruct rkisp1_cif_isp_stat params;\n>  };\n>\n> +/*---------- PART3: Extensible Configuration Parameters  ------------*/\n> +\n> +/**\n> + * enum rkisp1_ext_params_block_type - RkISP1 extensible params block type\n> + *\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve\n> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve\n> + */\n> +enum rkisp1_ext_params_block_type {\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_SDG,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_FLT,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_BDM,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_CTK,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_GOC,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPF,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_IE,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_LSC,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,\n> +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,\n> +};\n> +\n> +#define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> +#define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\n> +\n> +/**\n> + * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block\n> + *\t\t\t\t\t   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:`rkisp1_ext_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.\n> + *\n> + * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*.\n> + *\n> + * When userspace wants to configure and enable an ISP block it shall fully\n> + * populate the block configuration and set the\n> + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field.\n> + *\n> + * When userspace simply wants to disable an ISP block the\n> + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The\n> + * driver ignores the rest of the block configuration structure in this case.\n> + *\n> + * If a new configuration of an ISP block has to be applied userspace shall\n> + * fully populate the ISP block configuration and omit setting the\n> + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits\n> + * in the @flags field.\n> + *\n> + * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and\n> + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed\n> + * and not accepted by the driver.\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_bls(struct rkisp1_ext_params_block_header *block) {\n> + *\t\tstruct rkisp1_ext_params_bls_config *bls =\n> + *\t\t\t(struct rkisp1_ext_params_bls_config *)block;\n> + *\n> + *\t\tbls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS;\n> + *\t\tbls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;\n> + *\t\tbls->header.size = sizeof(*bls);\n> + *\n> + *\t\tbls->config.enable_auto = 0;\n> + *\t\tbls->config.fixed_val.r = blackLevelRed_;\n> + *\t\tbls->config.fixed_val.gr = blackLevelGreenR_;\n> + *\t\tbls->config.fixed_val.gb = blackLevelGreenB_;\n> + *\t\tbls->config.fixed_val.b = blackLevelBlue_;\n> + *\t}\n> + *\n> + * @type: The parameters block type, see\n> + *\t  :c:type:`rkisp1_ext_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 rkisp1_ext_params_block_header {\n> +\t__u16 type;\n> +\t__u16 flags;\n> +\t__u32 size;\n> +};\n> +\n> +/**\n> + * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config\n> + *\n> + * RkISP1 extensible parameters Black Level Subtraction configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Black Level Subtraction configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_bls_config`\n> + */\n> +struct rkisp1_ext_params_bls_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_bls_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config\n> + *\n> + * RkISP1 extensible parameters Defective Pixel Cluster Correction configuration\n> + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Defective Pixel Cluster Correction configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_dpcc_config`\n> + */\n> +struct rkisp1_ext_params_dpcc_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_dpcc_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config\n> + *\n> + * RkISP1 extensible parameters Sensor Degamma configuration block. Identified\n> + * by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Sensor Degamma configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_sdg_config`\n> + */\n> +struct rkisp1_ext_params_sdg_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_sdg_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config\n> + *\n> + * RkISP1 extensible parameters Lens Shading Correction configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Lens Shading Correction configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_lsc_config`\n> + */\n> +struct rkisp1_ext_params_lsc_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_lsc_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB\n> + *\t\t\t\t\t      gain config\n> + *\n> + * RkISP1 extensible parameters Auto-White Balance Gains configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Auto-White Balance Gains configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_awb_gain_config`\n> + */\n> +struct rkisp1_ext_params_awb_gain_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_awb_gain_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config\n> + *\n> + * RkISP1 extensible parameters Filter configuration block. Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config`\n> + */\n> +struct rkisp1_ext_params_flt_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_flt_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config\n> + *\n> + * RkISP1 extensible parameters Demosaicing configuration block. Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config`\n> + */\n> +struct rkisp1_ext_params_bdm_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_bdm_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config\n> + *\n> + * RkISP1 extensible parameters Cross-Talk configuration block. Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config`\n> + */\n> +struct rkisp1_ext_params_ctk_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_ctk_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config\n> + *\n> + * RkISP1 extensible parameters Gamma-Out configuration block. Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config`\n> + */\n> +struct rkisp1_ext_params_goc_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_goc_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config\n> + *\n> + * RkISP1 extensible parameters De-noise Pre-Filter configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: De-noise Pre-Filter configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_dpf_config`\n> + */\n> +struct rkisp1_ext_params_dpf_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_dpf_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF\n> + *\t\t\t\t\t\t  strength config\n> + *\n> + * RkISP1 extensible parameters De-noise Pre-Filter strength configuration\n> + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: De-noise Pre-Filter strength configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_dpf_strength_config`\n> + */\n> +struct rkisp1_ext_params_dpf_strength_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_dpf_strength_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config\n> + *\n> + * RkISP1 extensible parameters Color Processing configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Color processing configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_cproc_config`\n> + */\n> +struct rkisp1_ext_params_cproc_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_cproc_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config\n> + *\n> + * RkISP1 extensible parameters Image Effect configuration block. Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config`\n> + */\n> +struct rkisp1_ext_params_ie_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_ie_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB\n> + *\t\t\t\t\t      Meas config\n> + *\n> + * RkISP1 extensible parameters Auto-White Balance Measurement configuration\n> + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Auto-White Balance measure configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_awb_meas_config`\n> + */\n> +struct rkisp1_ext_params_awb_meas_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_awb_meas_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config\n> + *\n> + * RkISP1 extensible parameters Histogram statistics configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Histogram statistics configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_hst_config`\n> + */\n> +struct rkisp1_ext_params_hst_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_hst_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config\n> + *\n> + * RkISP1 extensible parameters Auto-Exposure statistics configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Auto-Exposure statistics configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_aec_config`\n> + */\n> +struct rkisp1_ext_params_aec_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_aec_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config\n> + *\n> + * RkISP1 extensible parameters Auto-Focus statistics configuration block.\n> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Auto-Focus statistics configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_afc_config`\n> + */\n> +struct rkisp1_ext_params_afc_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_afc_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params\n> + * Compand BLS config\n> + *\n> + * RkISP1 extensible parameters Companding configuration block (black level\n> + * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Companding BLS configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_compand_bls_config`\n> + */\n> +struct rkisp1_ext_params_compand_bls_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_compand_bls_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/**\n> + * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params\n> + * Compand curve config\n> + *\n> + * RkISP1 extensible parameters Companding configuration block (expand and\n> + * compression curves). Identified by\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or\n> + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`.\n> + *\n> + * @header: The RkISP1 extensible parameters header, see\n> + *\t    :c:type:`rkisp1_ext_params_block_header`\n> + * @config: Companding curve configuration, see\n> + *\t    :c:type:`rkisp1_cif_isp_compand_curve_config`\n> + */\n> +struct rkisp1_ext_params_compand_curve_config {\n> +\tstruct rkisp1_ext_params_block_header header;\n> +\tstruct rkisp1_cif_isp_compand_curve_config config;\n> +} __attribute__((aligned(8)));\n> +\n> +/*\n> + * The rkisp1_ext_params_compand_curve_config structure is counted twice as it\n> + * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.\n> + */\n> +#define RKISP1_EXT_PARAMS_MAX_SIZE\t\t\t\t\t\\\n> +\t(sizeof(struct rkisp1_ext_params_bls_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_dpcc_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_sdg_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_lsc_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_awb_gain_config)\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_flt_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_bdm_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_ctk_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_goc_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_dpf_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_dpf_strength_config)\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_cproc_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_ie_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_awb_meas_config)\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_hst_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_aec_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_afc_config)\t\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_compand_bls_config)\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_compand_curve_config)\t\t+\\\n> +\tsizeof(struct rkisp1_ext_params_compand_curve_config))\n> +\n> +/**\n> + * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version\n> + *\n> + * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters\n> + */\n> +enum rksip1_ext_param_buffer_version {\n> +\tRKISP1_EXT_PARAM_BUFFER_V1 = 1,\n> +};\n> +\n> +/**\n> + * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration\n> + *\n> + * This struct contains the configuration parameters of the RkISP1 ISP\n> + * algorithms, serialized by userspace into a data buffer. Each configuration\n> + * parameter block is represented by a block-specific structure which contains a\n> + * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace\n> + * populates the @data buffer with configuration parameters for the blocks that\n> + * it intends to configure. As a consequence, the data buffer effective size\n> + * changes according to the number of ISP blocks that userspace intends to\n> + * configure and is set by userspace in the @data_size field.\n> + *\n> + * The parameters buffer is versioned by the @version field to allow modifying\n> + * and extending its definition. Userspace shall 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 version and return an error if the desired version is not\n> + * supported.\n> + *\n> + * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported.\n> + * When a new format version will be added, a mechanism for userspace to query\n> + * the supported format versions will be implemented in the form of a read-only\n> + * V4L2 control. If such control is not available, userspace should assume only\n> + * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver.\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 @data_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 rkisp1_ext_params_cfg -------------------+\n> + *\t| version = RKISP_EXT_PARAMS_BUFFER_V1;                               |\n> + *\t| data_size = sizeof(struct rkisp1_ext_params_bls_config)             |\n> + *\t|           + sizeof(struct rkisp1_ext_params_dpcc_config);           |\n> + *\t| +------------------------- data  ---------------------------------+ |\n> + *\t| | +------------- struct rkisp1_ext_params_bls_config -----------+ | |\n> + *\t| | | +-------- struct rkisp1_ext_params_block_header  ---------+ | | |\n> + *\t| | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS;                | | | |\n> + *\t| | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;              | | | |\n> + *\t| | | | size = sizeof(struct rkisp1_ext_params_bls_config);     | | | |\n> + *\t| | | +---------------------------------------------------------+ | | |\n> + *\t| | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | |\n> + *\t| | | | enable_auto = 0;                                        | | | |\n> + *\t| | | | fixed_val.r = 256;                                      | | | |\n> + *\t| | | | fixed_val.gr = 256;                                     | | | |\n> + *\t| | | | fixed_val.gb = 256;                                     | | | |\n> + *\t| | | | fixed_val.b = 256;                                      | | | |\n> + *\t| | | +---------------------------------------------------------+ | | |\n> + *\t| | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | |\n> + *\t| | | +-------- struct rkisp1_ext_params_block_header  ---------+ | | |\n> + *\t| | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC;               | | | |\n> + *\t| | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;              | | | |\n> + *\t| | | | size = sizeof(struct rkisp1_ext_params_dpcc_config);    | | | |\n> + *\t| | | +---------------------------------------------------------+ | | |\n> + *\t| | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | |\n> + *\t| | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE;          | | | |\n> + *\t| | | | output_mode =                                           | | | |\n> + *\t| | | |   RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | |\n> + *\t| | | | set_use = ... ;                                         | | | |\n> + *\t| | | | ...  = ... ;                                            | | | |\n> + *\t| | | +---------------------------------------------------------+ | | |\n> + *\t| | +-------------------------------------------------------------+ | |\n> + *\t| +-----------------------------------------------------------------+ |\n> + *\t+---------------------------------------------------------------------+\n> + *\n> + * @version: The RkISP1 extensible parameters buffer version, see\n> + *\t     :c:type:`rksip1_ext_param_buffer_version`\n> + * @data_size: The RkISP1 configuration data effective size, excluding this\n> + *\t       header\n> + * @data: The RkISP1 extensible configuration data blocks\n> + */\n> +struct rkisp1_ext_params_cfg {\n> +\t__u32 version;\n> +\t__u32 data_size;\n> +\t__u8 data[RKISP1_EXT_PARAMS_MAX_SIZE];\n> +};\n> +\n>  #endif /* _RKISP1_CONFIG_H */\n> diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h\n> index 1e6e816b34b4..882a81805783 100644\n> --- a/include/linux/v4l2-controls.h\n> +++ b/include/linux/v4l2-controls.h\n> @@ -898,6 +898,8 @@ enum v4l2_mpeg_video_av1_level {\n>  \tV4L2_MPEG_VIDEO_AV1_LEVEL_7_3 = 23\n>  };\n>\n> +#define V4L2_CID_MPEG_VIDEO_AVERAGE_QP  (V4L2_CID_CODEC_BASE + 657)\n> +\n>  /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */\n>  #define V4L2_CID_CODEC_CX2341X_BASE\t\t\t\t(V4L2_CTRL_CLASS_CODEC | 0x1000)\n>  #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE\t\t(V4L2_CID_CODEC_CX2341X_BASE+0)\n> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> index 7fe522e85249..3829c0b60f52 100644\n> --- a/include/linux/videodev2.h\n> +++ b/include/linux/videodev2.h\n> @@ -829,9 +829,10 @@ struct v4l2_pix_format {\n>  /* Vendor specific - used for RK_ISP1 camera sub-system */\n>  #define V4L2_META_FMT_RK_ISP1_PARAMS\tv4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */\n>  #define V4L2_META_FMT_RK_ISP1_STAT_3A\tv4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */\n> +#define V4L2_META_FMT_RK_ISP1_EXT_PARAMS\tv4l2_fourcc('R', 'K', '1', 'E') /* Rockchip ISP1 3a Extensible Parameters */\n>\n> -/* The metadata format identifier for BE configuration buffers. */\n> -#define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C')\n> +/* Vendor specific - used for RaspberryPi PiSP */\n> +#define V4L2_META_FMT_RPI_BE_CFG\tv4l2_fourcc('R', 'P', 'B', 'C') /* PiSP BE configuration */\n>\n>  /* The metadata format identifier for FE configuration buffers. */\n>  #define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C')\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","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 4DA52C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Aug 2024 06:47:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 22F4F6342D;\n\tTue, 27 Aug 2024 08:47:15 +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 EA3D761E4F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2024 08:47:12 +0200 (CEST)","from ideasonboard.com (mob-5-90-141-165.net.vodafone.it\n\t[5.90.141.165])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CE18C3D5;\n\tTue, 27 Aug 2024 08:46:05 +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=\"cwccVGSs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724741166;\n\tbh=DlqzVHvGtflQTVtbqLuNdBDNLQwBYSfZ0bjN+9kxv4Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cwccVGSsM5EQrJXEKJM9NmpS6t83m4BApfiYsc7+sZaei/tp+pOkRKOACEsYS+THk\n\tUs+HAaNqwNmR/owYFvY6GaSJufuugtTG8lS02RVjjpMbImf9d9CUNywOE19TCN0hbp\n\txUelrn+8GJGb68N0x91oL/o5PqOIDJRXnRuxOVNA=","Date":"Tue, 27 Aug 2024 08:47:08 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","Subject":"Re: [PATCH v4 1/9] include: linux: Update headers for rkisp1\n\textensible parameters","Message-ID":"<uz55627upbrztnnkytphcxda7rgutpurgd3o264zku4uj7yzo7@izvxa57d7x7q>","References":"<20240827014044.24673-1-laurent.pinchart@ideasonboard.com>\n\t<20240827014044.24673-2-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240827014044.24673-2-laurent.pinchart@ideasonboard.com>","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>"}},{"id":30909,"web_url":"https://patchwork.libcamera.org/comment/30909/","msgid":"<20240827074228.GB23129@pendragon.ideasonboard.com>","date":"2024-08-27T07:42:28","subject":"Re: [PATCH v4 1/9] include: linux: Update headers for rkisp1\n\textensible parameters","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Aug 27, 2024 at 08:47:08AM +0200, Jacopo Mondi wrote:\n> Hi Laurent\n> \n> On Tue, Aug 27, 2024 at 04:40:35AM GMT, Laurent Pinchart wrote:\n> > From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> >\n> > Update the kernel headers with the definitions for the rkisp1 extensible\n> > parameters format.\n> >\n> > The headers have been generated from the most recent linux-media stage\n> > tree master branch, at commit a043ea54bbb9 (\"Merge tag\n> > 'next-media-rkisp1-20240814' of\n> > git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git\").\n> \n> Why not use the official git://linuxtv.org/media_stage.git ?\n\nI did. That's the commit message of the master branch's HEAD in the\nstage tree :-)\n\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Acked-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Acked-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  include/linux/README          |   2 +-\n> >  include/linux/dma-heap.h      |   2 +-\n> >  include/linux/drm_fourcc.h    |  18 ++\n> >  include/linux/rkisp1-config.h | 578 ++++++++++++++++++++++++++++++++++\n> >  include/linux/v4l2-controls.h |   2 +\n> >  include/linux/videodev2.h     |   5 +-\n> >  6 files changed, 603 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/include/linux/README b/include/linux/README\n> > index b7795309a216..ef178681f6eb 100644\n> > --- a/include/linux/README\n> > +++ b/include/linux/README\n> > @@ -1,4 +1,4 @@\n> >  # SPDX-License-Identifier: CC0-1.0\n> >\n> > -Files in this directory are imported from v6.10-rc1 of the Linux kernel. Do not\n> > +Files in this directory are imported from next-media-rkisp1-20240814-14-ga043ea54bbb9 of the Linux kernel. Do not\n> >  modify them manually.\n> > diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h\n> > index 96b90cf0f8f7..63b1e9ed5200 100644\n> > --- a/include/linux/dma-heap.h\n> > +++ b/include/linux/dma-heap.h\n> > @@ -19,7 +19,7 @@\n> >  #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)\n> >\n> >  /* Currently no heap flags */\n> > -#define DMA_HEAP_VALID_HEAP_FLAGS (0)\n> > +#define DMA_HEAP_VALID_HEAP_FLAGS (0ULL)\n> \n> Is this related ?\n\nIt comes from mainline, pulled by the update script.\n\n> >  /**\n> >   * struct dma_heap_allocation_data - metadata passed from userspace for\n> > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\n> > index d8e999400d85..db6798776663 100644\n> > --- a/include/linux/drm_fourcc.h\n> > +++ b/include/linux/drm_fourcc.h\n> > @@ -1556,6 +1556,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n> >  #define AMD_FMT_MOD_TILE_VER_GFX10 2\n> >  #define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3\n> >  #define AMD_FMT_MOD_TILE_VER_GFX11 4\n> > +#define AMD_FMT_MOD_TILE_VER_GFX12 5\n> >\n> >  /*\n> >   * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical\n> > @@ -1566,6 +1567,8 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n> >  /*\n> >   * 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has\n> >   * GFX9 as canonical version.\n> > + *\n> > + * 64K_D_2D on GFX12 is identical to 64K_D on GFX11.\n> >   */\n> >  #define AMD_FMT_MOD_TILE_GFX9_64K_D 10\n> >  #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25\n> > @@ -1573,6 +1576,21 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n> >  #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27\n> >  #define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31\n> >\n> > +/* Gfx12 swizzle modes:\n> > + *    0 - LINEAR\n> > + *    1 - 256B_2D  - 2D block dimensions\n> > + *    2 - 4KB_2D\n> > + *    3 - 64KB_2D\n> > + *    4 - 256KB_2D\n> > + *    5 - 4KB_3D   - 3D block dimensions\n> > + *    6 - 64KB_3D\n> > + *    7 - 256KB_3D\n> > + */\n> > +#define AMD_FMT_MOD_TILE_GFX12_256B_2D 1\n> > +#define AMD_FMT_MOD_TILE_GFX12_4K_2D 2\n> > +#define AMD_FMT_MOD_TILE_GFX12_64K_2D 3\n> > +#define AMD_FMT_MOD_TILE_GFX12_256K_2D 4\n> > +\n> \n> I take this as an overall headers update, not just the rkisp1 bits. Is\n> this intentional ?\n\nYes it is.\n\n> >  #define AMD_FMT_MOD_DCC_BLOCK_64B 0\n> >  #define AMD_FMT_MOD_DCC_BLOCK_128B 1\n> >  #define AMD_FMT_MOD_DCC_BLOCK_256B 2\n> > diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\n> > index f87c6bd49a5b..edbc6cb65d1c 100644\n> > --- a/include/linux/rkisp1-config.h\n> > +++ b/include/linux/rkisp1-config.h\n> > @@ -164,6 +164,11 @@\n> >  #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS      17\n> >  #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS  6\n> >\n> > +/*\n> > + * Compand\n> > + */\n> > +#define RKISP1_CIF_ISP_COMPAND_NUM_POINTS\t64\n> > +\n> >  /*\n> >   * Measurement types\n> >   */\n> > @@ -851,6 +856,39 @@ struct rkisp1_params_cfg {\n> >  \tstruct rkisp1_cif_isp_isp_other_cfg others;\n> >  };\n> >\n> > +/**\n> > + * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS)\n> > + * @r: Fixed subtraction value for Bayer pattern R\n> > + * @gr: Fixed subtraction value for Bayer pattern Gr\n> > + * @gb: Fixed subtraction value for Bayer pattern Gb\n> > + * @b: Fixed subtraction value for Bayer pattern B\n> > + *\n> > + * The values will be subtracted from the sensor values. Note that unlike the\n> > + * dedicated BLS block, the BLS values in the compander are 20-bit unsigned.\n> > + */\n> > +struct rkisp1_cif_isp_compand_bls_config {\n> > +\t__u32 r;\n> > +\t__u32 gr;\n> > +\t__u32 gb;\n> > +\t__u32 b;\n> > +};\n> > +\n> > +/**\n> > + * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding\n> > + * parameters (expand and compression curves)\n> > + * @px: Compand curve x-values. Each value stores the distance from the\n> > + *      previous x-value, expressed as log2 of the distance on 5 bits.\n> > + * @x: Compand curve x-values. The functionality of these parameters are\n> > + *     unknown due to do a lack of hardware documentation, but these are left\n> > + *     here for future compatibility purposes.\n> > + * @y: Compand curve y-values\n> > + */\n> > +struct rkisp1_cif_isp_compand_curve_config {\n> > +\t__u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> > +\t__u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> > +\t__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n> > +};\n> > +\n> >  /*---------- PART2: Measurement Statistics ------------*/\n> >\n> >  /**\n> > @@ -996,4 +1034,544 @@ struct rkisp1_stat_buffer {\n> >  \tstruct rkisp1_cif_isp_stat params;\n> >  };\n> >\n> > +/*---------- PART3: Extensible Configuration Parameters  ------------*/\n> > +\n> > +/**\n> > + * enum rkisp1_ext_params_block_type - RkISP1 extensible params block type\n> > + *\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve\n> > + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve\n> > + */\n> > +enum rkisp1_ext_params_block_type {\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_SDG,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_FLT,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_BDM,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_CTK,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_GOC,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPF,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_IE,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_LSC,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,\n> > +\tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,\n> > +};\n> > +\n> > +#define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> > +#define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block\n> > + *\t\t\t\t\t   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:`rkisp1_ext_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.\n> > + *\n> > + * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*.\n> > + *\n> > + * When userspace wants to configure and enable an ISP block it shall fully\n> > + * populate the block configuration and set the\n> > + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field.\n> > + *\n> > + * When userspace simply wants to disable an ISP block the\n> > + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The\n> > + * driver ignores the rest of the block configuration structure in this case.\n> > + *\n> > + * If a new configuration of an ISP block has to be applied userspace shall\n> > + * fully populate the ISP block configuration and omit setting the\n> > + * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits\n> > + * in the @flags field.\n> > + *\n> > + * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and\n> > + * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed\n> > + * and not accepted by the driver.\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_bls(struct rkisp1_ext_params_block_header *block) {\n> > + *\t\tstruct rkisp1_ext_params_bls_config *bls =\n> > + *\t\t\t(struct rkisp1_ext_params_bls_config *)block;\n> > + *\n> > + *\t\tbls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS;\n> > + *\t\tbls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;\n> > + *\t\tbls->header.size = sizeof(*bls);\n> > + *\n> > + *\t\tbls->config.enable_auto = 0;\n> > + *\t\tbls->config.fixed_val.r = blackLevelRed_;\n> > + *\t\tbls->config.fixed_val.gr = blackLevelGreenR_;\n> > + *\t\tbls->config.fixed_val.gb = blackLevelGreenB_;\n> > + *\t\tbls->config.fixed_val.b = blackLevelBlue_;\n> > + *\t}\n> > + *\n> > + * @type: The parameters block type, see\n> > + *\t  :c:type:`rkisp1_ext_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 rkisp1_ext_params_block_header {\n> > +\t__u16 type;\n> > +\t__u16 flags;\n> > +\t__u32 size;\n> > +};\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config\n> > + *\n> > + * RkISP1 extensible parameters Black Level Subtraction configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Black Level Subtraction configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_bls_config`\n> > + */\n> > +struct rkisp1_ext_params_bls_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_bls_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config\n> > + *\n> > + * RkISP1 extensible parameters Defective Pixel Cluster Correction configuration\n> > + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Defective Pixel Cluster Correction configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_dpcc_config`\n> > + */\n> > +struct rkisp1_ext_params_dpcc_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_dpcc_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config\n> > + *\n> > + * RkISP1 extensible parameters Sensor Degamma configuration block. Identified\n> > + * by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Sensor Degamma configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_sdg_config`\n> > + */\n> > +struct rkisp1_ext_params_sdg_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_sdg_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config\n> > + *\n> > + * RkISP1 extensible parameters Lens Shading Correction configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Lens Shading Correction configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_lsc_config`\n> > + */\n> > +struct rkisp1_ext_params_lsc_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_lsc_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB\n> > + *\t\t\t\t\t      gain config\n> > + *\n> > + * RkISP1 extensible parameters Auto-White Balance Gains configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Auto-White Balance Gains configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_awb_gain_config`\n> > + */\n> > +struct rkisp1_ext_params_awb_gain_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_awb_gain_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config\n> > + *\n> > + * RkISP1 extensible parameters Filter configuration block. Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config`\n> > + */\n> > +struct rkisp1_ext_params_flt_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_flt_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config\n> > + *\n> > + * RkISP1 extensible parameters Demosaicing configuration block. Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config`\n> > + */\n> > +struct rkisp1_ext_params_bdm_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_bdm_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config\n> > + *\n> > + * RkISP1 extensible parameters Cross-Talk configuration block. Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config`\n> > + */\n> > +struct rkisp1_ext_params_ctk_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_ctk_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config\n> > + *\n> > + * RkISP1 extensible parameters Gamma-Out configuration block. Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config`\n> > + */\n> > +struct rkisp1_ext_params_goc_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_goc_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config\n> > + *\n> > + * RkISP1 extensible parameters De-noise Pre-Filter configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: De-noise Pre-Filter configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_dpf_config`\n> > + */\n> > +struct rkisp1_ext_params_dpf_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_dpf_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF\n> > + *\t\t\t\t\t\t  strength config\n> > + *\n> > + * RkISP1 extensible parameters De-noise Pre-Filter strength configuration\n> > + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: De-noise Pre-Filter strength configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_dpf_strength_config`\n> > + */\n> > +struct rkisp1_ext_params_dpf_strength_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_dpf_strength_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config\n> > + *\n> > + * RkISP1 extensible parameters Color Processing configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Color processing configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_cproc_config`\n> > + */\n> > +struct rkisp1_ext_params_cproc_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_cproc_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config\n> > + *\n> > + * RkISP1 extensible parameters Image Effect configuration block. Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config`\n> > + */\n> > +struct rkisp1_ext_params_ie_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_ie_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB\n> > + *\t\t\t\t\t      Meas config\n> > + *\n> > + * RkISP1 extensible parameters Auto-White Balance Measurement configuration\n> > + * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Auto-White Balance measure configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_awb_meas_config`\n> > + */\n> > +struct rkisp1_ext_params_awb_meas_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_awb_meas_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config\n> > + *\n> > + * RkISP1 extensible parameters Histogram statistics configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Histogram statistics configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_hst_config`\n> > + */\n> > +struct rkisp1_ext_params_hst_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_hst_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config\n> > + *\n> > + * RkISP1 extensible parameters Auto-Exposure statistics configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Auto-Exposure statistics configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_aec_config`\n> > + */\n> > +struct rkisp1_ext_params_aec_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_aec_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config\n> > + *\n> > + * RkISP1 extensible parameters Auto-Focus statistics configuration block.\n> > + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Auto-Focus statistics configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_afc_config`\n> > + */\n> > +struct rkisp1_ext_params_afc_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_afc_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params\n> > + * Compand BLS config\n> > + *\n> > + * RkISP1 extensible parameters Companding configuration block (black level\n> > + * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Companding BLS configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_compand_bls_config`\n> > + */\n> > +struct rkisp1_ext_params_compand_bls_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_compand_bls_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params\n> > + * Compand curve config\n> > + *\n> > + * RkISP1 extensible parameters Companding configuration block (expand and\n> > + * compression curves). Identified by\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or\n> > + * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`.\n> > + *\n> > + * @header: The RkISP1 extensible parameters header, see\n> > + *\t    :c:type:`rkisp1_ext_params_block_header`\n> > + * @config: Companding curve configuration, see\n> > + *\t    :c:type:`rkisp1_cif_isp_compand_curve_config`\n> > + */\n> > +struct rkisp1_ext_params_compand_curve_config {\n> > +\tstruct rkisp1_ext_params_block_header header;\n> > +\tstruct rkisp1_cif_isp_compand_curve_config config;\n> > +} __attribute__((aligned(8)));\n> > +\n> > +/*\n> > + * The rkisp1_ext_params_compand_curve_config structure is counted twice as it\n> > + * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.\n> > + */\n> > +#define RKISP1_EXT_PARAMS_MAX_SIZE\t\t\t\t\t\\\n> > +\t(sizeof(struct rkisp1_ext_params_bls_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_dpcc_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_sdg_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_lsc_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_awb_gain_config)\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_flt_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_bdm_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_ctk_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_goc_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_dpf_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_dpf_strength_config)\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_cproc_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_ie_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_awb_meas_config)\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_hst_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_aec_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_afc_config)\t\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_compand_bls_config)\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_compand_curve_config)\t\t+\\\n> > +\tsizeof(struct rkisp1_ext_params_compand_curve_config))\n> > +\n> > +/**\n> > + * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version\n> > + *\n> > + * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters\n> > + */\n> > +enum rksip1_ext_param_buffer_version {\n> > +\tRKISP1_EXT_PARAM_BUFFER_V1 = 1,\n> > +};\n> > +\n> > +/**\n> > + * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration\n> > + *\n> > + * This struct contains the configuration parameters of the RkISP1 ISP\n> > + * algorithms, serialized by userspace into a data buffer. Each configuration\n> > + * parameter block is represented by a block-specific structure which contains a\n> > + * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace\n> > + * populates the @data buffer with configuration parameters for the blocks that\n> > + * it intends to configure. As a consequence, the data buffer effective size\n> > + * changes according to the number of ISP blocks that userspace intends to\n> > + * configure and is set by userspace in the @data_size field.\n> > + *\n> > + * The parameters buffer is versioned by the @version field to allow modifying\n> > + * and extending its definition. Userspace shall 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 version and return an error if the desired version is not\n> > + * supported.\n> > + *\n> > + * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported.\n> > + * When a new format version will be added, a mechanism for userspace to query\n> > + * the supported format versions will be implemented in the form of a read-only\n> > + * V4L2 control. If such control is not available, userspace should assume only\n> > + * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver.\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 @data_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 rkisp1_ext_params_cfg -------------------+\n> > + *\t| version = RKISP_EXT_PARAMS_BUFFER_V1;                               |\n> > + *\t| data_size = sizeof(struct rkisp1_ext_params_bls_config)             |\n> > + *\t|           + sizeof(struct rkisp1_ext_params_dpcc_config);           |\n> > + *\t| +------------------------- data  ---------------------------------+ |\n> > + *\t| | +------------- struct rkisp1_ext_params_bls_config -----------+ | |\n> > + *\t| | | +-------- struct rkisp1_ext_params_block_header  ---------+ | | |\n> > + *\t| | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS;                | | | |\n> > + *\t| | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;              | | | |\n> > + *\t| | | | size = sizeof(struct rkisp1_ext_params_bls_config);     | | | |\n> > + *\t| | | +---------------------------------------------------------+ | | |\n> > + *\t| | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | |\n> > + *\t| | | | enable_auto = 0;                                        | | | |\n> > + *\t| | | | fixed_val.r = 256;                                      | | | |\n> > + *\t| | | | fixed_val.gr = 256;                                     | | | |\n> > + *\t| | | | fixed_val.gb = 256;                                     | | | |\n> > + *\t| | | | fixed_val.b = 256;                                      | | | |\n> > + *\t| | | +---------------------------------------------------------+ | | |\n> > + *\t| | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | |\n> > + *\t| | | +-------- struct rkisp1_ext_params_block_header  ---------+ | | |\n> > + *\t| | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC;               | | | |\n> > + *\t| | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;              | | | |\n> > + *\t| | | | size = sizeof(struct rkisp1_ext_params_dpcc_config);    | | | |\n> > + *\t| | | +---------------------------------------------------------+ | | |\n> > + *\t| | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | |\n> > + *\t| | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE;          | | | |\n> > + *\t| | | | output_mode =                                           | | | |\n> > + *\t| | | |   RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | |\n> > + *\t| | | | set_use = ... ;                                         | | | |\n> > + *\t| | | | ...  = ... ;                                            | | | |\n> > + *\t| | | +---------------------------------------------------------+ | | |\n> > + *\t| | +-------------------------------------------------------------+ | |\n> > + *\t| +-----------------------------------------------------------------+ |\n> > + *\t+---------------------------------------------------------------------+\n> > + *\n> > + * @version: The RkISP1 extensible parameters buffer version, see\n> > + *\t     :c:type:`rksip1_ext_param_buffer_version`\n> > + * @data_size: The RkISP1 configuration data effective size, excluding this\n> > + *\t       header\n> > + * @data: The RkISP1 extensible configuration data blocks\n> > + */\n> > +struct rkisp1_ext_params_cfg {\n> > +\t__u32 version;\n> > +\t__u32 data_size;\n> > +\t__u8 data[RKISP1_EXT_PARAMS_MAX_SIZE];\n> > +};\n> > +\n> >  #endif /* _RKISP1_CONFIG_H */\n> > diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h\n> > index 1e6e816b34b4..882a81805783 100644\n> > --- a/include/linux/v4l2-controls.h\n> > +++ b/include/linux/v4l2-controls.h\n> > @@ -898,6 +898,8 @@ enum v4l2_mpeg_video_av1_level {\n> >  \tV4L2_MPEG_VIDEO_AV1_LEVEL_7_3 = 23\n> >  };\n> >\n> > +#define V4L2_CID_MPEG_VIDEO_AVERAGE_QP  (V4L2_CID_CODEC_BASE + 657)\n> > +\n> >  /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */\n> >  #define V4L2_CID_CODEC_CX2341X_BASE\t\t\t\t(V4L2_CTRL_CLASS_CODEC | 0x1000)\n> >  #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE\t\t(V4L2_CID_CODEC_CX2341X_BASE+0)\n> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> > index 7fe522e85249..3829c0b60f52 100644\n> > --- a/include/linux/videodev2.h\n> > +++ b/include/linux/videodev2.h\n> > @@ -829,9 +829,10 @@ struct v4l2_pix_format {\n> >  /* Vendor specific - used for RK_ISP1 camera sub-system */\n> >  #define V4L2_META_FMT_RK_ISP1_PARAMS\tv4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */\n> >  #define V4L2_META_FMT_RK_ISP1_STAT_3A\tv4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */\n> > +#define V4L2_META_FMT_RK_ISP1_EXT_PARAMS\tv4l2_fourcc('R', 'K', '1', 'E') /* Rockchip ISP1 3a Extensible Parameters */\n> >\n> > -/* The metadata format identifier for BE configuration buffers. */\n> > -#define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C')\n> > +/* Vendor specific - used for RaspberryPi PiSP */\n> > +#define V4L2_META_FMT_RPI_BE_CFG\tv4l2_fourcc('R', 'P', 'B', 'C') /* PiSP BE configuration */\n> >\n> >  /* The metadata format identifier for FE configuration buffers. */\n> >  #define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C')","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 B20EEC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Aug 2024 07:42:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7312963445;\n\tTue, 27 Aug 2024 09:42:34 +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 7748E6343E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2024 09:42:32 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5321C9FF;\n\tTue, 27 Aug 2024 09:41:25 +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=\"izqLTbDi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724744485;\n\tbh=Q+otkfzZLLr4xOJlz3HbzqqXStocBjCQR3ofvAfGn+o=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=izqLTbDid98b3HrjGrKG/4t3OEyA/mwT5VwdKbg5OicmlugsOr/Re3s94lO/vGDjn\n\tvNd7wUM7MgSoudRy2wVqded3J3DkPSZScvf6mYrhLMOQXZ/MWSLBGt3IJghRZ1QrQe\n\t6lUnykNtJgN36RvEKE3yLAJj28xUJ7Z1Lw8G22QY=","Date":"Tue, 27 Aug 2024 10:42:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 1/9] include: linux: Update headers for rkisp1\n\textensible parameters","Message-ID":"<20240827074228.GB23129@pendragon.ideasonboard.com>","References":"<20240827014044.24673-1-laurent.pinchart@ideasonboard.com>\n\t<20240827014044.24673-2-laurent.pinchart@ideasonboard.com>\n\t<uz55627upbrztnnkytphcxda7rgutpurgd3o264zku4uj7yzo7@izvxa57d7x7q>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<uz55627upbrztnnkytphcxda7rgutpurgd3o264zku4uj7yzo7@izvxa57d7x7q>","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>"}}]