diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2014-03-22 07:03:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-04-15 08:50:56 -0400 |
commit | b699f09d0d003cc1622aec30d81f3158da6790aa (patch) | |
tree | 1e329004353359e1e7bc9fb4b66603cd1db8e36e /drivers/media | |
parent | 18c7adcf2c1abf7f554a52f57bee126995791748 (diff) |
[media] media: davinci: vpbe_display: fix releasing of active buffers
from commit-id: b3379c6201bb3555298cdbf0aa004af260f2a6a4
"vb2: only call start_streaming if sufficient buffers are queued"
the vb2 framework warns on (WARN_ON()) if all the active buffers
are not released when streaming is stopped, initially the vb2 silently
released the buffer internally if the buffer was not released by
the driver.
This patch fixes following issue:
WARNING: CPU: 0 PID: 2049 at drivers/media/v4l2-core/videobuf2-core.c:2011 __vb2_queue_cancel+0x1a0/0x218()
Modules linked in:
CPU: 0 PID: 2049 Comm: vpbe_display Tainted: G W 3.14.0-rc5-00414-ged97a6f #89
[<c000e3f0>] (unwind_backtrace) from [<c000c618>] (show_stack+0x10/0x14)
[<c000c618>] (show_stack) from [<c001adb0>] (warn_slowpath_common+0x68/0x88)
[<c001adb0>] (warn_slowpath_common) from [<c001adec>] (warn_slowpath_null+0x1c/0x24)
[<c001adec>] (warn_slowpath_null) from [<c0252e0c>] (__vb2_queue_cancel+0x1a0/0x218)
[<c0252e0c>] (__vb2_queue_cancel) from [<c02533a4>] (vb2_queue_release+0x14/0x24)
[<c02533a4>] (vb2_queue_release) from [<c025a65c>] (vpbe_display_release+0x60/0x230)
[<c025a65c>] (vpbe_display_release) from [<c023fe5c>] (v4l2_release+0x34/0x74)
[<c023fe5c>] (v4l2_release) from [<c00b4a00>] (__fput+0x80/0x224)
[<c00b4a00>] (__fput) from [<c00341e8>] (task_work_run+0xa0/0xd0)
[<c00341e8>] (task_work_run) from [<c001cc28>] (do_exit+0x244/0x918)
[<c001cc28>] (do_exit) from [<c001d344>] (do_group_exit+0x48/0xdc)
[<c001d344>] (do_group_exit) from [<c0029894>] (get_signal_to_deliver+0x2a0/0x5bc)
[<c0029894>] (get_signal_to_deliver) from [<c000b888>] (do_signal+0x78/0x3a0)
[<c000b888>] (do_signal) from [<c000bc54>] (do_work_pending+0xa4/0xb4)
[<c000bc54>] (do_work_pending) from [<c00096dc>] (work_pending+0xc/0x20)
---[ end trace 5faa75e8c2f8a6a1 ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 2049 at drivers/media/v4l2-core/videobuf2-core.c:1095 vb2_buffer_done+0x1e0/0x224()
Modules linked in:
CPU: 0 PID: 2049 Comm: vpbe_display Tainted: G W 3.14.0-rc5-00414-ged97a6f #89
[<c000e3f0>] (unwind_backtrace) from [<c000c618>] (show_stack+0x10/0x14)
[<c000c618>] (show_stack) from [<c001adb0>] (warn_slowpath_common+0x68/0x88)
[<c001adb0>] (warn_slowpath_common) from [<c001adec>] (warn_slowpath_null+0x1c/0x24)
[<c001adec>] (warn_slowpath_null) from [<c0252c28>] (vb2_buffer_done+0x1e0/0x224)
[<c0252c28>] (vb2_buffer_done) from [<c0252e3c>] (__vb2_queue_cancel+0x1d0/0x218)
[<c0252e3c>] (__vb2_queue_cancel) from [<c02533a4>] (vb2_queue_release+0x14/0x24)
[<c02533a4>] (vb2_queue_release) from [<c025a65c>] (vpbe_display_release+0x60/0x230)
[<c025a65c>] (vpbe_display_release) from [<c023fe5c>] (v4l2_release+0x34/0x74)
[<c023fe5c>] (v4l2_release) from [<c00b4a00>] (__fput+0x80/0x224)
[<c00b4a00>] (__fput) from [<c00341e8>] (task_work_run+0xa0/0xd0)
[<c00341e8>] (task_work_run) from [<c001cc28>] (do_exit+0x244/0x918)
[<c001cc28>] (do_exit) from [<c001d344>] (do_group_exit+0x48/0xdc)
[<c001d344>] (do_group_exit) from [<c0029894>] (get_signal_to_deliver+0x2a0/0x5bc)
[<c0029894>] (get_signal_to_deliver) from [<c000b888>] (do_signal+0x78/0x3a0)
[<c000b888>] (do_signal) from [<c000bc54>] (do_work_pending+0xa4/0xb4)
[<c000bc54>] (do_work_pending) from [<c00096dc>] (work_pending+0xc/0x20)
---[ end trace 5faa75e8c2f8a6a2 ]---
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/davinci/vpbe_display.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index b4f12d00be05..656708252962 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -372,18 +372,32 @@ static int vpbe_stop_streaming(struct vb2_queue *vq) | |||
372 | { | 372 | { |
373 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); | 373 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); |
374 | struct vpbe_layer *layer = fh->layer; | 374 | struct vpbe_layer *layer = fh->layer; |
375 | struct vpbe_display *disp = fh->disp_dev; | ||
376 | unsigned long flags; | ||
375 | 377 | ||
376 | if (!vb2_is_streaming(vq)) | 378 | if (!vb2_is_streaming(vq)) |
377 | return 0; | 379 | return 0; |
378 | 380 | ||
379 | /* release all active buffers */ | 381 | /* release all active buffers */ |
382 | spin_lock_irqsave(&disp->dma_queue_lock, flags); | ||
383 | if (layer->cur_frm == layer->next_frm) { | ||
384 | vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_ERROR); | ||
385 | } else { | ||
386 | if (layer->cur_frm != NULL) | ||
387 | vb2_buffer_done(&layer->cur_frm->vb, | ||
388 | VB2_BUF_STATE_ERROR); | ||
389 | if (layer->next_frm != NULL) | ||
390 | vb2_buffer_done(&layer->next_frm->vb, | ||
391 | VB2_BUF_STATE_ERROR); | ||
392 | } | ||
393 | |||
380 | while (!list_empty(&layer->dma_queue)) { | 394 | while (!list_empty(&layer->dma_queue)) { |
381 | layer->next_frm = list_entry(layer->dma_queue.next, | 395 | layer->next_frm = list_entry(layer->dma_queue.next, |
382 | struct vpbe_disp_buffer, list); | 396 | struct vpbe_disp_buffer, list); |
383 | list_del(&layer->next_frm->list); | 397 | list_del(&layer->next_frm->list); |
384 | vb2_buffer_done(&layer->next_frm->vb, VB2_BUF_STATE_ERROR); | 398 | vb2_buffer_done(&layer->next_frm->vb, VB2_BUF_STATE_ERROR); |
385 | } | 399 | } |
386 | 400 | spin_unlock_irqrestore(&disp->dma_queue_lock, flags); | |
387 | return 0; | 401 | return 0; |
388 | } | 402 | } |
389 | 403 | ||