diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-12-13 13:13:38 -0300 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:52:50 +0900 |
commit | 9be777da0b67ce79b0b8052ffbd80073d4dda7e2 (patch) | |
tree | 982d33acb05102d796bcbb248a305344726a51e8 /include/media | |
parent | 8dbd29b2ea9fc79988744c091013ea196eea2f53 (diff) | |
download | linux-3.10-9be777da0b67ce79b0b8052ffbd80073d4dda7e2.tar.gz linux-3.10-9be777da0b67ce79b0b8052ffbd80073d4dda7e2.tar.bz2 linux-3.10-9be777da0b67ce79b0b8052ffbd80073d4dda7e2.zip |
upstream: [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/media')
-rw-r--r-- | include/media/videobuf2-core.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index e367de0aa4d..1a604007b26 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -142,6 +142,7 @@ enum vb2_fileio_flags { /** * enum vb2_buffer_state - current video buffer state * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control + * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used @@ -154,6 +155,7 @@ enum vb2_fileio_flags { */ enum vb2_buffer_state { VB2_BUF_STATE_DEQUEUED, + VB2_BUF_STATE_PREPARING, VB2_BUF_STATE_PREPARED, VB2_BUF_STATE_QUEUED, VB2_BUF_STATE_ACTIVE, |