Linux Media Controller development
 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 v6 13/18] media: platform: Fill stats buffer on ISP_START
Date: Wed, 31 Jul 2024 00:46:16 +0300	[thread overview]
Message-ID: <20240730214616.GF8146@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240709132906.3198927-14-dan.scally@ideasonboard.com>

Hi Dan,

Thank you for the patch.

On Tue, Jul 09, 2024 at 02:29:01PM +0100, Daniel Scally wrote:
> On ISP_START, fill the stats buffer by reading out the metering space
> in the ISP's memory. This is done for the non-active config just as
> the dma transfer of the registers is. To acheive that, move the

s/acheive/achieve/

> checking of the current config outside of mali_c55_swap_next_config()
> so we can use it for both functions.
> 
> 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 v6:
> 
> 	- None
> 
> Changes in v5:
> 
> 	- New patch
> 
>  .../platform/arm/mali-c55/mali-c55-core.c     | 34 ++++++++++++++-----
>  1 file changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-core.c b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> index eedc8f450184..ed0db34767a4 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> @@ -567,15 +567,9 @@ static int mali_c55_check_hwcfg(struct mali_c55 *mali_c55)
>  	return 0;
>  }
>  
> -static void mali_c55_swap_next_config(struct mali_c55 *mali_c55)
> +static void mali_c55_swap_next_config(struct mali_c55 *mali_c55, u32 next_config)
>  {
>  	struct mali_c55_context *ctx = mali_c55_get_active_context(mali_c55);
> -	u32 curr_config, next_config;
> -
> -	curr_config = mali_c55_read(mali_c55, MALI_C55_REG_PING_PONG_READ);
> -	curr_config = (curr_config & MALI_C55_REG_PING_PONG_READ_MASK)
> -		      >> (ffs(MALI_C55_REG_PING_PONG_READ_MASK) - 1);
> -	next_config = curr_config ^ 1;
>  
>  	mali_c55_update_bits(mali_c55, MALI_C55_REG_MCU_CONFIG,
>  			     MALI_C55_REG_MCU_CONFIG_WRITE_MASK,
> @@ -588,6 +582,7 @@ static irqreturn_t mali_c55_isr(int irq, void *context)
>  {
>  	struct device *dev = context;
>  	struct mali_c55 *mali_c55 = dev_get_drvdata(dev);
> +	u32 curr_config, next_config;
>  	u32 interrupt_status;
>  	unsigned int i, j;
>  
> @@ -612,7 +607,30 @@ static irqreturn_t mali_c55_isr(int irq, void *context)
>  			for (j = i; j < MALI_C55_NUM_CAP_DEVS; j++)
>  				mali_c55_set_next_buffer(&mali_c55->cap_devs[j]);
>  
> -			mali_c55_swap_next_config(mali_c55);
> +			/*
> +			 * When the ISP starts a frame we have some work to do:
> +			 *
> +			 * 1. Copy over the config for the **next** frame
> +			 * 2. Read out the metering stats for the **last** frame
> +			 */
> +
> +			curr_config = mali_c55_read(mali_c55,
> +						    MALI_C55_REG_PING_PONG_READ);
> +			curr_config &= MALI_C55_REG_PING_PONG_READ_MASK;
> +			curr_config >>= ffs(MALI_C55_REG_PING_PONG_READ_MASK) - 1;
> +			next_config = curr_config ^ 1;
> +
> +			/*
> +			 * The ordering of these two is currently important as
> +			 * mali_c55_stats_fill_buffer() is asynchronous whereas
> +			 * mali_c55_swap_next_config() is not.
> +			 *
> +			 * TODO: Should mali_c55_swap_next_config() be async?

Isn't it in this version of the series, at least when using DMA ?

As I wrote in the review of 07/18, I think the reconfiguration probably
needs more careful consideration.

> +			 */
> +			mali_c55_stats_fill_buffer(mali_c55,
> +				next_config ? MALI_C55_CONFIG_PING :
> +				MALI_C55_CONFIG_PONG);
> +			mali_c55_swap_next_config(mali_c55, next_config);
>  
>  			break;
>  		case MALI_C55_IRQ_ISP_DONE:

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-07-30 21:46 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 13:28 [PATCH v6 00/18] Add Arm Mali-C55 Image Signal Processor Driver Daniel Scally
2024-07-09 13:28 ` [PATCH v6 01/18] media: mc-entity: Record number of video devices in a pipeline Daniel Scally
2024-07-30 15:09   ` Laurent Pinchart
2024-07-30 15:18     ` Dan Scally
2024-07-09 13:28 ` [PATCH v6 02/18] media: uapi: Add MEDIA_BUS_FMT_RGB202020_1X60 format code Daniel Scally
2024-07-09 13:28 ` [PATCH v6 03/18] media: uapi: Add 20-bit bayer formats Daniel Scally
2024-07-22 22:13   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 04/18] media: v4l2-common: Add RAW16 format info Daniel Scally
2024-07-09 13:28 ` [PATCH v6 05/18] media: v4l2-common: Add RAW14 " Daniel Scally
2024-07-22 22:14   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 06/18] dt-bindings: media: Add bindings for ARM mali-c55 Daniel Scally
2024-07-09 13:28 ` [PATCH v6 07/18] media: mali-c55: Add Mali-C55 ISP driver Daniel Scally
2024-07-30 21:23   ` Laurent Pinchart
2024-08-13 15:20     ` Dan Scally
2024-07-09 13:28 ` [PATCH v6 08/18] media: Documentation: Add Mali-C55 ISP Documentation Daniel Scally
2024-07-30 15:15   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 09/18] MAINTAINERS: Add entry for mali-c55 driver Daniel Scally
2024-07-09 13:28 ` [PATCH v6 10/18] media: Add MALI_C55_3A_STATS meta format Daniel Scally
2024-07-09 13:28 ` [PATCH v6 11/18] media: uapi: Add 3a stats buffer for mali-c55 Daniel Scally
2024-07-09 13:29 ` [PATCH v6 12/18] media: platform: Add mali-c55 3a stats devnode Daniel Scally
2024-07-22 14:50   ` Laurent Pinchart
2024-07-22 22:55     ` Laurent Pinchart
2024-08-13 13:13       ` Dan Scally
2024-08-25 20:20         ` Laurent Pinchart
2024-07-29 10:53     ` Dan Scally
2024-08-13 13:51     ` Dan Scally
2024-07-09 13:29 ` [PATCH v6 13/18] media: platform: Fill stats buffer on ISP_START Daniel Scally
2024-07-30 21:46   ` Laurent Pinchart [this message]
2024-07-09 13:29 ` [PATCH v6 14/18] Documentation: mali-c55: Add Statistics documentation Daniel Scally
2024-07-09 13:29 ` [PATCH v6 15/18] media: mali-c55: Add image formats for Mali-C55 parameters buffer Daniel Scally
2024-07-09 13:29 ` [PATCH v6 16/18] media: uapi: Add parameters structs to mali-c55-config.h Daniel Scally
2024-07-22 23:48   ` Laurent Pinchart
2024-07-29 10:51     ` Dan Scally
2024-07-29 11:03       ` Laurent Pinchart
2024-07-09 13:29 ` [PATCH v6 17/18] media: platform: Add mali-c55 parameters video node Daniel Scally
2024-07-30 22:16   ` Laurent Pinchart
2024-07-31  6:53     ` Jacopo Mondi
2024-07-31  7:02       ` Laurent Pinchart
2024-07-31 15:12     ` Dan Scally
2024-08-02 15:03       ` Laurent Pinchart
2024-07-09 13:29 ` [PATCH v6 18/18] Documentation: mali-c55: Document the mali-c55 parameter setting Daniel 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=20240730214616.GF8146@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