diff mbox

Revert "[media] v4l2: vb2: one more fix for REQBUFS()"

Message ID 1307525150-10876-1-git-send-email-m.szyprowski@samsung.com (mailing list archive)
State Accepted
Headers show

Commit Message

Marek Szyprowski June 8, 2011, 9:25 a.m. UTC
This reverts commit 31901a078af29c33c736dcbf815656920e904632.

Queue should be reinitialized on each REQBUFS() call even if the memory
access method and buffer count have not been changed. The user might have
changed the format and if we go the short path introduced in that commit,
the memory buffer will not be reallocated to fit with new format.

The previous patch was just over-engineered optimization, which just
introduced a bug to videobuf2.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
---
 drivers/media/video/videobuf2-core.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

Comments

Uwe Kleine-König June 8, 2011, 8:53 p.m. UTC | #1
Hello Marek,

On Wed, Jun 08, 2011 at 11:25:50AM +0200, Marek Szyprowski wrote:
> This reverts commit 31901a078af29c33c736dcbf815656920e904632.
> 
> Queue should be reinitialized on each REQBUFS() call even if the memory
> access method and buffer count have not been changed. The user might have
> changed the format and if we go the short path introduced in that commit,
> the memory buffer will not be reallocated to fit with new format.
> 
> The previous patch was just over-engineered optimization, which just
> introduced a bug to videobuf2.
> 
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: Pawel Osciak <pawel@osciak.com>
Didn't see your patch before I posted mine. (I only checked my inbox, not
the linux-media folder). So take it as an Ack.

Best regards
Uwe
diff mbox

Patch

diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index 6ba1461..6489aa2 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -492,13 +492,6 @@  int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 		return -EINVAL;
 	}
 
-	/*
-	 * If the same number of buffers and memory access method is requested
-	 * then return immediately.
-	 */
-	if (q->memory == req->memory && req->count == q->num_buffers)
-		return 0;
-
 	if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
 		/*
 		 * We already have buffers allocated, so first check if they