From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4ED35C3DA7F for ; Tue, 30 Jul 2024 21:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4qhEgp8s2CUelzw0BwoSNn8HarewO74r7jamAHXlF6U=; b=fMFfv1H/LlHE8MGbM8E4CAz8WL JxosylDBG899LPI0oa8aFvrZs4WgNdkRKdQ5pcpaDWk4kuq7+YnQ0iAktlcKVO8pTTWk4AkgNvyE3 86UiTtY+Hi8kvtOTDK1aVKvtbEBvXV2PMoLULGRb1bIs6VrIUG05AsxMi25sIABzFcs+9KNegQlXe RwQCAFLHmUirnust8PpHmCr+L2qpBlL8cXc/nac0+Clat9HBUqzKB3evUR7+FDUBfy+jpQ5N5y8WD EINS61llX9mQkuH4Oueg9Q6tMlHA/LmgpIXGbX5qZKRKMpgxBF1eE+yOQ6H8TWg3VglIXm76pi2sm uzLdgA9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYugV-0000000GZd7-3IIk; Tue, 30 Jul 2024 21:47:07 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYug2-0000000GZa8-3L1d for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 21:46:40 +0000 Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C8DAB4C9; Tue, 30 Jul 2024 23:45:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1722375950; bh=qUYdf+gZuTds5PhuUyLPNnIDV699yL2kJ6XlyDPmW5c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R8E0VYA8fbLbAN6gzvmG6Y3CjL8MvZQ22+A5nzqO6zst1zZstVrrC4z5GsRfHYmad uJGl0aFoYLVscyMbDmCmHs4hOMctRZ7FOR/b5L+uVIayy/cQocX8wLZiLcC6XG6FAb mYs5e2W6/U9wfY+JE4S8pCzs/fzSkOvefu9x8szs= Date: Wed, 31 Jul 2024 00:46:16 +0300 From: Laurent Pinchart To: Daniel Scally 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 Message-ID: <20240730214616.GF8146@pendragon.ideasonboard.com> References: <20240709132906.3198927-1-dan.scally@ideasonboard.com> <20240709132906.3198927-14-dan.scally@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240709132906.3198927-14-dan.scally@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_144639_145749_805848FE X-CRM114-Status: GOOD ( 25.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > Co-developed-by: Jacopo Mondi > Signed-off-by: Jacopo Mondi > Signed-off-by: Daniel Scally > --- > 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