diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-03-10 10:58:27 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 10:31:45 -0300 |
commit | a773632c1f9096f76d4b5a112d8e5a7183097aa6 (patch) | |
tree | f98afbcd1f5a8ab8ed96c5c96be3f62b584c0a7f | |
parent | 782f36ca697034b43177b0d7e05d691f6bce120f (diff) | |
download | linux-a773632c1f9096f76d4b5a112d8e5a7183097aa6.tar.bz2 |
[media] mem2mem_testdev: return pending buffers in stop_streaming()
To keep the vb2 buffer administration in balance stop_streaming() must
return any pending buffers to the vb2 framework.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/platform/mem2mem_testdev.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/media/platform/mem2mem_testdev.c b/drivers/media/platform/mem2mem_testdev.c index 8e2aed27bf64..1ba1a839d5c1 100644 --- a/drivers/media/platform/mem2mem_testdev.c +++ b/drivers/media/platform/mem2mem_testdev.c @@ -768,10 +768,31 @@ static void m2mtest_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); } +static int m2mtest_stop_streaming(struct vb2_queue *q) +{ + struct m2mtest_ctx *ctx = vb2_get_drv_priv(q); + struct vb2_buffer *vb; + unsigned long flags; + + for (;;) { + if (V4L2_TYPE_IS_OUTPUT(q->type)) + vb = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + else + vb = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + if (vb == NULL) + return 0; + spin_lock_irqsave(&ctx->dev->irqlock, flags); + v4l2_m2m_buf_done(vb, VB2_BUF_STATE_ERROR); + spin_unlock_irqrestore(&ctx->dev->irqlock, flags); + } + return 0; +} + static struct vb2_ops m2mtest_qops = { .queue_setup = m2mtest_queue_setup, .buf_prepare = m2mtest_buf_prepare, .buf_queue = m2mtest_buf_queue, + .stop_streaming = m2mtest_stop_streaming, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, }; |