Commit 451d43ad authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] media: coda: fix sizeimage setting in try_fmt

VIDIOC_TRY_FMT would incorrectly return bytesperline * height,
instead of width * height * 3 / 2.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Tested-by: default avatarJavier Martin <javier.martin@vista-silicon.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 62bed14c
...@@ -412,8 +412,8 @@ static int vidioc_try_fmt(struct coda_dev *dev, struct v4l2_format *f) ...@@ -412,8 +412,8 @@ static int vidioc_try_fmt(struct coda_dev *dev, struct v4l2_format *f)
W_ALIGN, &f->fmt.pix.height, W_ALIGN, &f->fmt.pix.height,
MIN_H, MAX_H, H_ALIGN, S_ALIGN); MIN_H, MAX_H, H_ALIGN, S_ALIGN);
f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 2); f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 2);
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.sizeimage = f->fmt.pix.width *
f->fmt.pix.bytesperline; f->fmt.pix.height * 3 / 2;
} else { /*encoded formats h.264/mpeg4 */ } else { /*encoded formats h.264/mpeg4 */
f->fmt.pix.bytesperline = 0; f->fmt.pix.bytesperline = 0;
f->fmt.pix.sizeimage = CODA_MAX_FRAME_SIZE; f->fmt.pix.sizeimage = CODA_MAX_FRAME_SIZE;
...@@ -497,11 +497,7 @@ static int vidioc_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f) ...@@ -497,11 +497,7 @@ static int vidioc_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f)
q_data->fmt = find_format(ctx->dev, f); q_data->fmt = find_format(ctx->dev, f);
q_data->width = f->fmt.pix.width; q_data->width = f->fmt.pix.width;
q_data->height = f->fmt.pix.height; q_data->height = f->fmt.pix.height;
if (q_data->fmt->fourcc == V4L2_PIX_FMT_YUV420) { q_data->sizeimage = f->fmt.pix.sizeimage;
q_data->sizeimage = q_data->width * q_data->height * 3 / 2;
} else { /* encoded format h.264/mpeg-4 */
q_data->sizeimage = CODA_MAX_FRAME_SIZE;
}
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"Setting format for type %d, wxh: %dx%d, fmt: %d\n", "Setting format for type %d, wxh: %dx%d, fmt: %d\n",
......
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