Skip to content

Commit 526b6c9

Browse files
Niklas Söderlundgregkh
authored andcommitted
media: rcar-vin: Update format alignment constraints
[ Upstream commit da6911f ] This change fixes two issues with the size constraints for buffers. - There is no width alignment constraint for RGB formats. Prior to this change they were treated as YUV and as a result were more restricted than needed. Add a new check to differentiate between the two. - The minimum width and height supported is 5x2, not 2x4, this is an artifact from the driver's soc-camera days. Fix this incorrect assumption. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 74e60c1 commit 526b6c9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎drivers/media/platform/rcar-vin/rcar-v4l2.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix)
175175
break;
176176
}
177177

178-
/* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */
178+
/* Hardware limits width alignment based on format. */
179179
switch (pix->pixelformat) {
180+
/* Multiple of 32 (2^5) for NV12/16. */
180181
case V4L2_PIX_FMT_NV12:
181182
case V4L2_PIX_FMT_NV16:
182183
walign = 5;
183184
break;
184-
default:
185+
/* Multiple of 2 (2^1) for YUV. */
186+
case V4L2_PIX_FMT_YUYV:
187+
case V4L2_PIX_FMT_UYVY:
185188
walign = 1;
186189
break;
190+
/* No multiple for RGB. */
191+
default:
192+
walign = 0;
193+
break;
187194
}
188195

189196
/* Limit to VIN capabilities */
190-
v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign,
191-
&pix->height, 4, vin->info->max_height, 2, 0);
197+
v4l_bound_align_image(&pix->width, 5, vin->info->max_width, walign,
198+
&pix->height, 2, vin->info->max_height, 0, 0);
192199

193200
pix->bytesperline = rvin_format_bytesperline(vin, pix);
194201
pix->sizeimage = rvin_format_sizeimage(pix);

0 commit comments

Comments
 (0)