vidioc-subdev-g-selection.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. <refnamediv>
  7. <refname>VIDIOC_SUBDEV_G_SELECTION</refname>
  8. <refname>VIDIOC_SUBDEV_S_SELECTION</refname>
  9. <refpurpose>Get or set selection rectangles on a subdev pad</refpurpose>
  10. </refnamediv>
  11. <refsynopsisdiv>
  12. <funcsynopsis>
  13. <funcprototype>
  14. <funcdef>int <function>ioctl</function></funcdef>
  15. <paramdef>int <parameter>fd</parameter></paramdef>
  16. <paramdef>int <parameter>request</parameter></paramdef>
  17. <paramdef>struct v4l2_subdev_selection *<parameter>argp</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. </refsynopsisdiv>
  21. <refsect1>
  22. <title>Arguments</title>
  23. <variablelist>
  24. <varlistentry>
  25. <term><parameter>fd</parameter></term>
  26. <listitem>
  27. <para>&fd;</para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term><parameter>request</parameter></term>
  32. <listitem>
  33. <para>VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</para>
  34. </listitem>
  35. </varlistentry>
  36. <varlistentry>
  37. <term><parameter>argp</parameter></term>
  38. <listitem>
  39. <para></para>
  40. </listitem>
  41. </varlistentry>
  42. </variablelist>
  43. </refsect1>
  44. <refsect1>
  45. <title>Description</title>
  46. <note>
  47. <title>Experimental</title>
  48. <para>This is an <link linkend="experimental">experimental</link>
  49. interface and may change in the future.</para>
  50. </note>
  51. <para>The selections are used to configure various image
  52. processing functionality performed by the subdevs which affect the
  53. image size. This currently includes cropping, scaling and
  54. composition.</para>
  55. <para>The selection API replaces <link
  56. linkend="vidioc-subdev-g-crop">the old subdev crop API</link>. All
  57. the function of the crop API, and more, are supported by the
  58. selections API.</para>
  59. <para>See <xref linkend="subdev"></xref> for
  60. more information on how each selection target affects the image
  61. processing pipeline inside the subdevice.</para>
  62. <section>
  63. <title>Types of selection targets</title>
  64. <para>There are two types of selection targets: actual and bounds.
  65. The ACTUAL targets are the targets which configure the hardware.
  66. The BOUNDS target will return a rectangle that contain all
  67. possible ACTUAL rectangles.</para>
  68. </section>
  69. <section>
  70. <title>Discovering supported features</title>
  71. <para>To discover which targets are supported, the user can
  72. perform <constant>VIDIOC_SUBDEV_G_SELECTION</constant> on them.
  73. Any unsupported target will return
  74. <constant>EINVAL</constant>.</para>
  75. </section>
  76. <table pgwide="1" frame="none" id="v4l2-subdev-selection-targets">
  77. <title>V4L2 subdev selection targets</title>
  78. <tgroup cols="3">
  79. &cs-def;
  80. <tbody valign="top">
  81. <row>
  82. <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL</constant></entry>
  83. <entry>0x0000</entry>
  84. <entry>Actual crop. Defines the cropping
  85. performed by the processing step.</entry>
  86. </row>
  87. <row>
  88. <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS</constant></entry>
  89. <entry>0x0002</entry>
  90. <entry>Bounds of the crop rectangle.</entry>
  91. </row>
  92. <row>
  93. <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL</constant></entry>
  94. <entry>0x0100</entry>
  95. <entry>Actual compose rectangle. Used to configure scaling
  96. on sink pads and composition on source pads.</entry>
  97. </row>
  98. <row>
  99. <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
  100. <entry>0x0102</entry>
  101. <entry>Bounds of the compose rectangle.</entry>
  102. </row>
  103. </tbody>
  104. </tgroup>
  105. </table>
  106. <table pgwide="1" frame="none" id="v4l2-subdev-selection-flags">
  107. <title>V4L2 subdev selection flags</title>
  108. <tgroup cols="3">
  109. &cs-def;
  110. <tbody valign="top">
  111. <row>
  112. <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_GE</constant></entry>
  113. <entry>(1 &lt;&lt; 0)</entry> <entry>Suggest the driver it
  114. should choose greater or equal rectangle (in size) than
  115. was requested. Albeit the driver may choose a lesser size,
  116. it will only do so due to hardware limitations. Without
  117. this flag (and
  118. <constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant>) the
  119. behaviour is to choose the closest possible
  120. rectangle.</entry>
  121. </row>
  122. <row>
  123. <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant></entry>
  124. <entry>(1 &lt;&lt; 1)</entry> <entry>Suggest the driver it
  125. should choose lesser or equal rectangle (in size) than was
  126. requested. Albeit the driver may choose a greater size, it
  127. will only do so due to hardware limitations.</entry>
  128. </row>
  129. <row>
  130. <entry><constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant></entry>
  131. <entry>(1 &lt;&lt; 2)</entry>
  132. <entry>The configuration should not be propagated to any
  133. further processing steps. If this flag is not given, the
  134. configuration is propagated inside the subdevice to all
  135. further processing steps.</entry>
  136. </row>
  137. </tbody>
  138. </tgroup>
  139. </table>
  140. <table pgwide="1" frame="none" id="v4l2-subdev-selection">
  141. <title>struct <structname>v4l2_subdev_selection</structname></title>
  142. <tgroup cols="3">
  143. &cs-str;
  144. <tbody valign="top">
  145. <row>
  146. <entry>__u32</entry>
  147. <entry><structfield>which</structfield></entry>
  148. <entry>Active or try selection, from
  149. &v4l2-subdev-format-whence;.</entry>
  150. </row>
  151. <row>
  152. <entry>__u32</entry>
  153. <entry><structfield>pad</structfield></entry>
  154. <entry>Pad number as reported by the media framework.</entry>
  155. </row>
  156. <row>
  157. <entry>__u32</entry>
  158. <entry><structfield>target</structfield></entry>
  159. <entry>Target selection rectangle. See
  160. <xref linkend="v4l2-subdev-selection-targets">.</xref>.</entry>
  161. </row>
  162. <row>
  163. <entry>__u32</entry>
  164. <entry><structfield>flags</structfield></entry>
  165. <entry>Flags. See
  166. <xref linkend="v4l2-subdev-selection-flags">.</xref></entry>
  167. </row>
  168. <row>
  169. <entry>&v4l2-rect;</entry>
  170. <entry><structfield>rect</structfield></entry>
  171. <entry>Selection rectangle, in pixels.</entry>
  172. </row>
  173. <row>
  174. <entry>__u32</entry>
  175. <entry><structfield>reserved</structfield>[8]</entry>
  176. <entry>Reserved for future extensions. Applications and drivers must
  177. set the array to zero.</entry>
  178. </row>
  179. </tbody>
  180. </tgroup>
  181. </table>
  182. </refsect1>
  183. <refsect1>
  184. &return-value;
  185. <variablelist>
  186. <varlistentry>
  187. <term><errorcode>EBUSY</errorcode></term>
  188. <listitem>
  189. <para>The selection rectangle can't be changed because the
  190. pad is currently busy. This can be caused, for instance, by
  191. an active video stream on the pad. The ioctl must not be
  192. retried without performing another action to fix the problem
  193. first. Only returned by
  194. <constant>VIDIOC_SUBDEV_S_SELECTION</constant></para>
  195. </listitem>
  196. </varlistentry>
  197. <varlistentry>
  198. <term><errorcode>EINVAL</errorcode></term>
  199. <listitem>
  200. <para>The &v4l2-subdev-selection;
  201. <structfield>pad</structfield> references a non-existing
  202. pad, the <structfield>which</structfield> field references a
  203. non-existing format, or the selection target is not
  204. supported on the given subdev pad.</para>
  205. </listitem>
  206. </varlistentry>
  207. </variablelist>
  208. </refsect1>
  209. </refentry>