Linux Media Controller development
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: linux-media@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Fabio Estevam <festevam@denx.de>,
	NXP Linux Team <linux-imx@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Martin Kepplinger <martink@posteo.de>,
	Purism Kernel Team <kernel@puri.sm>
Subject: Re: [PATCH v3 2/3] media: imx: imx7-media-csi: Fix frame sizes enumeration
Date: Wed, 26 Jul 2023 08:27:41 +0200	[thread overview]
Message-ID: <14965809.tv2OnDr8pf@steina-w> (raw)
In-Reply-To: <20230725200249.15447-3-laurent.pinchart@ideasonboard.com>

Hi Laurent,

thanks for picking up my suggestion.

Am Dienstag, 25. Juli 2023, 22:02:48 CEST schrieb Laurent Pinchart:
> Enumeration of the minimum, maximum and step values for the image width
> does not take hardware constraints into account. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/media/platform/nxp/imx7-media-csi.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c
> b/drivers/media/platform/nxp/imx7-media-csi.c index
> 5684ecd2e3fe..3aa7978d3f8a 100644
> --- a/drivers/media/platform/nxp/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -1076,6 +1076,7 @@ static int imx7_csi_video_enum_framesizes(struct file
> *file, void *fh, struct v4l2_frmsizeenum *fsize)
>  {
>  	const struct imx7_csi_pixfmt *cc;
> +	u32 walign;
> 
>  	if (fsize->index > 0)
>  		return -EINVAL;
> @@ -1085,16 +1086,17 @@ static int imx7_csi_video_enum_framesizes(struct
> file *file, void *fh, return -EINVAL;
> 
>  	/*
> -	 * TODO: The constraints are hardware-specific and may depend on the
> -	 * pixel format. This should come from the driver using
> -	 * imx_media_capture.
> +	 * 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;
> +
>  	fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
> -	fsize->stepwise.min_width = 1;
> -	fsize->stepwise.max_width = 65535;
> +	fsize->stepwise.min_width = walign;
> +	fsize->stepwise.max_width = round_down(65535U, walign);
>  	fsize->stepwise.min_height = 1;
>  	fsize->stepwise.max_height = 65535;
> -	fsize->stepwise.step_width = 1;
> +	fsize->stepwise.step_width = walign;
>  	fsize->stepwise.step_height = 1;
> 
>  	return 0;

Looks good to me.
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>

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



  reply	other threads:[~2023-07-26  6:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 20:02 [PATCH v3 0/3] media: imx: imx7-media-csi: Fix width alignment Laurent Pinchart
2023-07-25 20:02 ` [PATCH v3 1/3] media: imx: imx7-media-csi: Fix applying format constraints Laurent Pinchart
2023-07-26  6:19   ` Alexander Stein
2023-07-25 20:02 ` [PATCH v3 2/3] media: imx: imx7-media-csi: Fix frame sizes enumeration Laurent Pinchart
2023-07-26  6:27   ` Alexander Stein [this message]
2023-07-25 20:02 ` [PATCH v3 3/3] media: imx: imx7-media-csi: Include headers explicitly Laurent Pinchart
2023-07-26  6:28   ` Alexander Stein
2023-08-17 22:24 ` [PATCH v3 0/3] media: imx: imx7-media-csi: Fix width alignment Tim Harvey

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=14965809.tv2OnDr8pf@steina-w \
    --to=alexander.stein@ew.tq-group.com \
    --cc=festevam@denx.de \
    --cc=kernel@pengutronix.de \
    --cc=kernel@puri.sm \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=rmfrfs@gmail.com \
    --cc=tharvey@gateworks.com \
    /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