Skip to content

Commit

Permalink
[media] v4l2: vb2: fix queue reallocation and REQBUFS(0) case
Browse files Browse the repository at this point in the history
This patch fixes 2 minor bugs in videobuf2 core:
1. Queue should be reallocated if one change the memory access
method without changing the number of buffers.
2. In case of REQBUFS(0), the request should not be passed to the
driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Marek Szyprowski authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent bd08a0c commit 29e3fbd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/media/video/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
return -EINVAL;
}

if (req->count == 0 || q->num_buffers != 0) {
if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
/*
* We already have buffers allocated, so first check if they
* are not in use and can be freed.
Expand All @@ -501,6 +501,13 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
ret = __vb2_queue_free(q);
if (ret != 0)
return ret;

/*
* In case of REQBUFS(0) return immediately without calling
* driver's queue_setup() callback and allocating resources.
*/
if (req->count == 0)
return 0;
}

/*
Expand Down

0 comments on commit 29e3fbd

Please sign in to comment.