Re: [PATCH v2 2/2] media: docs-rst: Document memory-to-memory video encoder interface

From: Nicolas Dufresne
Date: Thu Jan 24 2019 - 15:04:08 EST


Le mercredi 23 janvier 2019 Ã 12:28 +0100, Hans Verkuil a Ãcrit :
> On 01/23/19 11:00, Tomasz Figa wrote:
> > On Sat, Nov 17, 2018 at 8:37 PM Hans Verkuil <hverkuil@xxxxxxxxx> wrote:
> > > On 11/17/2018 05:18 AM, Nicolas Dufresne wrote:
> > > > Le lundi 12 novembre 2018 Ã 14:23 +0100, Hans Verkuil a Ãcrit :
> > > > > On 10/22/2018 04:49 PM, Tomasz Figa wrote:
> > [snip]
> > > > > > + rely on it. The ``V4L2_BUF_FLAG_LAST`` buffer flag should be used
> > > > > > + instead.
> > > > >
> > > > > Question: should new codec drivers still implement the EOS event?
> > > >
> > > > I'm been asking around, but I think here is a good place. Do we really
> > > > need the FLAG_LAST in userspace ? Userspace can also wait for the first
> > > > EPIPE return from DQBUF.
> > >
> > > I'm interested in hearing Tomasz' opinion. This flag is used already, so there
> > > definitely is a backwards compatibility issue here.
> > >
> >
> > FWIW, it would add the overhead of 1 more system call, although I
> > don't think it's of our concern.
> >
> > My personal feeling is that using error codes for signaling normal
> > conditions isn't very elegant, though.
>
> I agree. Let's keep this flag.

Agreed, though a reminder of the initial question, "do we keep the EOS
event ?", and I think the event can be dropped.

>
> Regards,
>
> Hans
>
> > > > > > +
> > > > > > +3. Once all ``OUTPUT`` buffers queued before the ``V4L2_ENC_CMD_STOP`` call and
> > > > > > + the last ``CAPTURE`` buffer are dequeued, the encoder is stopped and it will
> > > > > > + accept, but not process any newly queued ``OUTPUT`` buffers until the client
> > > > > > + issues any of the following operations:
> > > > > > +
> > > > > > + * ``V4L2_ENC_CMD_START`` - the encoder will resume operation normally,
> > > > >
> > > > > Perhaps mention that this does not reset the encoder? It's not immediately clear
> > > > > when reading this.
> > > >
> > > > Which drivers supports this ? I believe I tried with Exynos in the
> > > > past, and that didn't work. How do we know if a driver supports this or
> > > > not. Do we make it mandatory ? When it's not supported, it basically
> > > > mean userspace need to cache and resend the header in userspace, and
> > > > also need to skip to some sync point.
> > >
> > > Once we agree on the spec, then the next step will be to add good compliance
> > > checks and update drivers that fail the tests.
> > >
> > > To check if the driver support this ioctl you can call VIDIOC_TRY_ENCODER_CMD
> > > to see if the functionality is supported.
> >
> > There is nothing here for the hardware to support. It's an entirely
> > driver thing, since it just needs to wait for the encoder to complete
> > all the pending frames and stop enqueuing more frames to the decoder
> > until V4L2_ENC_CMD_START is called. Any driver that can't do it must
> > be fixed, since otherwise you have no way to ensure that you got all
> > the encoded output.
> >
> > Best regards,
> > Tomasz
> >