Re: [PATCH] media: mtk-vcodec: vdec: Reduce padding in VIDIOC_TRY_FMT

From: kernel test robot
Date: Wed Mar 31 2021 - 03:18:50 EST


Hi Fritz,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on linux/master linus/master v5.12-rc5 next-20210330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Fritz-Koenig/media-mtk-vcodec-vdec-Reduce-padding-in-VIDIOC_TRY_FMT/20210331-061702
base: git://linuxtv.org/media_tree.git master
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/70ddfb8b962ccf027d02fdb4502452f8996bb25f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Fritz-Koenig/media-mtk-vcodec-vdec-Reduce-padding-in-VIDIOC_TRY_FMT/20210331-061702
git checkout 70ddfb8b962ccf027d02fdb4502452f8996bb25f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c: In function 'vidioc_try_fmt':
>> drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:680:17: error: 'struct mtk_vcodec_dev' has no member named 'vdec_pdata'; did you mean 'venc_pdata'?
680 | if (ctx->dev->vdec_pdata->uses_stateless_api ||
| ^~~~~~~~~~
| venc_pdata


vim +680 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c

655
656 static int vidioc_try_fmt(struct v4l2_format *f, void *priv,
657 const struct mtk_video_fmt *fmt)
658 {
659 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
660
661 pix_fmt_mp->field = V4L2_FIELD_NONE;
662
663 if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
664 pix_fmt_mp->num_planes = 1;
665 pix_fmt_mp->plane_fmt[0].bytesperline = 0;
666 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
667 int tmp_w, tmp_h;
668 struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
669
670 pix_fmt_mp->height = clamp(pix_fmt_mp->height,
671 MTK_VDEC_MIN_H,
672 MTK_VDEC_MAX_H);
673 pix_fmt_mp->width = clamp(pix_fmt_mp->width,
674 MTK_VDEC_MIN_W,
675 MTK_VDEC_MAX_W);
676
677 tmp_w = pix_fmt_mp->width;
678 tmp_h = pix_fmt_mp->height;
679
> 680 if (ctx->dev->vdec_pdata->uses_stateless_api ||
681 ctx->state >= MTK_STATE_HEADER) {
682 v4l_bound_align_image(&pix_fmt_mp->width,
683 MTK_VDEC_MIN_W,
684 MTK_VDEC_MAX_W, 4,
685 &pix_fmt_mp->height,
686 MTK_VDEC_MIN_H,
687 MTK_VDEC_MAX_H, 5, 6);
688
689 if (pix_fmt_mp->width < tmp_w &&
690 (pix_fmt_mp->width + 16) <= MTK_VDEC_MAX_W)
691 pix_fmt_mp->width += 16;
692 if (pix_fmt_mp->height < tmp_h &&
693 (pix_fmt_mp->height + 32) <= MTK_VDEC_MAX_H)
694 pix_fmt_mp->height += 32;
695 } else {
696 /*
697 * Find next closer width align 64, height align 64, size align
698 * 64 rectangle
699 * Note: This only get default value, the real HW needed value
700 * only available when ctx in MTK_STATE_HEADER state
701 */
702 v4l_bound_align_image(&pix_fmt_mp->width,
703 MTK_VDEC_MIN_W,
704 MTK_VDEC_MAX_W, 6,
705 &pix_fmt_mp->height,
706 MTK_VDEC_MIN_H,
707 MTK_VDEC_MAX_H, 6, 9);
708
709 if (pix_fmt_mp->width < tmp_w &&
710 (pix_fmt_mp->width + 64) <= MTK_VDEC_MAX_W)
711 pix_fmt_mp->width += 64;
712 if (pix_fmt_mp->height < tmp_h &&
713 (pix_fmt_mp->height + 64) <= MTK_VDEC_MAX_H)
714 pix_fmt_mp->height += 64;
715 }
716
717 mtk_v4l2_debug(0,
718 "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d",
719 tmp_w, tmp_h, pix_fmt_mp->width,
720 pix_fmt_mp->height,
721 pix_fmt_mp->width * pix_fmt_mp->height);
722
723 pix_fmt_mp->num_planes = fmt->num_planes;
724 pix_fmt_mp->plane_fmt[0].sizeimage =
725 pix_fmt_mp->width * pix_fmt_mp->height;
726 pix_fmt_mp->plane_fmt[0].bytesperline = pix_fmt_mp->width;
727
728 if (pix_fmt_mp->num_planes == 2) {
729 pix_fmt_mp->plane_fmt[1].sizeimage =
730 (pix_fmt_mp->width * pix_fmt_mp->height) / 2;
731 pix_fmt_mp->plane_fmt[1].bytesperline =
732 pix_fmt_mp->width;
733 }
734 }
735
736 pix_fmt_mp->flags = 0;
737 return 0;
738 }
739

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip