diff mbox

[RFC,1/2] media: vb2: return for polling if a buffer is available

Message ID 1364798447-32224-2-git-send-email-sw0312.kim@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Seung-Woo Kim April 1, 2013, 6:40 a.m. UTC
The vb2_poll() does not need to wait next vb_buffer_done() if there is already
a buffer in done_list of queue, but current vb2_poll() always waits.
So done_list is checked before calling poll_wait().

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 drivers/media/v4l2-core/videobuf2-core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Marek Szyprowski April 11, 2013, 11:15 a.m. UTC | #1
Hello,

On 4/1/2013 8:40 AM, Seung-Woo Kim wrote:
> The vb2_poll() does not need to wait next vb_buffer_done() if there is already
> a buffer in done_list of queue, but current vb2_poll() always waits.
> So done_list is checked before calling poll_wait().
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>

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

> ---
>   drivers/media/v4l2-core/videobuf2-core.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index db1235d..e941d2b 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1996,7 +1996,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
>   	if (list_empty(&q->queued_list))
>   		return res | POLLERR;
>   
> -	poll_wait(file, &q->done_wq, wait);
> +	if (list_empty(&q->done_list))
> +		poll_wait(file, &q->done_wq, wait);
>   
>   	/*
>   	 * Take first buffer available for dequeuing.

Best regards
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index db1235d..e941d2b 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1996,7 +1996,8 @@  unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
 	if (list_empty(&q->queued_list))
 		return res | POLLERR;
 
-	poll_wait(file, &q->done_wq, wait);
+	if (list_empty(&q->done_list))
+		poll_wait(file, &q->done_wq, wait);
 
 	/*
 	 * Take first buffer available for dequeuing.