linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Pawel Osciak <pawel@osciak.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>
Subject: Re: [PATCH] [media] BZ#84401: Revert "[media] v4l: vb2: Don't return POLLERR during transient buffer underruns"
Date: Tue, 16 Sep 2014 14:42:36 +0300	[thread overview]
Message-ID: <1507629.uqIm3tmQgH@avalon> (raw)
In-Reply-To: <20140916075812.04a8290d@concha.lan>

Hi Mauro,

On Tuesday 16 September 2014 07:58:12 Mauro Carvalho Chehab wrote:
> Em Tue, 16 Sep 2014 13:15:27 +0300 Laurent Pinchart escreveu:
> > On Tuesday 16 September 2014 07:01:29 Mauro Carvalho Chehab wrote:
> > > Em Tue, 16 Sep 2014 12:09:01 +0300 Laurent Pinchart escreveu:
> > > > On Monday 15 September 2014 21:10:55 Mauro Carvalho Chehab wrote:
> > > > > This reverts commit 9241650d62f79a3da01f1d5e8ebd195083330b75.
> > > > > 
> > > > > The commit 9241650d62f7 was meant to solve an issue with Gstreamer
> > > > > version 0.10 with libv4l 1.2, where a fixup patch for DQBUF exposed
> > > > > a bad behavior ag Gstreamer.
> > > > 
> > > > That's not correct. The patch was created to solve an issue observed
> > > > with the Gstreamer 0.10 v4l2src element accessing the video device
> > > > directly, *without* libv4l.
> > > 
> > > Ok. From the discussions we took yesterday on the thread, I got the
> > > wrong impression from Nicolas comments that this happens only with
> > > gst < 1.4 and libv4l >= 1.2.
> > 
> > My understanding is that recent gst versions worked around the problem,
> > and the above combination of versions might be problematic, but gst 0.10
> > is definitely affected.
> > 
> > > > The V4L2 specification documents poll() as follows.
> > > > 
> > > > "When the application did not call VIDIOC_QBUF or VIDIOC_STREAMON yet
> > > > the poll() function succeeds, but sets the POLLERR flag in the revents
> > > > field."
> > > > 
> > > > The vb2 poll implementation didn't conform with that, as it returned
> > > > POLLERR when the buffer list was empty due to a transient buffer
> > > > underrun, even if both VIDIOC_STREAMON and VIDIOC_QBUF have been
> > > > called.
> > > > 
> > > > The commit thus brought the vb2 poll implementation in line with the
> > > > specification. If we really want to revert it to its broken behaviour,
> > > > then it would be fair to explain this in the revert message,
> > > 
> > > Ok, I'll rewrite the text. We likely want to fix the documentation too,
> > > in order to reflect the way it is.
> > > 
> > > > and I want to know how you propose fixing this properly, as the revert
> > > > really causes issues for userspace.
> > > 
> > > This patch simply broke all VBI applications. So, it should be reverted.
> > > 
> > > From what you're saying, using Gst 0.10 with a kernel before 3.16 and
> > > VB2 was always broken, right?
> > 
> > Correct. And not only gst 0.10, any userspace application that doesn't
> > specifically handles transient buffer underruns will be affected.
> > 
> > vb2 doesn't conform to the V4L2 specification, and I believe the
> > specification is right in this case. Reverting this patch will push the
> > problem to userspace, where all applications will have to handle buffer
> > underruns manually.
> 
> What happens with VB1? How is it solved there?
> 
> I don't generally use gst 0.10, but I don't remember a single error
> report about gst 0.10 and VB1-based drivers.

I haven't tried VB1, but a quick look at the source code shows it to be 
affected as well.

The problem with gst 0.10 is only noticeable when a buffer underrun occurs 
(when you don't requeue buffers fast enough and the queue buffers list becomes 
temporarily empty), so it can very well go unnoticed for a long time.

> > > And with VB1, is it also broken? If so, then this is a Gst 0.10 bug,
> > > and the fix should be a patch for it, or a recommendation to upgrade
> > > to a newer version without such bug.
> > 
> > As explained above, this isn't a gst bug.
> > 
> > > If, otherwise, it works with VB1, then we need to patch VB2 to have
> > > exactly the same behavior as VB1 with that regards, as VBI works
> > > with VB1.
> > 
> > One option would be to have implement a different poll behaviour for VBI
> > and video.
> 
> That would be a nightmare.

I don't like it much either. Hans has posted a proposal to fix the problem an 
hour ago, let's discuss it.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-09-16 11:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16  0:10 [PATCH] [media] BZ#84401: Revert "[media] v4l: vb2: Don't return POLLERR during transient buffer underruns" Mauro Carvalho Chehab
2014-09-16  9:09 ` Laurent Pinchart
2014-09-16 10:01   ` Mauro Carvalho Chehab
2014-09-16 10:15     ` Laurent Pinchart
2014-09-16 10:58       ` Mauro Carvalho Chehab
2014-09-16 11:42         ` Laurent Pinchart [this message]
2014-09-16 13:41           ` Mauro Carvalho Chehab
2014-09-16 13:56             ` Hans Verkuil
2014-09-18 10:06 ` [PATCH v2] " Mauro Carvalho Chehab
2014-09-18 10:10   ` Hans Verkuil
2014-09-18 10:50     ` Mauro Carvalho Chehab
2014-09-18 12:07       ` Hans Verkuil
2014-09-18 12:15         ` Mauro Carvalho Chehab
2014-09-18 12:21           ` Hans Verkuil
2014-09-18 12:49             ` Mauro Carvalho Chehab

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=1507629.uqIm3tmQgH@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@osg.samsung.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=pawel@osciak.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).