aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-10 01:51:31 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 08:13:43 -0400
commit8ab75e3ecd8f232d9564510f0c601a6aa7a149ea (patch)
treed0a0a2e1b8fa4cef8234c09582c622a3e1aa1d42 /include/media
parentccfc97bdb5ae8b8edc55169ac6924e08449836ac (diff)
[media] v4l2-dev: make it possible to skip locking for selected ioctls
Using the V4L2 core lock is a very robust method that is usually very good at doing the right thing. But some drivers, particularly USB drivers, may want to prevent the core from taking the lock for specific ioctls, particularly buffer queuing ioctls. The reason is that certain commands like S_CTRL can take a long time to process over USB and all the time the core has the lock, preventing VIDIOC_DQBUF from proceeding, even though a frame may be ready in the queue. This introduces unwanted latency. Since the buffer queuing commands often have their own internal lock it is often not necessary to take the core lock. Drivers can now say that they don't want the core to take the lock for specific ioctls. As it is a specific opt-out it makes it clear to the reviewer that those ioctls will need more care when reviewing. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-dev.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 96d22215cc88..d00b9d3511f2 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -128,6 +128,7 @@ struct video_device
128 const struct v4l2_ioctl_ops *ioctl_ops; 128 const struct v4l2_ioctl_ops *ioctl_ops;
129 129
130 /* serialization lock */ 130 /* serialization lock */
131 DECLARE_BITMAP(dont_use_lock, BASE_VIDIOC_PRIVATE);
131 struct mutex *lock; 132 struct mutex *lock;
132}; 133};
133 134
@@ -173,6 +174,16 @@ void video_device_release(struct video_device *vdev);
173 a dubious construction at best. */ 174 a dubious construction at best. */
174void video_device_release_empty(struct video_device *vdev); 175void video_device_release_empty(struct video_device *vdev);
175 176
177/* returns true if cmd is a known V4L2 ioctl */
178bool v4l2_is_known_ioctl(unsigned int cmd);
179
180/* mark that this command shouldn't use core locking */
181static inline void v4l2_dont_use_lock(struct video_device *vdev, unsigned int cmd)
182{
183 if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
184 set_bit(_IOC_NR(cmd), vdev->dont_use_lock);
185}
186
176/* helper functions to access driver private data. */ 187/* helper functions to access driver private data. */
177static inline void *video_get_drvdata(struct video_device *vdev) 188static inline void *video_get_drvdata(struct video_device *vdev)
178{ 189{