mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 10:49:28 +00:00
[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>
This commit is contained in:
parent
ccfc97bdb5
commit
8ab75e3ecd
4 changed files with 146 additions and 91 deletions
|
@ -128,6 +128,7 @@ struct video_device
|
|||
const struct v4l2_ioctl_ops *ioctl_ops;
|
||||
|
||||
/* serialization lock */
|
||||
DECLARE_BITMAP(dont_use_lock, BASE_VIDIOC_PRIVATE);
|
||||
struct mutex *lock;
|
||||
};
|
||||
|
||||
|
@ -173,6 +174,16 @@ void video_device_release(struct video_device *vdev);
|
|||
a dubious construction at best. */
|
||||
void video_device_release_empty(struct video_device *vdev);
|
||||
|
||||
/* returns true if cmd is a known V4L2 ioctl */
|
||||
bool v4l2_is_known_ioctl(unsigned int cmd);
|
||||
|
||||
/* mark that this command shouldn't use core locking */
|
||||
static inline void v4l2_dont_use_lock(struct video_device *vdev, unsigned int cmd)
|
||||
{
|
||||
if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
|
||||
set_bit(_IOC_NR(cmd), vdev->dont_use_lock);
|
||||
}
|
||||
|
||||
/* helper functions to access driver private data. */
|
||||
static inline void *video_get_drvdata(struct video_device *vdev)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue