linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hansverk@cisco.com>
To: linux-media <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Pawel Osciak <pawel@osciak.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>
Subject: [RFC PATCH] vb2: regression fix for vbi capture & poll
Date: Tue, 16 Sep 2014 12:28:50 +0200	[thread overview]
Message-ID: <541810E2.4040509@cisco.com> (raw)

(My proposal to fix this. Note that it is untested, I plan to do that this
evening)

Commit 9241650d62f7 broke vbi capture applications that expect POLLERR to be
returned if STREAMON wasn't called.

Rather than checking whether buffers were queued AND vb2 was not yet streaming,
just check whether streaming is in progress and return POLLERR if not.

This change makes it impossible to poll in one thread and call STREAMON in
another, but doing that breaks existing applications and is also not according
to the spec. So be it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 7e6aff6..0452fb2 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -2583,10 +2583,10 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
 	}
 
 	/*
-	 * There is nothing to wait for if no buffer has been queued and the
-	 * queue isn't streaming, or if the error flag is set.
+	 * There is nothing to wait for if the queue isn't streaming, or if
+	 * the error flag is set.
 	 */
-	if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error)
+	if (!vb2_is_streaming(q) || q->error)
 		return res | POLLERR;
 
 	/*

             reply	other threads:[~2014-09-16 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 10:28 Hans Verkuil [this message]
2014-09-16 10:32 ` [RFC PATCH] vb2: regression fix for vbi capture & poll Laurent Pinchart
  -- strict thread matches above, loose matches on Subject: below --
2014-09-16  9:28 Hans Verkuil
2014-09-16 13:50 ` Mauro Carvalho Chehab
2014-09-16 14:02   ` Hans Verkuil

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=541810E2.4040509@cisco.com \
    --to=hansverk@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@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).