Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91ae0e1e authored by Tiffany Lin's avatar Tiffany Lin Committed by Mauro Carvalho Chehab
Browse files

[media] vcodec:mediatek: Fix visible_height larger than coded_height issue in s_fmt_out



The original code add extra 32 line to visible_height.
It is incorrect, 32 line should be add to coded_height.
The purpose is that user space could calcuate real buffer size needed by using
coded_width * coded_height.
But this method will make v4l2-compliance test fail, since g_fmt != s_fmt(g_fmt)
So remove extend visible_height or coded_height, user space should just
use sizeimage to get real buffer size needed

Signed-off-by: default avatarTiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ad34f541
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -487,7 +487,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
	struct mtk_q_data *q_data;
	struct mtk_q_data *q_data;
	int ret, i;
	int ret, i;
	struct mtk_video_fmt *fmt;
	struct mtk_video_fmt *fmt;
	unsigned int pitch_w_div16;
	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;


	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
@@ -530,15 +529,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
	q_data->coded_width = f->fmt.pix_mp.width;
	q_data->coded_width = f->fmt.pix_mp.width;
	q_data->coded_height = f->fmt.pix_mp.height;
	q_data->coded_height = f->fmt.pix_mp.height;


	pitch_w_div16 = DIV_ROUND_UP(q_data->visible_width, 16);
	if (pitch_w_div16 % 8 != 0) {
		/* Adjust returned width/height, so application could correctly
		 * allocate hw required memory
		 */
		q_data->visible_height += 32;
		vidioc_try_fmt(f, q_data->fmt);
	}

	q_data->field = f->fmt.pix_mp.field;
	q_data->field = f->fmt.pix_mp.field;
	ctx->colorspace = f->fmt.pix_mp.colorspace;
	ctx->colorspace = f->fmt.pix_mp.colorspace;
	ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc;
	ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc;