Re: [PATCH v4 5/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

From: tiffany lin
Date: Mon Feb 22 2016 - 10:19:36 EST


Hi Hans,

On Sat, 2016-02-20 at 10:18 +0100, Hans Verkuil wrote:
> On 02/20/2016 10:11 AM, tiffany lin wrote:
> > Hi Hans,
> >
> > On Tue, 2016-02-16 at 08:44 +0100, Hans Verkuil wrote:
> >> On 02/16/2016 07:37 AM, tiffany lin wrote:
> >>>>> +
> >>>>> +const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
> >>>>> + .vidioc_streamon = v4l2_m2m_ioctl_streamon,
> >>>>> + .vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
> >>>>> +
> >>>>> + .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs,
> >>>>> + .vidioc_querybuf = v4l2_m2m_ioctl_querybuf,
> >>>>> + .vidioc_qbuf = vidioc_venc_qbuf,
> >>>>> + .vidioc_dqbuf = vidioc_venc_dqbuf,
> >>>>> +
> >>>>> + .vidioc_querycap = vidioc_venc_querycap,
> >>>>> + .vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane,
> >>>>> + .vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane,
> >>>>> + .vidioc_enum_framesizes = vidioc_enum_framesizes,
> >>>>> +
> >>>>> + .vidioc_try_fmt_vid_cap_mplane = vidioc_try_fmt_vid_cap_mplane,
> >>>>> + .vidioc_try_fmt_vid_out_mplane = vidioc_try_fmt_vid_out_mplane,
> >>>>> + .vidioc_expbuf = v4l2_m2m_ioctl_expbuf,
> >>>>
> >>>> Please add vidioc_create_bufs and vidioc_prepare_buf as well.
> >>>>
> >>>
> >>> Currently we do not support these use cases, do we need to add
> >>> vidioc_create_bufs and vidioc_prepare_buf now?
> >>
> >> I would suggest you do. The vb2 framework gives it (almost) for free.
> >> prepare_buf is completely free (just add the helper) and create_bufs
> >> needs a few small changes in the queue_setup function, that's all.
> >>
> > After try to add vidioc_create_bufs directly using
> > vb2_ioctl_create_bufs, it will have problem in
>
> This is a m2m device, so you should use the m2m variant of this:
> v4l2_m2m_ioctl_create_bufs
>
> That should solve this problem.
>
> Ditto for prepare_buf: you need to use v4l2_m2m_ioctl_prepare_buf.
>
Got it. After using v4l2_m2m_ioctl_create_bufs, the problem was solved.
Thanks for your help.

> Regards,
>
> Hans