From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sylwester Nawrocki <snjw23@gmail.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
"'javier Martin'" <javier.martin@vista-silicon.com>,
linux-media@vger.kernel.org, hverkuil@xs4all.nl,
kyungmin.park@samsung.com, shawn.guo@linaro.org,
richard.zhao@linaro.org, fabio.estevam@freescale.com,
kernel@pengutronix.de, s.hauer@pengutronix.de,
r.schwebel@pengutronix.de, "'Pawel Osciak'" <p.osciak@gmail.com>
Subject: Re: MEM2MEM devices: how to handle sequence number?
Date: Sun, 25 Dec 2011 22:19:10 +0100 [thread overview]
Message-ID: <201112252219.11412.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <4EF4A45E.1070501@gmail.com>
Hi Sylwester,
On Friday 23 December 2011 16:55:10 Sylwester Nawrocki wrote:
> On 12/23/2011 12:54 PM, Laurent Pinchart wrote:
> >>>>> diff --git a/drivers/media/video/videobuf2-core.c
> >>>>> b/drivers/media/video/videobuf2-core.c
> >>>>> index 1250662..7d8a88b 100644
> >>>>> --- a/drivers/media/video/videobuf2-core.c
> >>>>> +++ b/drivers/media/video/videobuf2-core.c
> >>>>> @@ -1127,6 +1127,7 @@ int vb2_qbuf(struct vb2_queue *q, struct
> >>>>> v4l2_buffer *b)
> >>>>>
> >>>>> */
> >>>>>
> >>>>> list_add_tail(&vb->queued_entry,&q->queued_list);
> >>>>> vb->state = VB2_BUF_STATE_QUEUED;
> >>>>>
> >>>>> + vb->v4l2_buf.sequence = b->sequence;
> >>>>>
> >>>>> /*
> >>>>>
> >>>>> * If already streaming, give the buffer to driver for
> >>>>> processing.
> >>>>
> >>>> Right, such patch is definitely needed. Please resend it with
> >>>> 'signed-off-by' annotation.
> >>>
> >>> I'm not too sure about that. Isn't the sequence number supposed to be
> >>> ignored by drivers on video output devices ? The documentation is a bit
> >>> terse on the subject, all it says is
> >>>
> >>> __u32 sequence Set by the driver, counting the frames in the
> >>> sequence.
> >>
> >> We can also update the documentation if needed. IMHO copying sequence
> >> number in mem2mem case if there is 1:1 relation between the buffers is a
> >> good idea.
> >
> > My point is that sequence numbers are currently not applicable to video
> > output devices, at least according to the documentation. Applications
> > will just set them to 0.
>
> Looks like the documentation wasn't updated when the Memory-To-Memory
> interface has been introduced.
>
> > I think it would be better to have the m2m driver set the sequence number
> > internally on the video output node by incrementing an counter, and pass
> > it down the pipeline to the video capture node.
>
> It sounds reasonable. Currently the sequence is zeroed at streamon in the
> capture drivers. Similar behaviour could be assured by m2m drivers.
I agree.
> In Javier's case it's probably more reliable to check the sequence numbers
> contiguity directly at the image source driver's device node.
>
> Although when m2m driver sets the sequence number internally on a video
> output queue it could make sense to have the buffer's sequence number
> updated upon return from VIDIOC_QBUF. What do you think ?
Yes, that wouldn't hurt and could provide interesting information. In the
general video output case it won't matter much, as the sequence numbers will
be contiguous and won't be used by anything else, but in the mem-to-mem case
it could let applications synchronize images with the video capture node on
the mem-to-mem output. However, we can't always assume a 1-to-1 correspondance
between an input (to the mem-to-mem device) and an output buffer, as more than
one input buffer could be required to decompress a frame for instance. In that
case, should the video capture node still report the sequence number used by
the video output node ? If it does, there will be gaps in the video capture
sequence numbers.
> This would be needed for the object detection interface if we wanted to
> associate object detection result with a frame sequence number.
Agreed, in that case that would be pretty interesting.
> As far as the implementation is concerned, m2m and output drivers (with
> selected capabilities only?) would have to update buffer sequence number
> from within buf_queue vb2 queue op.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2011-12-25 21:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 14:34 MEM2MEM devices: how to handle sequence number? javier Martin
2011-12-23 7:09 ` Marek Szyprowski
2011-12-23 11:28 ` Laurent Pinchart
2011-12-23 11:35 ` Marek Szyprowski
2011-12-23 11:54 ` Laurent Pinchart
2011-12-23 15:55 ` Sylwester Nawrocki
2011-12-25 21:19 ` Laurent Pinchart [this message]
2012-01-02 10:22 ` javier Martin
2012-01-02 11:06 ` Laurent Pinchart
2012-01-02 11:44 ` javier Martin
2012-01-03 14:00 ` Laurent Pinchart
2011-12-23 11:57 ` Andy Walls
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201112252219.11412.laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=fabio.estevam@freescale.com \
--cc=hverkuil@xs4all.nl \
--cc=javier.martin@vista-silicon.com \
--cc=kernel@pengutronix.de \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=p.osciak@gmail.com \
--cc=r.schwebel@pengutronix.de \
--cc=richard.zhao@linaro.org \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@linaro.org \
--cc=snjw23@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox