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 D5EF2C77B71 for ; Tue, 18 Apr 2023 10:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X3P+ipSSE8GZoyeJcp7s3VX1rz8bmJJJiLjugZ/e4fU=; b=dkKTjRA5ajsAJJ XUBErfDSlt66qXxuCkz1h3CC8oCw6pIraxkwo1JZikszyj1RS91opIbVMzGcF4NMj8HwwtzcZfn+i IYmMnjAFSrbKn6iGytizbZyEpjUWvcw5xHmY5pWXT2LbEeEtdToYoJbLHvHqt6OkRu1XfhRu1bCYs xe6uSU4Hrzf6WZDHCAzUHCT/h4Oorenf0yj8BM5izO6tYf8+JFlNYZGU0tEyrBJPulnxs+r7uf2ep Za40w/QO+DCPqQ+Z3irlFQHly7N/15+o5cW1kjoEe9YgD0k771Q7bCZKxDoNo17nBWgb8rZZpeiGG Y2ka71C6a7h7q893/mSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poiFw-001aen-1d; Tue, 18 Apr 2023 10:08:12 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poiFt-001adW-2L for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 10:08:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1681812489; x=1713348489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tlaKVQjIOrOk6kHDZ3PwIXaDQygkMLeqcushxj+mKTg=; b=Z7miEddKUXYRxhhp+h17ZNcunvFayTD/F8WkoC1ygoTPhj0Ek0/9HON8 3QSeKfDQJQ3ptC4QGtDmfc4AhaKYOCl+HHYYy39JucU8XMUkiNPJc79Ac Qoh0ZOzkeUOoYq4Oy2G0e8hQFxxgQGeTAVhku2ONO6kX45WHFVDyFnwP/ BlIjXbHod02kPpq13U83LC9npWegr1X/ehpDBaV4qvgBiOTBJRGlVOe7d r8QehVz9g6WutG3GoCqNFXrA92AWx0TlXyzhRhzcV+B5HBreC2ckosVeo lwm4N3en3aPfL308/jDNV6xTe6se6nG7cBYAMHb5E1P3m2i6zfg99gp28 A==; X-IronPort-AV: E=Sophos;i="5.99,206,1677538800"; d="scan'208";a="30394490" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 18 Apr 2023 12:08:07 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 18 Apr 2023 12:08:07 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 18 Apr 2023 12:08:07 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1681812487; x=1713348487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tlaKVQjIOrOk6kHDZ3PwIXaDQygkMLeqcushxj+mKTg=; b=mGad6q+bLpcPLLBT8xk2ugFaxLexjBx75bfyotV2Q2IGvPQdWmJOAlqE ixlbSZtoTJEwq6hO0ngapvqpa6+rlrwffSm+5mFVYCv8z5hhrjYPvxi0z jtEZRvEEFgEHO5dbf/iF+u83wgig+JCktubsZdUbC61oBIsnsZVQTUc0w Yviu9xVihFBvlSmkD4XPc3lJbLK3aKMkj0nEyjTlLgebxZu+SjkCRsklX JFTFJZTIt8KO7niSFZZ/s9JV1WsKxZYniSf36gzWUGt8O5WCGGuf0Z4tQ 7+BuC/tz7faY605xGopd9iiMaWG1ojBVynWQZ/wiXmRRSG+2RFVIkzLjy g==; X-IronPort-AV: E=Sophos;i="5.99,206,1677538800"; d="scan'208";a="30394489" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 18 Apr 2023 12:08:07 +0200 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 71367280056; Tue, 18 Apr 2023 12:08:07 +0200 (CEST) From: Alexander Stein To: Laurent Pinchart Cc: Rui Miguel Silva , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Fabio Estevam , Pengutronix Kernel Team , NXP Linux Team , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/3] media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt Date: Tue, 18 Apr 2023 12:08:07 +0200 Message-ID: <4589555.LvFx2qVVIh@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230418100555.GC11510@pendragon.ideasonboard.com> References: <20230418071439.197735-1-alexander.stein@ew.tq-group.com> <6038523.lOV4Wx5bFT@steina-w> <20230418100555.GC11510@pendragon.ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_030810_144966_BA509B7C X-CRM114-Status: GOOD ( 37.69 ) 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: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Laurent, Am Dienstag, 18. April 2023, 12:05:55 CEST schrieb Laurent Pinchart: > Hi Alexander, > = > On Tue, Apr 18, 2023 at 12:00:43PM +0200, Alexander Stein wrote: > > Am Dienstag, 18. April 2023, 11:27:13 CEST schrieb Laurent Pinchart: > > > On Tue, Apr 18, 2023 at 09:14:37AM +0200, Alexander Stein wrote: > > > > There is no need to convert input pixformat to mbus_framefmt and ba= ck > > > > again. Instead apply pixformat width contrains directly. > > > > = > > > > Signed-off-by: Alexander Stein > > > > --- > > > > = > > > > drivers/media/platform/nxp/imx7-media-csi.c | 14 +++++++++----- > > > > 1 file changed, 9 insertions(+), 5 deletions(-) > > > > = > > > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c > > > > b/drivers/media/platform/nxp/imx7-media-csi.c index > > > > b701e823436a8..bd649fd9166fd 100644 > > > > --- a/drivers/media/platform/nxp/imx7-media-csi.c > > > > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > > > > @@ -1145,8 +1145,8 @@ static const struct imx7_csi_pixfmt * > > > > = > > > > __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, > > > > = > > > > struct v4l2_rect *compose) > > > > = > > > > { > > > > = > > > > - struct v4l2_mbus_framefmt fmt_src; > > > > = > > > > const struct imx7_csi_pixfmt *cc; > > > > = > > > > + u32 stride; > > > > = > > > > /* > > > > = > > > > * Find the pixel format, default to the first supported format if > > > > not > > > > = > > > > @@ -1172,12 +1172,16 @@ __imx7_csi_video_try_fmt(struct > > > > v4l2_pix_format *pixfmt,> > > = > > > > } > > > > = > > > > } > > > > = > > > > - v4l2_fill_mbus_format(&fmt_src, pixfmt, 0); > > > > - imx7_csi_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc); > > > = > > > Could you please keep the comment from imx7_csi_mbus_fmt_to_pix_fmt() > > > here, to indicate where the alignment comes from ? > > = > > Sure, why not. > > = > > > /* Round up width for minimum burst size */ > > > = > > > We should likely revisit this in the future, I don't think the alignm= ent > > > = > > > is actually needed. This could be recorded already: > > > /* > > > = > > > * Round up width for minimum burst size. > > > * > > > * TODO: Implement configurable stride support, and check what the = real > > > * hardware alignment constraint on the width is. > > > */ > > = > > Sounds good. I was already suspecting actual stride support is not > > supported, as FBUF_PARA is set to 0 (in non-interlaced mode). > > = > > > > + v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8, > > > > + &pixfmt->height, 1, 0xffff, 1, 0); > > > > + > > > > + stride =3D round_up((pixfmt->width * cc->bpp) / 8, 8); > > > = > > > You can drop the round_up(), as pixfmt->width is now a multiple of 8,= so > > > = > > > pixfmt->bytesperline =3D pixfmt->width * cc->bpp / 8; > > = > > But that is only identical if cc->bpp =3D=3D 8, or am I missing somethi= ng > > here? > = > If cc->bpp is equal to 16, you will get > = > pixfmt->bytesperline =3D pixfmt->width * 2; > = > which will still be a multiple of 8 as width is a multiple of 8. That's true only for 16 bpp. If you are using e.g. 'RG10' this assumption i= s = not guaranteed. Apparently it happens to be the case for 1080p on my imx32= 7 = sensor though. Best regards, Alexander > > > > + pixfmt->bytesperline =3D stride; > > > > + pixfmt->sizeimage =3D stride * pixfmt->height; > > > > = > > > > if (compose) { > > > > = > > > > - compose->width =3D fmt_src.width; > > > > - compose->height =3D fmt_src.height; > > > > + compose->width =3D pixfmt->width; > > > = > > > This is a change of behaviour, compose->width used to be set to the > > > unaligned width. > > = > > Oh, you are right. I'll fix that. > > = > > > > + compose->height =3D pixfmt->height; > > > > = > > > > } > > > > = > > > > return cc; -- = TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel