diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-06-14 09:37:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-25 14:12:12 -0500 |
commit | 3e0c2f2046665bf580273b69ab18d9c76a550e34 (patch) | |
tree | 9d47682a1c7ab8ea7afef9d6282361906ed23da5 /drivers/media/v4l2-core | |
parent | e15dab752d4c588544ccabdbe020a7cc092e23c8 (diff) |
[media] v4l: vb2: add prepare/finish callbacks to allocators
This patch adds support for prepare/finish callbacks in VB2 allocators. These
callback are used for buffer flushing.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index a51dad6bd394..613dea16a304 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -844,6 +844,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
844 | { | 844 | { |
845 | struct vb2_queue *q = vb->vb2_queue; | 845 | struct vb2_queue *q = vb->vb2_queue; |
846 | unsigned long flags; | 846 | unsigned long flags; |
847 | unsigned int plane; | ||
847 | 848 | ||
848 | if (vb->state != VB2_BUF_STATE_ACTIVE) | 849 | if (vb->state != VB2_BUF_STATE_ACTIVE) |
849 | return; | 850 | return; |
@@ -854,6 +855,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
854 | dprintk(4, "Done processing on buffer %d, state: %d\n", | 855 | dprintk(4, "Done processing on buffer %d, state: %d\n", |
855 | vb->v4l2_buf.index, vb->state); | 856 | vb->v4l2_buf.index, vb->state); |
856 | 857 | ||
858 | /* sync buffers */ | ||
859 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
860 | call_memop(q, finish, vb->planes[plane].mem_priv); | ||
861 | |||
857 | /* Add the buffer to the done buffers list */ | 862 | /* Add the buffer to the done buffers list */ |
858 | spin_lock_irqsave(&q->done_lock, flags); | 863 | spin_lock_irqsave(&q->done_lock, flags); |
859 | vb->state = state; | 864 | vb->state = state; |
@@ -1136,9 +1141,15 @@ err: | |||
1136 | static void __enqueue_in_driver(struct vb2_buffer *vb) | 1141 | static void __enqueue_in_driver(struct vb2_buffer *vb) |
1137 | { | 1142 | { |
1138 | struct vb2_queue *q = vb->vb2_queue; | 1143 | struct vb2_queue *q = vb->vb2_queue; |
1144 | unsigned int plane; | ||
1139 | 1145 | ||
1140 | vb->state = VB2_BUF_STATE_ACTIVE; | 1146 | vb->state = VB2_BUF_STATE_ACTIVE; |
1141 | atomic_inc(&q->queued_count); | 1147 | atomic_inc(&q->queued_count); |
1148 | |||
1149 | /* sync buffers */ | ||
1150 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
1151 | call_memop(q, prepare, vb->planes[plane].mem_priv); | ||
1152 | |||
1142 | q->ops->buf_queue(vb); | 1153 | q->ops->buf_queue(vb); |
1143 | } | 1154 | } |
1144 | 1155 | ||