aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-12-13 11:13:38 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 04:00:04 -0500
commitb18a8ff29d80b132018d33479e86ab8ecaee6b46 (patch)
treef8bc0cec256e75717d36952b278181f887252041 /include
parentb4fcdaf7654f9506f80d4e3f2b045a78333d62dc (diff)
[media] vb2: push the mmap semaphore down to __buf_prepare()
Rather than taking the mmap semaphore at a relatively high-level function, push it down to the place where it is really needed. It was placed in vb2_queue_or_prepare_buf() to prevent racing with other vb2 calls. The only way I can see that a race can happen is when two threads queue the same buffer. The solution for that it to introduce a PREPARING state. Moving it down offers opportunities to simplify the code. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/videobuf2-core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 0ae974ee8894..ea766525a268 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -142,6 +142,7 @@ enum vb2_fileio_flags {
142/** 142/**
143 * enum vb2_buffer_state - current video buffer state 143 * enum vb2_buffer_state - current video buffer state
144 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control 144 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control
145 * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf
145 * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver 146 * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver
146 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver 147 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver
147 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used 148 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used
@@ -154,6 +155,7 @@ enum vb2_fileio_flags {
154 */ 155 */
155enum vb2_buffer_state { 156enum vb2_buffer_state {
156 VB2_BUF_STATE_DEQUEUED, 157 VB2_BUF_STATE_DEQUEUED,
158 VB2_BUF_STATE_PREPARING,
157 VB2_BUF_STATE_PREPARED, 159 VB2_BUF_STATE_PREPARED,
158 VB2_BUF_STATE_QUEUED, 160 VB2_BUF_STATE_QUEUED,
159 VB2_BUF_STATE_ACTIVE, 161 VB2_BUF_STATE_ACTIVE,