xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-priority.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_G_PRIORITY:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun******************************************
7*4882a593Smuzhiyunioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY
8*4882a593Smuzhiyun******************************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_PRIORITY - VIDIOC_S_PRIORITY - Query or request the access priority associated with a file descriptor
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_PRIORITY
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_PRIORITY, enum v4l2_priority *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_PRIORITY
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_PRIORITY, const enum v4l2_priority *argp)``
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunArguments
27*4882a593Smuzhiyun=========
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun``fd``
30*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun``argp``
33*4882a593Smuzhiyun    Pointer to an enum :c:type:`v4l2_priority` type.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunDescription
36*4882a593Smuzhiyun===========
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunTo query the current access priority applications call the
39*4882a593Smuzhiyun:ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` ioctl with a pointer to an enum v4l2_priority
40*4882a593Smuzhiyunvariable where the driver stores the current priority.
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunTo request an access priority applications store the desired priority in
43*4882a593Smuzhiyunan enum v4l2_priority variable and call :ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctl
44*4882a593Smuzhiyunwith a pointer to this variable.
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun.. c:type:: v4l2_priority
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun.. flat-table:: enum v4l2_priority
51*4882a593Smuzhiyun    :header-rows:  0
52*4882a593Smuzhiyun    :stub-columns: 0
53*4882a593Smuzhiyun    :widths:       3 1 4
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun    * - ``V4L2_PRIORITY_UNSET``
56*4882a593Smuzhiyun      - 0
57*4882a593Smuzhiyun      -
58*4882a593Smuzhiyun    * - ``V4L2_PRIORITY_BACKGROUND``
59*4882a593Smuzhiyun      - 1
60*4882a593Smuzhiyun      - Lowest priority, usually applications running in background, for
61*4882a593Smuzhiyun	example monitoring VBI transmissions. A proxy application running
62*4882a593Smuzhiyun	in user space will be necessary if multiple applications want to
63*4882a593Smuzhiyun	read from a device at this priority.
64*4882a593Smuzhiyun    * - ``V4L2_PRIORITY_INTERACTIVE``
65*4882a593Smuzhiyun      - 2
66*4882a593Smuzhiyun      -
67*4882a593Smuzhiyun    * - ``V4L2_PRIORITY_DEFAULT``
68*4882a593Smuzhiyun      - 2
69*4882a593Smuzhiyun      - Medium priority, usually applications started and interactively
70*4882a593Smuzhiyun	controlled by the user. For example TV viewers, Teletext browsers,
71*4882a593Smuzhiyun	or just "panel" applications to change the channel or video
72*4882a593Smuzhiyun	controls. This is the default priority unless an application
73*4882a593Smuzhiyun	requests another.
74*4882a593Smuzhiyun    * - ``V4L2_PRIORITY_RECORD``
75*4882a593Smuzhiyun      - 3
76*4882a593Smuzhiyun      - Highest priority. Only one file descriptor can have this priority,
77*4882a593Smuzhiyun	it blocks any other fd from changing device properties. Usually
78*4882a593Smuzhiyun	applications which must not be interrupted, like video recording.
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunReturn Value
81*4882a593Smuzhiyun============
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
84*4882a593Smuzhiyunappropriately. The generic error codes are described at the
85*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunEINVAL
88*4882a593Smuzhiyun    The requested priority value is invalid.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunEBUSY
91*4882a593Smuzhiyun    Another application already requested higher priority.
92