diff options
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 11 | ||||
-rw-r--r-- | include/media/videobuf2-core.h | 7 |
2 files changed, 18 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 | ||
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 689ae4ac2572..24b9c90194f2 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -56,6 +56,10 @@ struct vb2_fileio_data; | |||
56 | * dmabuf | 56 | * dmabuf |
57 | * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified | 57 | * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified |
58 | * that this driver is done using the dmabuf for now | 58 | * that this driver is done using the dmabuf for now |
59 | * @prepare: called every time the buffer is passed from userspace to the | ||
60 | * driver, useful for cache synchronisation, optional | ||
61 | * @finish: called every time the buffer is passed back from the driver | ||
62 | * to the userspace, also optional | ||
59 | * @vaddr: return a kernel virtual address to a given memory buffer | 63 | * @vaddr: return a kernel virtual address to a given memory buffer |
60 | * associated with the passed private structure or NULL if no | 64 | * associated with the passed private structure or NULL if no |
61 | * such mapping exists | 65 | * such mapping exists |
@@ -82,6 +86,9 @@ struct vb2_mem_ops { | |||
82 | unsigned long size, int write); | 86 | unsigned long size, int write); |
83 | void (*put_userptr)(void *buf_priv); | 87 | void (*put_userptr)(void *buf_priv); |
84 | 88 | ||
89 | void (*prepare)(void *buf_priv); | ||
90 | void (*finish)(void *buf_priv); | ||
91 | |||
85 | void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, | 92 | void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, |
86 | unsigned long size, int write); | 93 | unsigned long size, int write); |
87 | void (*detach_dmabuf)(void *buf_priv); | 94 | void (*detach_dmabuf)(void *buf_priv); |