public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.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: Wed, 19 Apr 2023 09:01:17 +0200	[thread overview]
Message-ID: <6180938.31r3eYUQgx@steina-w> (raw)
In-Reply-To: <20230418155947.GI30837@pendragon.ideasonboard.com>

Hi Laurent,

thanks for the feedback.

Am Dienstag, 18. April 2023, 17:59:47 CEST schrieb Laurent Pinchart:
> Hi Alexander,
> 
> Thank you for the patch.
> 
> The commit message should state "Lift width constraint for 16bpp
> formats".

To be pedantic it should be called "Lift width constraint for non-8bpp 
formats" :)

> I would also phrase is "Relax" instead of "Lift" as it's not
> completely lifted.

That's true, this subtle difference should be accounted for. Thanks.

> 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.

Thanks for this suggestion. This sounds much better.

> > 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;

I was wondering how to shorten this calculation without using ? operator, 
nice.

> > +
> > 
> >  	/*
> >  	
> >  	 * 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);

That's neat, thanks. I'll update accordingly.

Best regards,
Alexander

> > -	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;


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger 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

  reply	other threads:[~2023-04-19  7:02 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
2023-04-19  7:01     ` Alexander Stein [this message]
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=6180938.31r3eYUQgx@steina-w \
    --to=alexander.stein@ew.tq-group.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --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