public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Poll and empty queues
@ 2014-06-02 19:47 Nicolas Dufresne
  2014-06-03  6:38 ` Hans Verkuil
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Dufresne @ 2014-06-02 19:47 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

Hi everyone,

Recently in GStreamer we notice that we where not handling the POLLERR
flag at all. Though we found that what the code do, and what the doc
says is slightly ambiguous.

        "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."
        
In our case, we first seen this error with a capture device. How things
worked is that we first en-queue all allocated buffers. Our
interpretation was that this would avoid not calling "VIDIOC_QBUF [...]
yet", and only then we would call VIDIOC_STREAMON. This way, in our
interpretation we would never get that error.

Though, this is not what the code does. Looking at videobuf2, if simply
return this error when the queue is empty.

	/*
	 * There is nothing to wait for if no buffers have already been queued.
	 */
	if (list_empty(&q->queued_list))
		return res | POLLERR;

So basically, we endup in this situation where as soon as all existing
buffers has been dequeued, we can't rely on the driver to wait for a
buffer to be queued and then filled again. This basically forces us into
adding a new user-space mechanism, to wait for buffer to come back. We
are wandering if this is a bug. If not, maybe it would be nice to
improve the documentation.

cheers,
Nicolas

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-03 23:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 19:47 Poll and empty queues Nicolas Dufresne
2014-06-03  6:38 ` Hans Verkuil
2014-06-03 14:37   ` Nicolas Dufresne
2014-06-03 16:11     ` Laurent Pinchart
2014-06-03 17:39       ` Nicolas Dufresne
2014-06-03 23:46         ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox