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

From: Hans Verkuil
Date: Sat Feb 20 2016 - 04:18:43 EST


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.

Regards,

Hans