From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, m.chehab@samsung.com,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv2 1/3] vb2: fix VBI/poll regression
Date: Sun, 21 Sep 2014 12:45:46 +0300 [thread overview]
Message-ID: <2473791.PZayTX8bYa@avalon> (raw)
In-Reply-To: <541E9BA2.40808@xs4all.nl>
Hi Hans,
On Sunday 21 September 2014 11:34:26 Hans Verkuil wrote:
> On 09/21/2014 11:30 AM, Laurent Pinchart wrote:
> > On Sunday 21 September 2014 11:00:02 Hans Verkuil wrote:
> >> On 09/20/2014 09:26 PM, Laurent Pinchart wrote:
> >>> On Saturday 20 September 2014 21:16:35 Hans Verkuil wrote:
> >>>> From: Hans Verkuil <hans.verkuil@cisco.com>
> >>>>
> >>>> The recent conversion of saa7134 to vb2 unconvered a poll() bug that
> >>>> broke the teletext applications alevt and mtt. These applications
> >>>> expect that calling poll() without having called VIDIOC_STREAMON will
> >>>> cause poll() to return POLLERR. That did not happen in vb2.
> >>>>
> >>>> This patch fixes that behavior. It also fixes what should happen when
> >>>> poll() is called when STREAMON is called but no buffers have been
> >>>> queued. In that case poll() will also return POLLERR, but only for
> >>>> capture queues since output queues will always return POLLOUT
> >>>> anyway in that situation.
> >>>>
> >>>> This brings the vb2 behavior in line with the old videobuf behavior.
> >>>>
> >>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> >>>> ---
> >>>>
> >>>> drivers/media/v4l2-core/videobuf2-core.c | 17 ++++++++++++++---
> >>>> include/media/videobuf2-core.h | 4 ++++
> >>>> 2 files changed, 18 insertions(+), 3 deletions(-)
> >>>>
> >>>> diff --git a/drivers/media/v4l2-core/videobuf2-core.c
> >>>> b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..a0aa694
> >>>> 100644
> >>>> --- a/drivers/media/v4l2-core/videobuf2-core.c
> >>>> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> >>>> @@ -977,6 +977,7 @@ static int __reqbufs(struct vb2_queue *q, struct
> >>>> v4l2_requestbuffers *req) * to the userspace.
> >>>>
> >>>> */
> >>>>
> >>>> req->count = allocated_buffers;
> >>>>
> >>>> + q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type);
> >>>>
> >>>> return 0;
> >>>>
> >>>> }
> >>>>
> >>>> @@ -1024,6 +1025,7 @@ static int __create_bufs(struct vb2_queue *q,
> >>>> struct
> >>>> v4l2_create_buffers *create memset(q->plane_sizes, 0,
> >>>> sizeof(q->plane_sizes));
> >>>>
> >>>> memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
> >>>> q->memory = create->memory;
> >>>>
> >>>> + q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type);
> >>>
> >>> Wouldn't it be easier to set the flag when creating the queue and in
> >>> vb2_internal_streamoff() instead of in __create_bufs and __reqbufs ?
> >>> I'll
> >>> let you decide.
> >>
> >> Sorry, I don't follow. 'When creating the queue'? __create_bufs and
> >> __reqbufs are the functions that create the queue (i.e. allocate the
> >> buffers).
> >
> > I meant vb2_queue_init.
>
> That's not an option as it is called only once at probe time.
I know :-)
> And this flag needs to be set every time you setup the queue for streaming,
> when you stop streaming and when you queue a buffer.
I was thinking it would be enough to set the flag when stopping the stream, as
it would then be set for the next REQBUFS or CREATE_BUFS operation, but that
would break if an application calls QBUF - close() - open() - ...
Let's proceed with your patch.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-09-21 9:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-20 19:16 [PATCHv2 0/3] vb2: fix VBI/poll regression Hans Verkuil
2014-09-20 19:16 ` [PATCHv2 1/3] " Hans Verkuil
2014-09-20 19:26 ` Laurent Pinchart
2014-09-21 9:00 ` Hans Verkuil
2014-09-21 9:30 ` Laurent Pinchart
2014-09-21 9:34 ` Hans Verkuil
2014-09-21 9:45 ` Laurent Pinchart [this message]
2014-09-20 19:16 ` [PATCHv2 2/3] DocBook media: fix the poll() 'no QBUF' documentation Hans Verkuil
2014-09-20 19:16 ` [PATCHv2 3/3] DocBook media: improve the poll() documentation Hans Verkuil
2014-09-20 19:32 ` [PATCHv2 0/3] vb2: fix VBI/poll regression Laurent Pinchart
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=2473791.PZayTX8bYa@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.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;
as well as URLs for NNTP newsgroup(s).