Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / app-pri.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _app-pri:
11
12 ********************
13 Application Priority
14 ********************
15
16 When multiple applications share a device it may be desirable to assign
17 them different priorities. Contrary to the traditional "rm -rf /" school
18 of thought, a video recording application could for example block other
19 applications from changing video controls or switching the current TV
20 channel. Another objective is to permit low priority applications
21 working in background, which can be preempted by user controlled
22 applications and automatically regain control of the device at a later
23 time.
24
25 Since these features cannot be implemented entirely in user space V4L2
26 defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
27 :ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
28 query the access priority associate with a file descriptor. Opening a
29 device assigns a medium priority, compatible with earlier versions of
30 V4L2 and drivers not supporting these ioctls. Applications requiring a
31 different priority will usually call :ref:`VIDIOC_S_PRIORITY
32 <VIDIOC_G_PRIORITY>` after verifying the device with the
33 :ref:`VIDIOC_QUERYCAP` ioctl.
34
35 Ioctls changing driver properties, such as
36 :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
37 after another application obtained higher priority.