Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / Documentation / DocBook / media / v4l / vidioc-subdev-g-selection.xml
1 <refentry id="vidioc-subdev-g-selection">
2   <refmeta>
3     <refentrytitle>ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</refentrytitle>
4     &manvol;
5   </refmeta>
6
7   <refnamediv>
8     <refname>VIDIOC_SUBDEV_G_SELECTION</refname>
9     <refname>VIDIOC_SUBDEV_S_SELECTION</refname>
10     <refpurpose>Get or set selection rectangles on a subdev pad</refpurpose>
11   </refnamediv>
12
13   <refsynopsisdiv>
14     <funcsynopsis>
15       <funcprototype>
16         <funcdef>int <function>ioctl</function></funcdef>
17         <paramdef>int <parameter>fd</parameter></paramdef>
18         <paramdef>int <parameter>request</parameter></paramdef>
19         <paramdef>struct v4l2_subdev_selection *<parameter>argp</parameter></paramdef>
20       </funcprototype>
21     </funcsynopsis>
22   </refsynopsisdiv>
23
24   <refsect1>
25     <title>Arguments</title>
26
27     <variablelist>
28       <varlistentry>
29         <term><parameter>fd</parameter></term>
30         <listitem>
31           <para>&fd;</para>
32         </listitem>
33       </varlistentry>
34       <varlistentry>
35         <term><parameter>request</parameter></term>
36         <listitem>
37           <para>VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</para>
38         </listitem>
39       </varlistentry>
40       <varlistentry>
41         <term><parameter>argp</parameter></term>
42         <listitem>
43           <para></para>
44         </listitem>
45       </varlistentry>
46     </variablelist>
47   </refsect1>
48
49   <refsect1>
50     <title>Description</title>
51
52     <note>
53       <title>Experimental</title>
54       <para>This is an <link linkend="experimental">experimental</link>
55       interface and may change in the future.</para>
56     </note>
57
58     <para>The selections are used to configure various image
59     processing functionality performed by the subdevs which affect the
60     image size. This currently includes cropping, scaling and
61     composition.</para>
62
63     <para>The selection API replaces <link
64     linkend="vidioc-subdev-g-crop">the old subdev crop API</link>. All
65     the function of the crop API, and more, are supported by the
66     selections API.</para>
67
68     <para>See <xref linkend="subdev"></xref> for
69     more information on how each selection target affects the image
70     processing pipeline inside the subdevice.</para>
71
72     <refsect2>
73       <title>Types of selection targets</title>
74
75       <para>There are two types of selection targets: actual and bounds. The
76       actual targets are the targets which configure the hardware. The BOUNDS
77       target will return a rectangle that contain all possible actual
78       rectangles.</para>
79     </refsect2>
80
81     <refsect2>
82       <title>Discovering supported features</title>
83
84       <para>To discover which targets are supported, the user can
85       perform <constant>VIDIOC_SUBDEV_G_SELECTION</constant> on them.
86       Any unsupported target will return
87       <constant>EINVAL</constant>.</para>
88
89     <para>Selection targets and flags are documented in <xref
90     linkend="v4l2-selections-common"/>.</para>
91
92     <table pgwide="1" frame="none" id="v4l2-subdev-selection">
93       <title>struct <structname>v4l2_subdev_selection</structname></title>
94       <tgroup cols="3">
95         &cs-str;
96         <tbody valign="top">
97           <row>
98             <entry>__u32</entry>
99             <entry><structfield>which</structfield></entry>
100             <entry>Active or try selection, from
101             &v4l2-subdev-format-whence;.</entry>
102           </row>
103           <row>
104             <entry>__u32</entry>
105             <entry><structfield>pad</structfield></entry>
106             <entry>Pad number as reported by the media framework.</entry>
107           </row>
108           <row>
109             <entry>__u32</entry>
110             <entry><structfield>target</structfield></entry>
111             <entry>Target selection rectangle. See
112             <xref linkend="v4l2-selections-common" />.</entry>
113           </row>
114           <row>
115             <entry>__u32</entry>
116             <entry><structfield>flags</structfield></entry>
117             <entry>Flags. See
118             <xref linkend="v4l2-selection-flags" />.</entry>
119           </row>
120           <row>
121             <entry>&v4l2-rect;</entry>
122             <entry><structfield>r</structfield></entry>
123             <entry>Selection rectangle, in pixels.</entry>
124           </row>
125           <row>
126             <entry>__u32</entry>
127             <entry><structfield>reserved</structfield>[8]</entry>
128             <entry>Reserved for future extensions. Applications and drivers must
129             set the array to zero.</entry>
130           </row>
131         </tbody>
132       </tgroup>
133     </table>
134     </refsect2>
135
136   </refsect1>
137
138   <refsect1>
139     &return-value;
140
141     <variablelist>
142       <varlistentry>
143         <term><errorcode>EBUSY</errorcode></term>
144         <listitem>
145           <para>The selection rectangle can't be changed because the
146           pad is currently busy. This can be caused, for instance, by
147           an active video stream on the pad. The ioctl must not be
148           retried without performing another action to fix the problem
149           first. Only returned by
150           <constant>VIDIOC_SUBDEV_S_SELECTION</constant></para>
151         </listitem>
152       </varlistentry>
153       <varlistentry>
154         <term><errorcode>EINVAL</errorcode></term>
155         <listitem>
156           <para>The &v4l2-subdev-selection;
157           <structfield>pad</structfield> references a non-existing
158           pad, the <structfield>which</structfield> field references a
159           non-existing format, or the selection target is not
160           supported on the given subdev pad.</para>
161         </listitem>
162       </varlistentry>
163     </variablelist>
164   </refsect1>
165 </refentry>