提交 54e0521c 编写于 作者: N Niklas Söderlund 提交者: Zheng Zengkai

media: rcar-vin: Update format alignment constraints

stable inclusion
from stable-v5.10.94
commit 526b6c9b4521910d7af797a6badaceabcff8d21b
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=526b6c9b4521910d7af797a6badaceabcff8d21b

--------------------------------

[ Upstream commit da6911f3 ]

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: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 9ee38e50
...@@ -175,20 +175,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix) ...@@ -175,20 +175,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix)
break; break;
} }
/* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ /* Hardware limits width alignment based on format. */
switch (pix->pixelformat) { switch (pix->pixelformat) {
/* Multiple of 32 (2^5) for NV12/16. */
case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_NV16: case V4L2_PIX_FMT_NV16:
walign = 5; walign = 5;
break; break;
default: /* Multiple of 2 (2^1) for YUV. */
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_UYVY:
walign = 1; walign = 1;
break; break;
/* No multiple for RGB. */
default:
walign = 0;
break;
} }
/* Limit to VIN capabilities */ /* Limit to VIN capabilities */
v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign, v4l_bound_align_image(&pix->width, 5, vin->info->max_width, walign,
&pix->height, 4, vin->info->max_height, 2, 0); &pix->height, 2, vin->info->max_height, 0, 0);
pix->bytesperline = rvin_format_bytesperline(vin, pix); pix->bytesperline = rvin_format_bytesperline(vin, pix);
pix->sizeimage = rvin_format_sizeimage(pix); pix->sizeimage = rvin_format_sizeimage(pix);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册