[media] v4l: Common documentation for selection targets
[deliverable/linux.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 <section>
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 </section>
80
81 <section>
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 </section>
89
90 <para>Selection targets are documented in <xref
91 linkend="v4l2-selections-common"/>.</para>
92
93 <table pgwide="1" frame="none" id="v4l2-subdev-selection-flags">
94 <title>V4L2 subdev selection flags</title>
95 <tgroup cols="3">
96 &cs-def;
97 <tbody valign="top">
98 <row>
99 <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_GE</constant></entry>
100 <entry>(1 &lt;&lt; 0)</entry> <entry>Suggest the driver it
101 should choose greater or equal rectangle (in size) than
102 was requested. Albeit the driver may choose a lesser size,
103 it will only do so due to hardware limitations. Without
104 this flag (and
105 <constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant>) the
106 behaviour is to choose the closest possible
107 rectangle.</entry>
108 </row>
109 <row>
110 <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant></entry>
111 <entry>(1 &lt;&lt; 1)</entry> <entry>Suggest the driver it
112 should choose lesser or equal rectangle (in size) than was
113 requested. Albeit the driver may choose a greater size, it
114 will only do so due to hardware limitations.</entry>
115 </row>
116 <row>
117 <entry><constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant></entry>
118 <entry>(1 &lt;&lt; 2)</entry>
119 <entry>The configuration should not be propagated to any
120 further processing steps. If this flag is not given, the
121 configuration is propagated inside the subdevice to all
122 further processing steps.</entry>
123 </row>
124 </tbody>
125 </tgroup>
126 </table>
127
128 <table pgwide="1" frame="none" id="v4l2-subdev-selection">
129 <title>struct <structname>v4l2_subdev_selection</structname></title>
130 <tgroup cols="3">
131 &cs-str;
132 <tbody valign="top">
133 <row>
134 <entry>__u32</entry>
135 <entry><structfield>which</structfield></entry>
136 <entry>Active or try selection, from
137 &v4l2-subdev-format-whence;.</entry>
138 </row>
139 <row>
140 <entry>__u32</entry>
141 <entry><structfield>pad</structfield></entry>
142 <entry>Pad number as reported by the media framework.</entry>
143 </row>
144 <row>
145 <entry>__u32</entry>
146 <entry><structfield>target</structfield></entry>
147 <entry>Target selection rectangle. See
148 <xref linkend="v4l2-selections-common" />.</entry>
149 </row>
150 <row>
151 <entry>__u32</entry>
152 <entry><structfield>flags</structfield></entry>
153 <entry>Flags. See
154 <xref linkend="v4l2-subdev-selection-flags">.</xref></entry>
155 </row>
156 <row>
157 <entry>&v4l2-rect;</entry>
158 <entry><structfield>rect</structfield></entry>
159 <entry>Selection rectangle, in pixels.</entry>
160 </row>
161 <row>
162 <entry>__u32</entry>
163 <entry><structfield>reserved</structfield>[8]</entry>
164 <entry>Reserved for future extensions. Applications and drivers must
165 set the array to zero.</entry>
166 </row>
167 </tbody>
168 </tgroup>
169 </table>
170
171 </refsect1>
172
173 <refsect1>
174 &return-value;
175
176 <variablelist>
177 <varlistentry>
178 <term><errorcode>EBUSY</errorcode></term>
179 <listitem>
180 <para>The selection rectangle can't be changed because the
181 pad is currently busy. This can be caused, for instance, by
182 an active video stream on the pad. The ioctl must not be
183 retried without performing another action to fix the problem
184 first. Only returned by
185 <constant>VIDIOC_SUBDEV_S_SELECTION</constant></para>
186 </listitem>
187 </varlistentry>
188 <varlistentry>
189 <term><errorcode>EINVAL</errorcode></term>
190 <listitem>
191 <para>The &v4l2-subdev-selection;
192 <structfield>pad</structfield> references a non-existing
193 pad, the <structfield>which</structfield> field references a
194 non-existing format, or the selection target is not
195 supported on the given subdev pad.</para>
196 </listitem>
197 </varlistentry>
198 </variablelist>
199 </refsect1>
200 </refentry>
This page took 0.091924 seconds and 5 git commands to generate.