Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mediatek: vcodec: Fix bitstream crop information error

Usually, the real bitstream width and height will set to driver
by vidioc_s_fmt, and vidioc_try_fmt() does align to get the
buffer width and height, driver calculate the encoded bitstream
crop information through them. The aligned resolution will be set
as real resolution now if user didn't set crop info by
V4L2_SEL_TGT_CROP, and the encoded bitstream may exist green line
because of crop information error.

Fixs: 'b6c57d313f5f8 ("media: mtk-vcodec: venc: remove redundant code")'

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Irui Wang and committed by
Mauro Carvalho Chehab
cd61f3c6 223afdf9

+4 -4
+4 -4
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
··· 503 503 f->fmt.pix.pixelformat = fmt->fourcc; 504 504 } 505 505 506 - ret = vidioc_try_fmt_out(ctx, f, fmt); 506 + q_data->visible_width = f->fmt.pix_mp.width; 507 + q_data->visible_height = f->fmt.pix_mp.height; 508 + q_data->fmt = fmt; 509 + ret = vidioc_try_fmt_out(ctx, f, q_data->fmt); 507 510 if (ret) 508 511 return ret; 509 512 510 - q_data->fmt = fmt; 511 - q_data->visible_width = f->fmt.pix_mp.width; 512 - q_data->visible_height = f->fmt.pix_mp.height; 513 513 q_data->coded_width = f->fmt.pix_mp.width; 514 514 q_data->coded_height = f->fmt.pix_mp.height; 515 515