[RAMEN9610-12270] media: videobuf2-core: don't call memop 'finish' when queueing
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 21 May 2018 12:43:02 +0000 (08:43 -0400)
committerhskang <hs1218.kang@samsung.com>
Wed, 20 Feb 2019 01:00:32 +0000 (10:00 +0900)
[ Upstream commit 90b2da89a083e1395cb322521a42397c49ae4500 ]

When a buffer is queued or requeued in vb2_buffer_done, then don't
call the finish memop. In this case the buffer is only returned to vb2,
not to userspace.

Calling 'finish' here will cause an unbalance when the queue is
canceled, since the core will call the same memop again.

Change-Id: I64c1727150b2ffc37b41324cde0c8d92fedab228
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/videobuf2-core.c

index b502ff7e33eaeab9682b16fcb183d69beb8e622d..9d3c358b63e261411b80abef48664849820e9d9f 100644 (file)
@@ -909,9 +909,12 @@ static void vb2_process_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state
        dprintk(4, "done processing on buffer %d, state: %d\n",
                        vb->index, state);
 
-       /* sync buffers */
-       for (plane = 0; plane < vb->num_planes; ++plane)
-               call_void_memop(vb, finish, vb->planes[plane].mem_priv);
+       if (state != VB2_BUF_STATE_QUEUED &&
+           state != VB2_BUF_STATE_REQUEUEING) {
+               /* sync buffers */
+               for (plane = 0; plane < vb->num_planes; ++plane)
+                       call_void_memop(vb, finish, vb->planes[plane].mem_priv);
+       }
 
        spin_lock_irqsave(&q->done_lock, flags);
        if (vb->state == VB2_BUF_STATE_ACTIVE)