Commit 64b9ce83 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] v4l: Common documentation for selection targets

Both V4L2 and V4L2 subdev interface have very similar selection APIs with
differences foremost related to in-memory and media bus formats. However,
the selection targets are the same for both. Most targets are and in the
future will likely continue to be more the same than with any differences.
Thus it makes sense to unify the documentation of the targets.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5689b288
...@@ -2377,10 +2377,11 @@ that used it. It was originally scheduled for removal in 2.6.35. ...@@ -2377,10 +2377,11 @@ that used it. It was originally scheduled for removal in 2.6.35.
<para>V4L2_CTRL_FLAG_VOLATILE was added to signal volatile controls to userspace.</para> <para>V4L2_CTRL_FLAG_VOLATILE was added to signal volatile controls to userspace.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>Add selection API for extended control over cropping and <para>Add selection API for extended control over cropping
composing. Does not affect the compatibility of current drivers and and composing. Does not affect the compatibility of current
applications. See <link linkend="selection-api"> selection API </link> for drivers and applications. See <link
details.</para> linkend="selection-api"> selection API </link> for
details.</para>
</listitem> </listitem>
</orderedlist> </orderedlist>
</section> </section>
......
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
</para> </para>
</section> </section>
<section> <section id="v4l2-subdev-selections">
<title>Selections: cropping, scaling and composition</title> <title>Selections: cropping, scaling and composition</title>
<para>Many sub-devices support cropping frames on their input or output <para>Many sub-devices support cropping frames on their input or output
...@@ -289,9 +289,9 @@ ...@@ -289,9 +289,9 @@
&v4l2-rect; by the coordinates of the top left corner and the rectangle &v4l2-rect; by the coordinates of the top left corner and the rectangle
size. Both the coordinates and sizes are expressed in pixels.</para> size. Both the coordinates and sizes are expressed in pixels.</para>
<para>As for pad formats, drivers store try and active rectangles for <para>As for pad formats, drivers store try and active
the selection targets <xref rectangles for the selection targets <xref
linkend="v4l2-subdev-selection-targets" />.</para> linkend="v4l2-selections-common" />.</para>
<para>On sink pads, cropping is applied relative to the <para>On sink pads, cropping is applied relative to the
current pad format. The pad format represents the image size as current pad format. The pad format represents the image size as
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
<para>Scaling support is optional. When supported by a subdev, <para>Scaling support is optional. When supported by a subdev,
the crop rectangle on the subdev's sink pad is scaled to the the crop rectangle on the subdev's sink pad is scaled to the
size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL
using <constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant> using <constant>V4L2_SEL_TGT_COMPOSE</constant>
selection target on the same pad. If the subdev supports scaling selection target on the same pad. If the subdev supports scaling
but not composing, the top and left values are not used and must but not composing, the top and left values are not used and must
always be set to zero.</para> always be set to zero.</para>
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
performed by the user: the changes made will be propagated to performed by the user: the changes made will be propagated to
any subsequent stages. If this behaviour is not desired, the any subsequent stages. If this behaviour is not desired, the
user must set user must set
<constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This <constant>V4L2_SEL_FLAG_KEEP_CONFIG</constant> flag. This
flag causes no propagation of the changes are allowed in any flag causes no propagation of the changes are allowed in any
circumstances. This may also cause the accessed rectangle to be circumstances. This may also cause the accessed rectangle to be
adjusted by the driver, depending on the properties of the adjusted by the driver, depending on the properties of the
......
...@@ -53,11 +53,11 @@ cropping and composing rectangles have the same size.</para> ...@@ -53,11 +53,11 @@ cropping and composing rectangles have the same size.</para>
</mediaobject> </mediaobject>
</figure> </figure>
For complete list of the available selection targets see table <xref
linkend="v4l2-sel-target"/>
</section> </section>
See <xref linkend="v4l2-selection-targets-table" /> for more
information.
<section> <section>
<title>Configuration</title> <title>Configuration</title>
......
<section id="v4l2-selections-common">
<title>Selection targets</title>
<para>While the <link linkend="selection-api">V4L2 selection
API</link> and <link linkend="v4l2-subdev-selections">V4L2 subdev
selection APIs</link> are very similar, there's one fundamental
difference between the two. On sub-device API, the selection
rectangle refers to the media bus format, and is bound to a
sub-device's pad. On the V4L2 interface the selection rectangles
refer to the in-memory pixel format.</para>
<para>The precise meaning of the selection targets may thus be
affected on which of the two interfaces they are used.</para>
<table pgwide="1" frame="none" id="v4l2-selection-targets-table">
<title>Selection target definitions</title>
<tgroup cols="5">
<colspec colname="c1" />
<colspec colname="c2" />
<colspec colname="c3" />
<colspec colname="c4" />
<colspec colname="c5" />
&cs-def;
<thead>
<row rowsep="1">
<entry align="left">Target name</entry>
<entry align="left">id</entry>
<entry align="left">Definition</entry>
<entry align="left">Valid for V4L2</entry>
<entry align="left">Valid for V4L2 subdev</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
<entry>0x0000</entry>
<entry>Crop rectangle. Defines the cropped area.</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
<entry>0x0001</entry>
<entry>Suggested cropping rectangle that covers the "whole picture".</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
<entry>0x0002</entry>
<entry>Bounds of the crop rectangle. All valid crop
rectangles fit inside the crop bounds rectangle.
</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
<entry>0x0100</entry>
<entry>Compose rectangle. Used to configure scaling
and composition.</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>
<entry>0x0101</entry>
<entry>Suggested composition rectangle that covers the "whole picture".</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
<entry>0x0102</entry>
<entry>Bounds of the compose rectangle. All valid compose
rectangles fit inside the compose bounds rectangle.</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry>
<entry>0x0103</entry>
<entry>The active area and all padding pixels that are inserted or
modified by hardware.</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
...@@ -589,6 +589,11 @@ and discussions on the V4L mailing list.</revremark> ...@@ -589,6 +589,11 @@ and discussions on the V4L mailing list.</revremark>
&sub-write; &sub-write;
</appendix> </appendix>
<appendix>
<title>Common definitions for V4L2 and V4L2 subdev interfaces</title>
&sub-selections-common;
</appendix>
<appendix id="videodev"> <appendix id="videodev">
<title>Video For Linux Two Header File</title> <title>Video For Linux Two Header File</title>
&sub-videodev2-h; &sub-videodev2-h;
......
...@@ -67,7 +67,7 @@ Do not use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE ...@@ -67,7 +67,7 @@ Do not use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE
setting the value of &v4l2-selection; <structfield>target</structfield> field setting the value of &v4l2-selection; <structfield>target</structfield> field
to <constant> V4L2_SEL_TGT_CROP </constant> (<constant> to <constant> V4L2_SEL_TGT_CROP </constant> (<constant>
V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref
linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional linkend="v4l2-selections-common" /> or <xref linkend="selection-api" /> for additional
targets. The <structfield>flags</structfield> and <structfield>reserved targets. The <structfield>flags</structfield> and <structfield>reserved
</structfield> fields of &v4l2-selection; are ignored and they must be filled </structfield> fields of &v4l2-selection; are ignored and they must be filled
with zeros. The driver fills the rest of the structure or with zeros. The driver fills the rest of the structure or
...@@ -88,7 +88,7 @@ use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE ...@@ -88,7 +88,7 @@ use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE
setting the value of &v4l2-selection; <structfield>target</structfield> to setting the value of &v4l2-selection; <structfield>target</structfield> to
<constant>V4L2_SEL_TGT_CROP</constant> (<constant> <constant>V4L2_SEL_TGT_CROP</constant> (<constant>
V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref
linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional linkend="v4l2-selections-common" /> or <xref linkend="selection-api" /> for additional
targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be
set to the desired active area. Field &v4l2-selection; <structfield> reserved set to the desired active area. Field &v4l2-selection; <structfield> reserved
</structfield> is ignored and must be filled with zeros. The driver may adjust </structfield> is ignored and must be filled with zeros. The driver may adjust
...@@ -154,52 +154,8 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> ...@@ -154,52 +154,8 @@ exist no rectangle </emphasis> that satisfies the constraints.</para>
</refsect1> </refsect1>
<refsect1> <para>Selection targets are documented in <xref
<table frame="none" pgwide="1" id="v4l2-sel-target"> linkend="v4l2-selections-common"/>.</para>
<title>Selection targets.</title>
<tgroup cols="3">
&cs-def;
<tbody valign="top">
<row>
<entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
<entry>0x0000</entry>
<entry>The area that is currently cropped by hardware.</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
<entry>0x0001</entry>
<entry>Suggested cropping rectangle that covers the "whole picture".</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
<entry>0x0002</entry>
<entry>Limits for the cropping rectangle.</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
<entry>0x0100</entry>
<entry>The area to which data is composed by hardware.</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>
<entry>0x0101</entry>
<entry>Suggested composing rectangle that covers the "whole picture".</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
<entry>0x0102</entry>
<entry>Limits for the composing rectangle.</entry>
</row>
<row>
<entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry>
<entry>0x0103</entry>
<entry>The active area and all padding pixels that are inserted or
modified by hardware.</entry>
</row>
</tbody>
</tgroup>
</table>
</refsect1>
<refsect1> <refsect1>
<table frame="none" pgwide="1" id="v4l2-sel-flags"> <table frame="none" pgwide="1" id="v4l2-sel-flags">
...@@ -253,7 +209,7 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> ...@@ -253,7 +209,7 @@ exist no rectangle </emphasis> that satisfies the constraints.</para>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
<entry><structfield>target</structfield></entry> <entry><structfield>target</structfield></entry>
<entry>Used to select between <link linkend="v4l2-sel-target"> cropping <entry>Used to select between <link linkend="v4l2-selections-common"> cropping
and composing rectangles</link>.</entry> and composing rectangles</link>.</entry>
</row> </row>
<row> <row>
......
...@@ -87,36 +87,8 @@ ...@@ -87,36 +87,8 @@
<constant>EINVAL</constant>.</para> <constant>EINVAL</constant>.</para>
</section> </section>
<table pgwide="1" frame="none" id="v4l2-subdev-selection-targets"> <para>Selection targets are documented in <xref
<title>V4L2 subdev selection targets</title> linkend="v4l2-selections-common"/>.</para>
<tgroup cols="3">
&cs-def;
<tbody valign="top">
<row>
<entry><constant>V4L2_SUBDEV_SEL_TGT_CROP</constant></entry>
<entry>0x0000</entry>
<entry>Actual crop. Defines the cropping
performed by the processing step.</entry>
</row>
<row>
<entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS</constant></entry>
<entry>0x0002</entry>
<entry>Bounds of the crop rectangle.</entry>
</row>
<row>
<entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant></entry>
<entry>0x0100</entry>
<entry>Actual compose rectangle. Used to configure scaling
on sink pads and composition on source pads.</entry>
</row>
<row>
<entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
<entry>0x0102</entry>
<entry>Bounds of the compose rectangle.</entry>
</row>
</tbody>
</tgroup>
</table>
<table pgwide="1" frame="none" id="v4l2-subdev-selection-flags"> <table pgwide="1" frame="none" id="v4l2-subdev-selection-flags">
<title>V4L2 subdev selection flags</title> <title>V4L2 subdev selection flags</title>
...@@ -173,7 +145,7 @@ ...@@ -173,7 +145,7 @@
<entry>__u32</entry> <entry>__u32</entry>
<entry><structfield>target</structfield></entry> <entry><structfield>target</structfield></entry>
<entry>Target selection rectangle. See <entry>Target selection rectangle. See
<xref linkend="v4l2-subdev-selection-targets">.</xref>.</entry> <xref linkend="v4l2-selections-common" />.</entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment