linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Scally <dan.scally@ideasonboard.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	jacopo.mondi@ideasonboard.com, nayden.kanchev@arm.com,
	robh+dt@kernel.org, mchehab@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	jerome.forissier@linaro.org, kieran.bingham@ideasonboard.com,
	sakari.ailus@iki.fi
Subject: Re: [PATCH v5 16/16] Documentation: mali-c55: Document the mali-c55 parameter setting
Date: Fri, 31 May 2024 01:54:47 +0300	[thread overview]
Message-ID: <20240530225447.GF5213@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240529152858.183799-17-dan.scally@ideasonboard.com>

Hi Dan,

Thank you for the patch.

On Wed, May 29, 2024 at 04:28:58PM +0100, Daniel Scally wrote:
> Document the mali-c55 parameter setting by expanding the relevant
> pages in both admin-guide/ and userspace-api/.
> 
> Acked-by: Nayden Kanchev  <nayden.kanchev@arm.com>
> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
> Changes in v5:
> 
> 	- New patch
> 
>  Documentation/admin-guide/media/mali-c55.rst  | 19 +++++-
>  .../media/v4l/metafmt-arm-mali-c55.rst        | 65 ++++++++++++++++++-
>  2 files changed, 79 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/admin-guide/media/mali-c55.rst b/Documentation/admin-guide/media/mali-c55.rst
> index b75437f6e96a..c5e6ac826c99 100644
> --- a/Documentation/admin-guide/media/mali-c55.rst
> +++ b/Documentation/admin-guide/media/mali-c55.rst
> @@ -380,9 +380,24 @@ the processing flow the statistics can be drawn from::
>                         +-------------+   |    +-------------+
>                                           +-->  AWB-1
>  
> -At present all statistics are drawn from the 0th tap point for each algorithm;
> +By default all statistics are drawn from the 0th tap point for each algorithm;
>  I.E. AEXP statistics from AEXP-0 (A), AWB statistics from AWB-0 and AF
> -statistics from AF-0. In the future this will be configurable.
> +statistics from AF-0. This is configurable for AEXP and AWB statsistics through
> +programming the ISP's parameters.
> +
> +.. _mali-c55-3a-params:
> +
> +Programming ISP Parameters
> +==========================
> +
> +The ISP can be programmed with various parameters from userspace to apply to the
> +hardware before and during video stream. This allows userspace to dynamically
> +change values such as black level, white balance and lens shading gains and so
> +on.
> +
> +The buffer format and how to populate it are described by the
> +:ref:`V4L2_META_FMT_MALI_C55_PARAMS <v4l2-meta-fmt-mali-c55-params>` format,
> +which should be set as the data format for the `mali-c55 3a params` video node.
>  
>  References
>  ==========
> diff --git a/Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst b/Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst
> index 219a5dd42d70..c359d2c83858 100644
> --- a/Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst
> +++ b/Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst
> @@ -1,10 +1,11 @@
>  .. SPDX-License-Identifier: GPL-2.0
>  
> +.. _v4l2-meta-fmt-mali-c55-params:
>  .. _v4l2-meta-fmt-mali-c55-3a-stats:
>  
> -****************************************
> -V4L2_META_FMT_MALI_C55_3A_STATS ('C55S')
> -****************************************
> +********************************************************************************
> +V4L2_META_FMT_MALI_C55_3A_STATS ('C55S'), V4L2_META_FMT_MALI_C55_PARAMS ('C55P')
> +********************************************************************************
>  
>  3A Statistics
>  =============
> @@ -22,6 +23,64 @@ of the C structure :c:type:`mali_c55_stats_buffer` defined in
>  
>  For details of the statistics see :c:type:`mali_c55_stats_buffer`.
>  
> +Configuration Parameters
> +========================
> +
> +The configuration parameters are passed to the
> +:ref:`mali-c55 3a params <mali-c55-3a-params>` metadata output video node, using
> +the :c:type:`v4l2_meta_format` interface. Rather than a single struct containing
> +sub-structs for each configurable area of the ISP, parameters for the Mali-C55
> +are defined as distinct structs or "blocks" which may be added to the data
> +member of struct mali_c55_params_buffer. Userspace is responsible for populating
> +the data member with the blocks that need to be configured by the driver, but
> +need not populate it with **all** the blocks, or indeed with any at all if there
> +are no configuration changes to make. Populated blocks **must** be consecutive
> +in the buffer. To assist both userspace and the driver in identifying the
> +blocks each block-specific struct should embed

s/should embed/embeds/

> +struct mali_c55_params_block_header as its first member and userspace must
> +populate the type member with a value from enum mali_c55_param_block_type. Once

It would be nice to add references to the struct and enum.

> +the blocks have been populated into the data buffer, the combined size of all
> +populated blocks should be set in the total_size member of

s/should be/is/

or "must" or "shall".

> +struct mali_c55_params_buffer. For example:
> +
> +.. code-block:: c
> +
> +	struct mali_c55_params_buffer *params =
> +		(struct mali_c55_params_buffer *)buffer;
> +
> +	params->version = MALI_C55_PARAM_BUFFER_V0;

I think applications will likely handle the size as follows:

	params->total_size = 0;

> +
> +	void *data = (void *)params->data;
> +
> +	struct mali_c55_params_awb_gains *gains =
> +		(struct mali_c55_params_awb_gains *)data;
> +
> +	gains->header.type = MALI_C55_PARAM_BLOCK_AWB_GAINS;
> +	gains->header.enabled = true;
> +	gains->header.size = sizeof(struct mali_c55_params_awb_gains);
> +
> +	gains->gain00 = 256;
> +	gains->gain00 = 256;
> +	gains->gain00 = 256;
> +	gains->gain00 = 256;
> +
> +	data += sizeof(struct mali_c55_params_awb_gains)

	params->total_size += sizeof(struct mali_c55_params_awb_gains);

> +
> +	struct mali_c55_params_sensor_off_preshading *blc =
> +		(struct mali_c55_params_sensor_off_preshading *)data;
> +
> +	blc->header.type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS;
> +	blc->header.enabled = true;
> +	blc->header.size = sizeof(struct mali_c55_params_sensor_off_preshading);
> +
> +	blc->chan00 = 51200;
> +	blc->chan01 = 51200;
> +	blc->chan10 = 51200;
> +	blc->chan11 = 51200;
> +
> +	params->total_size = sizeof(struct mali_c55_params_awb_gains) +
> +			     sizeof(struct mali_c55_params_sensor_off_preshading);

	params->total_size += sizeof(struct mali_c55_params_sensor_off_preshading);

I could be wrong though. Up to you.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
>  Arm Mali-C55 uAPI data types
>  ============================
>  

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-30 22:55 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 15:28 [PATCH v5 00/16] Add Arm Mali-C55 Image Signal Processor Driver Daniel Scally
2024-05-29 15:28 ` [PATCH v5 01/16] media: uapi: Add MEDIA_BUS_FMT_RGB202020_1X60 format code Daniel Scally
2024-05-29 18:14   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 02/16] media: uapi: Add 20-bit bayer formats Daniel Scally
2024-05-29 18:18   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 03/16] media: v4l2-common: Add RAW16 format info Daniel Scally
2024-05-29 18:20   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 04/16] dt-bindings: media: Add bindings for ARM mali-c55 Daniel Scally
2024-05-29 18:21   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 06/16] media: Documentation: Add Mali-C55 ISP Documentation Daniel Scally
2024-05-29 20:22   ` Laurent Pinchart
2024-05-29 20:35     ` Dan Scally
2024-05-29 20:51       ` Laurent Pinchart
2024-05-29 21:11         ` Dan Scally
2024-05-29 21:31           ` Dan Scally
2024-05-29 15:28 ` [PATCH v5 07/16] MAINTAINERS: Add entry for mali-c55 driver Daniel Scally
2024-05-29 18:25   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 08/16] media: Add MALI_C55_3A_STATS meta format Daniel Scally
2024-05-30 21:49   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 09/16] media: uapi: Add 3a stats buffer for mali-c55 Daniel Scally
2024-05-30 22:24   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 10/16] media: platform: Add mali-c55 3a stats devnode Daniel Scally
2024-06-16 21:19   ` Laurent Pinchart
2024-06-20 15:10     ` Dan Scally
2024-06-29 15:04       ` Laurent Pinchart
2024-07-01 15:12         ` Dan Scally
2024-07-02  7:00           ` Dan Scally
2024-07-21 23:27             ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 11/16] media: platform: Fill stats buffer on ISP_START Daniel Scally
2024-05-29 15:28 ` [PATCH v5 12/16] Documentation: mali-c55: Add Statistics documentation Daniel Scally
2024-05-30 22:43   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 13/16] media: mali-c55: Add image formats for Mali-C55 parameters buffer Daniel Scally
2024-05-30 22:44   ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 14/16] media: uapi: Add parameters structs to mali-c55-config.h Daniel Scally
2024-05-30  7:08   ` kernel test robot
2024-05-31  0:09   ` Laurent Pinchart
2024-05-31  7:30     ` Dan Scally
2024-06-02  0:24       ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 15/16] media: platform: Add mali-c55 parameters video node Daniel Scally
2024-05-30  7:18   ` kernel test robot
2024-05-30 12:54   ` kernel test robot
2024-06-14 18:53   ` Sakari Ailus
2024-06-14 20:15     ` Dan Scally
2024-06-14 21:11       ` Sakari Ailus
2024-06-14 21:49         ` Dan Scally
2024-06-16 21:32           ` Laurent Pinchart
2024-05-29 15:28 ` [PATCH v5 16/16] Documentation: mali-c55: Document the mali-c55 parameter setting Daniel Scally
2024-05-30 22:54   ` Laurent Pinchart [this message]
2024-05-29 23:27 ` [PATCH v5 00/16] Add Arm Mali-C55 Image Signal Processor Driver Laurent Pinchart
     [not found] ` <20240529152858.183799-6-dan.scally@ideasonboard.com>
     [not found]   ` <20240530001507.GG10586@pendragon.ideasonboard.com>
     [not found]     ` <20240530214348.GA5213@pendragon.ideasonboard.com>
2024-06-06 12:47       ` [PATCH v5 05/16] media: mali-c55: Add Mali-C55 ISP driver Jacopo Mondi
2024-06-06 17:53         ` Laurent Pinchart
2024-06-06 19:10           ` Tomi Valkeinen
2024-06-09  6:21             ` Sakari Ailus
2024-06-16 20:38               ` Laurent Pinchart
2024-06-17  6:53                 ` Sakari Ailus
2024-06-17 22:49                   ` Laurent Pinchart
     [not found]     ` <6d0be0cf-ff77-4943-8505-f78ad922e3fb@ideasonboard.com>
2024-06-16 19:39       ` Laurent Pinchart
2024-06-17  6:31         ` Dan Scally

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=20240530225447.GF5213@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jerome.forissier@linaro.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).