1 <refentry id="vidioc-subdev-g-selection">
3 <refentrytitle>ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</refentrytitle>
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>
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>
25 <title>Arguments</title>
29 <term><parameter>fd</parameter></term>
35 <term><parameter>request</parameter></term>
37 <para>VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</para>
41 <term><parameter>argp</parameter></term>
50 <title>Description</title>
53 <title>Experimental</title>
54 <para>This is an <link linkend="experimental">experimental</link>
55 interface and may change in the future.</para>
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
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>
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>
73 <title>Types of selection targets</title>
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
82 <title>Discovering supported features</title>
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>
89 <para>Selection targets and flags are documented in <xref
90 linkend="v4l2-selections-common"/>.</para>
92 <table pgwide="1" frame="none" id="v4l2-subdev-selection">
93 <title>struct <structname>v4l2_subdev_selection</structname></title>
99 <entry><structfield>which</structfield></entry>
100 <entry>Active or try selection, from
101 &v4l2-subdev-format-whence;.</entry>
105 <entry><structfield>pad</structfield></entry>
106 <entry>Pad number as reported by the media framework.</entry>
110 <entry><structfield>target</structfield></entry>
111 <entry>Target selection rectangle. See
112 <xref linkend="v4l2-selections-common" />.</entry>
116 <entry><structfield>flags</structfield></entry>
118 <xref linkend="v4l2-selection-flags" />.</entry>
121 <entry>&v4l2-rect;</entry>
122 <entry><structfield>r</structfield></entry>
123 <entry>Selection rectangle, in pixels.</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>
143 <term><errorcode>EBUSY</errorcode></term>
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>
154 <term><errorcode>EINVAL</errorcode></term>
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>