aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-03-09 12:03:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 03:54:23 -0400
commit29e3fbd8edb31549fa8302c185bd0b915a43d8b8 (patch)
tree0508c284a20cbfd5b35a83acab634f5693ee56db /drivers/media/video
parentbd08a0cd5f546916a9454ae2c35756ed77957458 (diff)
[media] v4l2: vb2: fix queue reallocation and REQBUFS(0) case
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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/videobuf2-core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index cc7ab0a17b6..c5f99c7d397 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -488,7 +488,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
488 return -EINVAL; 488 return -EINVAL;
489 } 489 }
490 490
491 if (req->count == 0 || q->num_buffers != 0) { 491 if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
492 /* 492 /*
493 * We already have buffers allocated, so first check if they 493 * We already have buffers allocated, so first check if they
494 * are not in use and can be freed. 494 * are not in use and can be freed.
@@ -501,6 +501,13 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
501 ret = __vb2_queue_free(q); 501 ret = __vb2_queue_free(q);
502 if (ret != 0) 502 if (ret != 0)
503 return ret; 503 return ret;
504
505 /*
506 * In case of REQBUFS(0) return immediately without calling
507 * driver's queue_setup() callback and allocating resources.
508 */
509 if (req->count == 0)
510 return 0;
504 } 511 }
505 512
506 /* 513 /*