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 9F699C77B7D for ; Tue, 18 Apr 2023 16:00:48 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w0fQW/IA1dzhKTfu+5loM6+3Zi29+u5xtvwyxAhByt4=; b=Gk6eJ7KBlVwVQu V28yC0uOWfRkoi1f3myxQS/nWeyakCVYhKAjbi8Zz4tSXDgoOJZMYkmL3/5x016T82IOCBlt9Lkfw f57wgkJTtDi5sLcTeFA4xN0tKQcpqJN44NmrRm/fwWfnTYZSPTdyv5Mu7Pm8w5MFvjvz7jIHI54+g sUsohMyWeQYjSqF8ESSH9h3KJa5y4F0B5XWbxriB0u70Q3RUZrNFJmyZQZLVZF/Lv/qT+yCcgReuQ lDK0Y6deSvSmGRd3sS9NghkvLPcmx1Bx+Xg4Wk8yLXwvuyX9YPZnP32ifjpAhX/Hi8wW97QgHAVK9 Tpvz5AzA7vTaxDrwg5TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponk4-002hfe-0p; Tue, 18 Apr 2023 15:59:40 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponk1-002hf1-1N for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:59:38 +0000 Received: from pendragon.ideasonboard.com (133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CADB0DE5; Tue, 18 Apr 2023 17:59:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1681833569; bh=Os6VV2xNZag6aj5YHpY7G1MLfMhF6i8xkSfXswyw18U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dYh7GncZp2C92vd+x7c4N2vULefTdbRgoxLVRjeCNk94TN7065S/CR1ksYIAzuh+Q Kt/buPdD94PxHDHD34nKrsdxfU2c/xMHT4o+WrftQ/w9bnd03x/wXpfle+jdEiLl+W NzHLzWoAdQlauj8/IJ4YOeBQDIcwt1M7lrnXlE5E= Date: Tue, 18 Apr 2023 18:59:47 +0300 From: Laurent Pinchart To: Alexander Stein 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 v3 3/4] media: imx: imx7-media-csi: Lift width constraints for 8bpp formats Message-ID: <20230418155947.GI30837@pendragon.ideasonboard.com> References: <20230418122041.1318862-1-alexander.stein@ew.tq-group.com> <20230418122041.1318862-4-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230418122041.1318862-4-alexander.stein@ew.tq-group.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_085937_613333_F2869D87 X-CRM114-Status: GOOD ( 21.47 ) 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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Alexander, Thank you for the patch. The commit message should state "Lift width constraint for 16bpp formats". I would also phrase is "Relax" instead of "Lift" as it's not completely lifted. On Tue, Apr 18, 2023 at 02:20:40PM +0200, Alexander Stein wrote: > For 8-bit formats the image_width just needs to be a multiple of 8 pixels > others just a multiple of 4 pixels. This is a bit terse, and I think a word or two are missing. It could be improved: The driver unconditionally aligns the image width to multiples of 8 pixels. The real alignment constraint is 8 bytes, as indicated by the CSI_IMAG_PARA.IMAGE_WIDTH documentation that calls for 8 pixel alignment for 8bpp formats and 4 pixel alignment for other formats. > Signed-off-by: Alexander Stein > --- > Changes in v3: > * Fix commit message (Only 8-bit formats needs multiple of 8 pixels) > > drivers/media/platform/nxp/imx7-media-csi.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c > index 1315f5743b76f..730c9c57bf4bc 100644 > --- a/drivers/media/platform/nxp/imx7-media-csi.c > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > @@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, > struct v4l2_rect *compose) > { > const struct imx7_csi_pixfmt *cc; > + u32 walign; > > if (compose) { > compose->width = pixfmt->width; > @@ -1162,13 +1163,19 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, > cc = imx7_csi_find_pixel_format(pixfmt->pixelformat); > } > > + /* Refer to CSI_IMAG_PARA.IMAGE_WIDTH description */ > + if (cc->bpp == 8) > + walign = 8; > + else > + walign = 4; Would the following convey the purpose better ? /* * The width alignment is 8 bytes as indicated by the * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels. */ walign = 8 * 8 / cc->bpp; > + > /* > * Round up width for minimum burst size. > * > * TODO: Implement configurable stride support, and check what the real > * hardware alignment constraint on the width is. > */ We can now drop the second part of the sentence :-) The first line is actually not very accurate anymore. How about /* * The width alignment is 8 bytes as indicated by the * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels. * * TODO: Implement configurable stride support. */ walign = 8 * 8 / cc->bpp; v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign, &pixfmt->height, 1, 0xffff, 1, 0); > - v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8, > + v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign, > &pixfmt->height, 1, 0xffff, 1, 0); > > pixfmt->bytesperline = pixfmt->width * cc->bpp / 8; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel