diff options
author | Tiffany Lin <tiffany.lin@mediatek.com> | 2016-07-13 04:05:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-15 12:19:35 -0400 |
commit | 8d4eb2acb6d430e155a7d81bdbceca1e3394674b (patch) | |
tree | eeed998ce9a9e23ce732d7dbbdf2a35b6c6fbe58 | |
parent | 86e3577f11d0aa8a5d3c6199f9e3f23cdbd0c0ac (diff) |
[media] mtk-vcodec: fix default OUTPUT buffer size
When calculate OUTPUT buffer size in vidioc_try_fmt, it will
add more size hw need in each plane.
But in mtk_vcodec_enc_set_default_params, it do not add
same size in each plane.
This makes v4l2-compliance test fail.
This patch fix the issue.
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 907a6d12f0b8..3ed3f2d31df5 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | |||
@@ -328,10 +328,11 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt) | |||
328 | pix_fmt_mp->height += 32; | 328 | pix_fmt_mp->height += 32; |
329 | 329 | ||
330 | mtk_v4l2_debug(0, | 330 | mtk_v4l2_debug(0, |
331 | "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d", | 331 | "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d %d", |
332 | tmp_w, tmp_h, pix_fmt_mp->width, | 332 | tmp_w, tmp_h, pix_fmt_mp->width, |
333 | pix_fmt_mp->height, | 333 | pix_fmt_mp->height, |
334 | pix_fmt_mp->width * pix_fmt_mp->height); | 334 | pix_fmt_mp->plane_fmt[0].sizeimage, |
335 | pix_fmt_mp->plane_fmt[1].sizeimage); | ||
335 | 336 | ||
336 | pix_fmt_mp->num_planes = fmt->num_planes; | 337 | pix_fmt_mp->num_planes = fmt->num_planes; |
337 | pix_fmt_mp->plane_fmt[0].sizeimage = | 338 | pix_fmt_mp->plane_fmt[0].sizeimage = |
@@ -1166,9 +1167,13 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx) | |||
1166 | (q_data->coded_height + 32) <= MTK_VENC_MAX_H) | 1167 | (q_data->coded_height + 32) <= MTK_VENC_MAX_H) |
1167 | q_data->coded_height += 32; | 1168 | q_data->coded_height += 32; |
1168 | 1169 | ||
1169 | q_data->sizeimage[0] = q_data->coded_width * q_data->coded_height; | 1170 | q_data->sizeimage[0] = |
1171 | q_data->coded_width * q_data->coded_height+ | ||
1172 | ((ALIGN(q_data->coded_width, 16) * 2) * 16); | ||
1170 | q_data->bytesperline[0] = q_data->coded_width; | 1173 | q_data->bytesperline[0] = q_data->coded_width; |
1171 | q_data->sizeimage[1] = q_data->sizeimage[0] / 2; | 1174 | q_data->sizeimage[1] = |
1175 | (q_data->coded_width * q_data->coded_height) / 2 + | ||
1176 | (ALIGN(q_data->coded_width, 16) * 16); | ||
1172 | q_data->bytesperline[1] = q_data->coded_width; | 1177 | q_data->bytesperline[1] = q_data->coded_width; |
1173 | 1178 | ||
1174 | q_data = &ctx->q_data[MTK_Q_DATA_DST]; | 1179 | q_data = &ctx->q_data[MTK_Q_DATA_DST]; |