Commit 84246ae3 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

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: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 256acbeb
...@@ -577,6 +577,9 @@ static void rvin_crop_scale_comp_gen2(struct rvin_dev *vin) ...@@ -577,6 +577,9 @@ static void rvin_crop_scale_comp_gen2(struct rvin_dev *vin)
void rvin_crop_scale_comp(struct rvin_dev *vin) void rvin_crop_scale_comp(struct rvin_dev *vin)
{ {
const struct rvin_video_format *fmt;
u32 stride;
/* Set Start/End Pixel/Line Pre-Clip */ /* Set Start/End Pixel/Line Pre-Clip */
rvin_write(vin, vin->crop.left, VNSPPRC_REG); rvin_write(vin, vin->crop.left, VNSPPRC_REG);
rvin_write(vin, vin->crop.left + vin->crop.width - 1, VNEPPRC_REG); rvin_write(vin, vin->crop.left + vin->crop.width - 1, VNEPPRC_REG);
...@@ -600,10 +603,9 @@ void rvin_crop_scale_comp(struct rvin_dev *vin) ...@@ -600,10 +603,9 @@ void rvin_crop_scale_comp(struct rvin_dev *vin)
if (vin->info->model != RCAR_GEN3) if (vin->info->model != RCAR_GEN3)
rvin_crop_scale_comp_gen2(vin); rvin_crop_scale_comp_gen2(vin);
if (vin->format.pixelformat == V4L2_PIX_FMT_NV16) fmt = rvin_format_from_pixel(vin, vin->format.pixelformat);
rvin_write(vin, ALIGN(vin->format.width, 0x20), VNIS_REG); stride = vin->format.bytesperline / fmt->bpp;
else rvin_write(vin, stride, VNIS_REG);
rvin_write(vin, ALIGN(vin->format.width, 0x10), VNIS_REG);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
...@@ -83,13 +83,16 @@ static u32 rvin_format_bytesperline(struct rvin_dev *vin, ...@@ -83,13 +83,16 @@ static u32 rvin_format_bytesperline(struct rvin_dev *vin,
struct v4l2_pix_format *pix) struct v4l2_pix_format *pix)
{ {
const struct rvin_video_format *fmt; const struct rvin_video_format *fmt;
u32 align;
fmt = rvin_format_from_pixel(vin, pix->pixelformat); fmt = rvin_format_from_pixel(vin, pix->pixelformat);
if (WARN_ON(!fmt)) if (WARN_ON(!fmt))
return -EINVAL; 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) static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment