From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Dafna Hirschfeld <dafna@fastmail.com>,
Keke Li <keke.li@amlogic.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Dan Scally <dan.scally@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Antoine Bouyer <antoine.bouyer@nxp.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/8] media: uapi: Convert RkISP1 to V4L2 extensible params
Date: Sun, 5 Oct 2025 03:18:47 +0300 [thread overview]
Message-ID: <20251005001847.GB13055@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250915-extensible-parameters-validation-v5-2-e6db94468af3@ideasonboard.com>
Hi Jacopo,
Thank you for the patch.
On Mon, Sep 15, 2025 at 07:18:11PM +0200, Jacopo Mondi wrote:
> With the introduction of common types for extensible parameters
> format, convert the rkisp1-config.h header to use the new types.
>
> Factor-out the documentation that is now part of the common header
> and only keep the driver-specific on in place.
>
> The conversion to use common types doesn't impact userspace as the
> new types are either identical to the ones already existing in the
> RkISP1 uAPI or are 1-to-1 type convertible.
>
> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> include/uapi/linux/rkisp1-config.h | 104 ++++++++-----------------------------
> 1 file changed, 22 insertions(+), 82 deletions(-)
>
> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
> index 3b060ea6eed71b87d79abc8401eae4e9c9f5323a..b90d94d3a852fb0af0fe447649487e9e80aca795 100644
> --- a/include/uapi/linux/rkisp1-config.h
> +++ b/include/uapi/linux/rkisp1-config.h
> @@ -7,8 +7,13 @@
> #ifndef _UAPI_RKISP1_CONFIG_H
> #define _UAPI_RKISP1_CONFIG_H
>
> +#ifdef __KERNEL__
> +#include <linux/build_bug.h>
> +#endif /* __KERNEL__ */
> #include <linux/types.h>
>
> +#include <linux/media/v4l2-isp.h>
> +
> /* Defect Pixel Cluster Detection */
> #define RKISP1_CIF_ISP_MODULE_DPCC (1U << 0)
> /* Black Level Subtraction */
> @@ -1158,79 +1163,26 @@ enum rkisp1_ext_params_block_type {
> RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR,
> };
>
> -#define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0)
> -#define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1)
> +/* For backward compatibility */
> +#define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE V4L2_PARAMS_FL_BLOCK_DISABLE
> +#define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE V4L2_PARAMS_FL_BLOCK_ENABLE
>
> /* A bitmask of parameters blocks supported on the current hardware. */
> #define RKISP1_CID_SUPPORTED_PARAMS_BLOCKS (V4L2_CID_USER_RKISP1_BASE + 0x01)
>
> /**
> - * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block
> - * header
> + * rkisp1_ext_params_block_header - RkISP1 extensible parameters block header
> *
> * This structure represents the common part of all the ISP configuration
> - * blocks. Each parameters block shall embed an instance of this structure type
> - * as its first member, followed by the block-specific configuration data. The
> - * driver inspects this common header to discern the block type and its size and
> - * properly handle the block content by casting it to the correct block-specific
> - * type.
> + * blocks and is identical to :c:type:`v4l2_params_block_header`.
> *
> - * The @type field is one of the values enumerated by
> + * The type field is one of the values enumerated by
> * :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be
> - * interpreted by the driver. The @size field specifies the size of the
> - * parameters block and is used by the driver for validation purposes.
> - *
> - * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*.
> - *
> - * When userspace wants to configure and enable an ISP block it shall fully
> - * populate the block configuration and set the
> - * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field.
> - *
> - * When userspace simply wants to disable an ISP block the
> - * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The
> - * driver ignores the rest of the block configuration structure in this case.
> - *
> - * If a new configuration of an ISP block has to be applied userspace shall
> - * fully populate the ISP block configuration and omit setting the
> - * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits
> - * in the @flags field.
> - *
> - * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and
> - * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed
> - * and not accepted by the driver.
> - *
> - * Userspace is responsible for correctly populating the parameters block header
> - * fields (@type, @flags and @size) and the block-specific parameters.
> - *
> - * For example:
> + * interpreted by the driver.
> *
> - * .. code-block:: c
> - *
> - * void populate_bls(struct rkisp1_ext_params_block_header *block) {
> - * struct rkisp1_ext_params_bls_config *bls =
> - * (struct rkisp1_ext_params_bls_config *)block;
> - *
> - * bls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS;
> - * bls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;
> - * bls->header.size = sizeof(*bls);
> - *
> - * bls->config.enable_auto = 0;
> - * bls->config.fixed_val.r = blackLevelRed_;
> - * bls->config.fixed_val.gr = blackLevelGreenR_;
> - * bls->config.fixed_val.gb = blackLevelGreenB_;
> - * bls->config.fixed_val.b = blackLevelBlue_;
> - * }
> - *
> - * @type: The parameters block type, see
> - * :c:type:`rkisp1_ext_params_block_type`
> - * @flags: A bitmask of block flags
> - * @size: Size (in bytes) of the parameters block, including this header
> + * The flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*.
> */
> -struct rkisp1_ext_params_block_header {
> - __u16 type;
> - __u16 flags;
> - __u32 size;
> -};
> +#define rkisp1_ext_params_block_header v4l2_params_block_header
>
> /**
> * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config
> @@ -1594,21 +1546,7 @@ enum rksip1_ext_param_buffer_version {
> /**
> * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration
> *
> - * This struct contains the configuration parameters of the RkISP1 ISP
> - * algorithms, serialized by userspace into a data buffer. Each configuration
> - * parameter block is represented by a block-specific structure which contains a
> - * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace
> - * populates the @data buffer with configuration parameters for the blocks that
> - * it intends to configure. As a consequence, the data buffer effective size
> - * changes according to the number of ISP blocks that userspace intends to
> - * configure and is set by userspace in the @data_size field.
> - *
> - * The parameters buffer is versioned by the @version field to allow modifying
> - * and extending its definition. Userspace shall populate the @version field to
> - * inform the driver about the version it intends to use. The driver will parse
> - * and handle the @data buffer according to the data layout specific to the
> - * indicated version and return an error if the desired version is not
> - * supported.
> + * This is the driver-specific implementation of :c:type:`v4l2_params_buffer`.
> *
> * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported.
> * When a new format version will be added, a mechanism for userspace to query
> @@ -1624,11 +1562,6 @@ enum rksip1_ext_param_buffer_version {
> * the maximum value represents the blocks supported by the kernel driver,
> * independently of the device instance.
> *
> - * For each ISP block that userspace wants to configure, a block-specific
> - * structure is appended to the @data buffer, one after the other without gaps
> - * in between nor overlaps. Userspace shall populate the @data_size field with
> - * the effective size, in bytes, of the @data buffer.
> - *
> * The expected memory layout of the parameters buffer is::
> *
> * +-------------------- struct rkisp1_ext_params_cfg -------------------+
> @@ -1678,4 +1611,11 @@ struct rkisp1_ext_params_cfg {
> __u8 data[RKISP1_EXT_PARAMS_MAX_SIZE];
> };
>
> +#ifdef __KERNEL__
> +/* Make sure the header is type-convertible to the generic v4l2 params one */
> +static_assert((sizeof(struct rkisp1_ext_params_cfg) -
> + RKISP1_EXT_PARAMS_MAX_SIZE) ==
> + sizeof(struct v4l2_params_buffer));
> +#endif /* __KERNEL__ */
> +
> #endif /* _UAPI_RKISP1_CONFIG_H */
>
--
Regards,
Laurent Pinchart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-10-05 0:19 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 17:18 [PATCH v5 0/8] media: Introduce V4L2 generic ISP support Jacopo Mondi
2025-09-15 17:18 ` [PATCH v5 1/8] media: uapi: Introduce V4L2 generic ISP types Jacopo Mondi
2025-10-05 0:06 ` Laurent Pinchart
2025-10-06 0:07 ` Laurent Pinchart
2025-10-06 8:15 ` Dan Scally
2025-10-06 8:27 ` Laurent Pinchart
2025-10-06 8:46 ` Dan Scally
2025-10-06 9:06 ` Laurent Pinchart
2025-10-06 9:51 ` Dan Scally
2025-10-06 9:58 ` Laurent Pinchart
2025-10-06 10:26 ` Dan Scally
2025-10-06 14:47 ` Laurent Pinchart
2025-09-15 17:18 ` [PATCH v5 2/8] media: uapi: Convert RkISP1 to V4L2 extensible params Jacopo Mondi
2025-10-05 0:18 ` Laurent Pinchart [this message]
2025-10-06 8:17 ` Dan Scally
2025-09-15 17:18 ` [PATCH v5 3/8] media: uapi: Convert Amlogic C3 " Jacopo Mondi
2025-10-05 0:24 ` Laurent Pinchart
2025-09-15 17:18 ` [PATCH v5 4/8] media: Documentation: uapi: Add V4L2 extensible parameters Jacopo Mondi
2025-10-06 1:17 ` Laurent Pinchart
2025-09-15 17:18 ` [PATCH v5 5/8] media: v4l2-core: Introduce v4l2-isp.c Jacopo Mondi
2025-10-06 0:47 ` Laurent Pinchart
2025-10-06 1:08 ` Laurent Pinchart
2025-10-06 10:28 ` Jacopo Mondi
2025-10-06 14:51 ` Laurent Pinchart
2025-10-06 15:00 ` Jacopo Mondi
2025-10-06 15:41 ` Laurent Pinchart
2025-09-15 17:18 ` [PATCH v5 6/8] media: rkisp1: Use v4l2-isp for validation Jacopo Mondi
2025-10-06 1:06 ` Laurent Pinchart
2025-09-15 17:18 ` [PATCH v5 7/8] media: amlogic-c3: " Jacopo Mondi
2025-09-15 17:18 ` [PATCH v5 8/8] media: Documentation: kapi: Add v4l2 generic ISP support Jacopo Mondi
2025-10-06 1:18 ` Laurent Pinchart
2025-10-02 8:17 ` [PATCH v5 0/8] media: Introduce V4L2 " Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251005001847.GB13055@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=antoine.bouyer@nxp.com \
--cc=dafna@fastmail.com \
--cc=dan.scally@ideasonboard.com \
--cc=heiko@sntech.de \
--cc=jacopo.mondi@ideasonboard.com \
--cc=keke.li@amlogic.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox