[v2,3/3] media: imx: imx7-media-csi: Lift width constraints for 8bpp formats
Commit Message
For 8-bit formats the image_width just needs to be a multiple of 4 pixels.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
drivers/media/platform/nxp/imx7-media-csi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
Hi Alexander,
Thank you for the patch.
On Tue, Apr 18, 2023 at 09:14:39AM +0200, Alexander Stein wrote:
> For 8-bit formats the image_width just needs to be a multiple of 4 pixels.
This doesn't match the code below. I think the code is right, the commit
message should be updated.
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> 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 1508f6ba20e91..5240670476b2b 100644
> --- a/drivers/media/platform/nxp/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -1147,6 +1147,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
> {
> const struct imx7_csi_pixfmt *cc;
> u32 stride;
> + u32 walign;
>
> /*
> * Find the pixel format, default to the first supported format if not
> @@ -1172,7 +1173,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
> }
> }
>
> - v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
> + /* Refer to CSI_IMAG_PARA.IMAGE_WIDTH description */
> + if (cc->bpp == 8)
> + walign = 8;
> + else
> + walign = 4;
> +
> + v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
> &pixfmt->height, 1, 0xffff, 1, 0);
>
> stride = round_up((pixfmt->width * cc->bpp) / 8, 8);
@@ -1147,6 +1147,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
{
const struct imx7_csi_pixfmt *cc;
u32 stride;
+ u32 walign;
/*
* Find the pixel format, default to the first supported format if not
@@ -1172,7 +1173,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
}
}
- v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
+ /* Refer to CSI_IMAG_PARA.IMAGE_WIDTH description */
+ if (cc->bpp == 8)
+ walign = 8;
+ else
+ walign = 4;
+
+ v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
&pixfmt->height, 1, 0xffff, 1, 0);
stride = round_up((pixfmt->width * cc->bpp) / 8, 8);