[PATCH 2/2] media: imx: imx7-media-csi: Fix applying format constraints

Alexander Stein alexander.stein at ew.tq-group.com
Thu Jul 20 03:19:59 PDT 2023


Am Donnerstag, 20. Juli 2023, 09:41:29 CEST schrieb Alexander Stein:
> v4l_bound_align_image aligns to a multiple power of 2 of walign, but the
> result only needs to be a multiple of walign. Fix this by using
> v4l2_apply_frmsize_constraints() instead.
> 
> Reported-by: Tim Harvey <tharvey at gateworks.com>
> Fixes: 6f482c4729d9 ("media: imx: imx7-media-csi: Get rid of superfluous
> call to imx7_csi_mbus_fmt_to_pix_fmt") Signed-off-by: Alexander Stein
> <alexander.stein at ew.tq-group.com>
> ---
> Tim,
> can you please test if this fixes your problem?
> Apparently this issue only arises under specific conditions, e.g.
> 640/480/8bpp. This issue does not show up for 640/480/10bpp.
> 
>  drivers/media/platform/nxp/imx7-media-csi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c
> b/drivers/media/platform/nxp/imx7-media-csi.c index
> 73f8f2a35422..523e5f039a5a 100644
> --- a/drivers/media/platform/nxp/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -1141,8 +1141,8 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> *pixfmt, * 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);
> +	v4l2_apply_frmsize_constraints(&pixfmt->width, &pixfmt->height,
> +				       &imx7_csi_frmsize_stepwise);

Meh, this essentially removes the walign constraint. I need some more coffee 
and this some more work.

Sorry for the noise
Alexander

> 
>  	pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
>  	pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;


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





More information about the linux-arm-kernel mailing list