Skip to content

Commit bef1bb6

Browse files
tq-steinaHans Verkuil
authored andcommitted
media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats
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> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
1 parent 79bb4c7 commit bef1bb6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/media/platform/nxp/imx7-media-csi.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
11461146
struct v4l2_rect *compose)
11471147
{
11481148
const struct imx7_csi_pixfmt *cc;
1149+
u32 walign;
11491150

11501151
if (compose) {
11511152
compose->width = pixfmt->width;
@@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
11631164
}
11641165

11651166
/*
1166-
* Round up width for minimum burst size.
1167+
* The width alignment is 8 bytes as indicated by the
1168+
* CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
11671169
*
1168-
* TODO: Implement configurable stride support, and check what the real
1169-
* hardware alignment constraint on the width is.
1170+
* TODO: Implement configurable stride support.
11701171
*/
1171-
v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
1172+
walign = 8 * 8 / cc->bpp;
1173+
v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
11721174
&pixfmt->height, 1, 0xffff, 1, 0);
11731175

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

0 commit comments

Comments
 (0)