linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: 'Jonathan Corbet' <corbet@lwn.net>, linux-media@vger.kernel.org
Cc: 'Mauro Carvalho Chehab' <mchehab@redhat.com>
Subject: RE: [PATCH] videobuf2: call buf_finish() on unprocessed buffers
Date: Fri, 15 Jul 2011 08:17:15 +0200	[thread overview]
Message-ID: <000101cc42b6$d7582160$86086420$%szyprowski@samsung.com> (raw)
In-Reply-To: <20110714150934.74777696@bike.lwn.net>

Hello,

On Thursday, July 14, 2011 11:10 PM Jonathan Corbet wrote:

> When user space stops streaming, there may be buffers which have been given
> to buf_prepare() and which may or may not have been passed to buf_queue().
> The videobuf2 core simply takes those buffers back; if buf_prepare() does
> work that needs cleaning up (like setting up a DMA mapping), that cleanup
> will not happen.
> 
> This patch establishes a simple contract with drivers: buffers given to
> buf_prepare() will eventually see a buf_finish() call.
> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>  drivers/media/video/videobuf2-core.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/videobuf2-core.c
> b/drivers/media/video/videobuf2-core.c
> index 6ba1461..2ba08ab 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -1177,6 +1177,7 @@ EXPORT_SYMBOL_GPL(vb2_streamon);
>   */
>  static void __vb2_queue_cancel(struct vb2_queue *q)
>  {
> +	struct vb2_buffer *vb;
>  	unsigned int i;
> 
>  	/*
> @@ -1188,13 +1189,18 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
>  	q->streaming = 0;
> 
>  	/*
> -	 * Remove all buffers from videobuf's list...
> +	 * Remove all buffers from videobuf's list...  Give the driver
> +	 * a chance to clean them up first, though.
>  	 */
> +	list_for_each_entry(vb, &q->queued_list, queued_entry)
> +		call_qop(q, buf_finish, vb);
>  	INIT_LIST_HEAD(&q->queued_list);
>  	/*
>  	 * ...and done list; userspace will not receive any buffers it
>  	 * has not already dequeued before initiating cancel.
>  	 */
> +	list_for_each_entry(vb, &q->done_list, done_entry)
> +		call_qop(q, buf_finish, vb);
>  	INIT_LIST_HEAD(&q->done_list);
>  	wake_up_all(&q->done_wq);
> 
> --
> 1.7.6

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center



  reply	other threads:[~2011-07-15  6:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 21:09 [PATCH] videobuf2: call buf_finish() on unprocessed buffers Jonathan Corbet
2011-07-15  6:17 ` Marek Szyprowski [this message]
2011-07-24 22:10 ` Pawel Osciak
2011-09-03 13:55   ` 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='000101cc42b6$d7582160$86086420$%szyprowski@samsung.com' \
    --to=m.szyprowski@samsung.com \
    --cc=corbet@lwn.net \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.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).