public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Pawel Osciak <pawel@osciak.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-media@vger.kernel.org
Subject: Re: vb2: holding buffers until after start_streaming()
Date: Mon, 20 Jun 2011 10:20:53 +0200	[thread overview]
Message-ID: <4DFF02E5.8030601@samsung.com> (raw)
In-Reply-To: <20110617125713.293f484d@bike.lwn.net>

Hi Jon

On 06/17/2011 08:57 PM, Jonathan Corbet wrote:
> Here's another videobuf2 question...I've been trying to track down some
> weird behavior, the roots of which were in the fact that start_streaming()
> gets called even though no buffers have been queued.  This behavior is
> quite explicit in the code:
> 
> 	/*
> 	 * Let driver notice that streaming state has been enabled.
> 	 */
> 	ret = call_qop(q, start_streaming, q);
> 	if (ret) {
> 		dprintk(1, "streamon: driver refused to start streaming\n");
> 		return ret;
> 	}
> 
> 	q->streaming = 1;
> 
> 	/*
> 	 * If any buffers were queued before streamon,
> 	 * we can now pass them to driver for processing.
> 	 */
> 	list_for_each_entry(vb, &q->queued_list, queued_entry)
> 		__enqueue_in_driver(vb);
> 
> Pretty much every v4l2 capture application I've ever encountered passes all
> of its buffers to VIDIOC_QBUF before starting streaming for a reason - it
> makes little sense to start if there's nothing to stream to.  It's really
> tempting to reorder that code, but...  it seems you must have done things
> this way for a reason.  Why did you need to reorder the operations in this
> way?

AFAIR one of main reasons for doing the operations in that order was to
create consistent conditions for the drivers, regardless of the call sequence
in the user space.

You may find more information in this thread:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg29348.html


--
Regards,
Sylwester

      parent reply	other threads:[~2011-06-20  8:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 18:57 vb2: holding buffers until after start_streaming() Jonathan Corbet
2011-06-20  1:28 ` Pawel Osciak
2011-06-20  5:30   ` Marek Szyprowski
2011-06-20 15:48     ` Jonathan Corbet
2011-06-21 16:07       ` Marek Szyprowski
2011-06-21 17:14         ` Jonathan Corbet
2011-06-22  9:43           ` Marek Szyprowski
2011-06-22 12:38             ` Jonathan Corbet
2011-06-22 12:48               ` Hans Verkuil
2011-06-20 17:18     ` Hans Verkuil
2011-06-20  8:20 ` Sylwester Nawrocki [this message]

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=4DFF02E5.8030601@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=corbet@lwn.net \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.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