linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP Linux Team <linux-imx@nxp.com>,
	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
Date: Tue, 18 Apr 2023 18:59:47 +0300	[thread overview]
Message-ID: <20230418155947.GI30837@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230418122041.1318862-4-alexander.stein@ew.tq-group.com>

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 <alexander.stein@ew.tq-group.com>
> ---
> 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

  reply	other threads:[~2023-04-18 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 12:20 [PATCH v3 0/4] Fix imx7-media-csi format settings Alexander Stein
2023-04-18 12:20 ` [PATCH v3 1/4] media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt Alexander Stein
2023-04-18 15:35   ` Laurent Pinchart
2023-04-18 12:20 ` [PATCH v3 2/4] media: imx: imx7-media-csi: Remove interlave fields Alexander Stein
2023-04-18 15:43   ` Laurent Pinchart
2023-04-19  7:02     ` Alexander Stein
2023-04-18 12:20 ` [PATCH v3 3/4] media: imx: imx7-media-csi: Lift width constraints for 8bpp formats Alexander Stein
2023-04-18 15:59   ` Laurent Pinchart [this message]
2023-04-19  7:01     ` Alexander Stein
2023-04-18 12:20 ` [PATCH v3 4/4] media: imx: imx7-media-csi: Init default format with __imx7_csi_video_try_fmt() Alexander Stein

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=20230418155947.GI30837@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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).