All of lore.kernel.org
 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 v4 3/4] media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats
Date: Thu, 20 Apr 2023 13:33:05 +0300	[thread overview]
Message-ID: <20230420103305.GC11005@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230419070712.1422335-4-alexander.stein@ew.tq-group.com>

Hi Alexander,

Thank you for the patch.

On Wed, Apr 19, 2023 at 09:07:11AM +0200, Alexander Stein wrote:
> 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>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> Changes in v4:
> * Improve commit message
> * Simplify walign calculation
> * Remove comment on hardware alignment constraints
> 
>  drivers/media/platform/nxp/imx7-media-csi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> index 1315f5743b76f..e6abbfbc5c129 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;
> @@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
>  	}
>  
>  	/*
> -	 * Round up width for minimum burst size.
> +	 * 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, and check what the real
> -	 * hardware alignment constraint on the width is.
> +	 * TODO: Implement configurable stride support.
>  	 */
> -	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
> +	walign = 8 * 8 / cc->bpp;
> +	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

WARNING: multiple messages have this Message-ID (diff)
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 v4 3/4] media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats
Date: Thu, 20 Apr 2023 13:33:05 +0300	[thread overview]
Message-ID: <20230420103305.GC11005@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230419070712.1422335-4-alexander.stein@ew.tq-group.com>

Hi Alexander,

Thank you for the patch.

On Wed, Apr 19, 2023 at 09:07:11AM +0200, Alexander Stein wrote:
> 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>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> Changes in v4:
> * Improve commit message
> * Simplify walign calculation
> * Remove comment on hardware alignment constraints
> 
>  drivers/media/platform/nxp/imx7-media-csi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> index 1315f5743b76f..e6abbfbc5c129 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;
> @@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
>  	}
>  
>  	/*
> -	 * Round up width for minimum burst size.
> +	 * 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, and check what the real
> -	 * hardware alignment constraint on the width is.
> +	 * TODO: Implement configurable stride support.
>  	 */
> -	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
> +	walign = 8 * 8 / cc->bpp;
> +	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

  reply	other threads:[~2023-04-20 10:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  7:07 [PATCH v4 0/4] Fix imx7-media-csi format settings Alexander Stein
2023-04-19  7:07 ` Alexander Stein
2023-04-19  7:07 ` [PATCH v4 1/4] media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt Alexander Stein
2023-04-19  7:07   ` Alexander Stein
2023-04-19  7:07 ` [PATCH v4 2/4] media: imx: imx7-media-csi: Remove incorrect interlacing support Alexander Stein
2023-04-19  7:07   ` Alexander Stein
2023-04-19  7:07 ` [PATCH v4 3/4] media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats Alexander Stein
2023-04-19  7:07   ` Alexander Stein
2023-04-20 10:33   ` Laurent Pinchart [this message]
2023-04-20 10:33     ` Laurent Pinchart
2023-04-19  7:07 ` [PATCH v4 4/4] media: imx: imx7-media-csi: Init default format with __imx7_csi_video_try_fmt() Alexander Stein
2023-04-19  7:07   ` Alexander Stein
2023-05-24 13:02 ` [PATCH v4 0/4] Fix imx7-media-csi format settings Alexander Stein
2023-05-24 13:02   ` Alexander Stein
2023-05-24 15:39   ` Rui Miguel Silva
2023-05-24 15:39     ` Rui Miguel Silva

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=20230420103305.GC11005@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.