diff options
author | Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> | 2019-08-08 08:10:58 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-08-13 17:39:02 +0300 |
commit | 84246ae3fde112c2d3e8215dfffadcc39b1362a6 (patch) | |
tree | 04b179c2654b80de7fa273940559a158e1cb0281 /drivers/media/platform/rcar-vin/rcar-v4l2.c | |
parent | 256acbebdc3b2ddfad4a5b1aa99488fad34b0f0d (diff) | |
download | linux-84246ae3fde112c2d3e8215dfffadcc39b1362a6.tar.xz |
media: rcar-vin: Report correct image stride
The image stride was adjusted when it was written to hardware and not
when configuring the format. Calculate the correct stride value and
report it to userspace.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/rcar-vin/rcar-v4l2.c')
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-v4l2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index cfed0a260413..cbc1c07f0a96 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -83,13 +83,16 @@ static u32 rvin_format_bytesperline(struct rvin_dev *vin, struct v4l2_pix_format *pix) { const struct rvin_video_format *fmt; + u32 align; fmt = rvin_format_from_pixel(vin, pix->pixelformat); if (WARN_ON(!fmt)) return -EINVAL; - return pix->width * fmt->bpp; + align = pix->pixelformat == V4L2_PIX_FMT_NV16 ? 0x20 : 0x10; + + return ALIGN(pix->width, align) * fmt->bpp; } static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix) |