diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-03-15 20:26:04 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 04:53:31 -0300 |
commit | 333c8b97785d5afd5085ba3720b4d259623290f6 (patch) | |
tree | 3cba92af1765957c68f74042dea1873481554ede /Documentation | |
parent | d3a7ed99759b18e4fd19b8ddd226f8085b8bd975 (diff) |
[media] v4l: v4l2_subdev userspace format API
Add a userspace API to get, set and enumerate the media format on a
subdev pad.
The format at the output of a subdev usually depends on the format at
its input(s). The try format operation is thus not suitable for probing
format at individual pads, as it can't modify the device state and thus
can't remember the format tried at the input to compute the output
format.
To fix the problem, pass an extra argument to the get/set format
operations to select the 'try' or 'active' format.
The try format is used when probing the subdev. Setting the try format
must not change the device configuration but can store data for later
reuse. Data storage is provided at the file-handle level so applications
probing the subdev concurently won't interfere with each other.
The active format is used when configuring the subdev. It's identical to
the format handled by the usual get/set operations.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/Makefile | 5 | ||||
-rw-r--r-- | Documentation/DocBook/media-entities.tmpl | 16 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/dev-subdev.xml | 280 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/subdev-formats.xml | 2416 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/v4l2.xml | 4 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-streamon.xml | 9 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml | 154 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml | 119 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml | 180 |
9 files changed, 3182 insertions, 1 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 8b6e00a71034..2deb069aedf1 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -53,7 +53,10 @@ MAN := $(patsubst %.xml, %.9, $(BOOKS)) mandocs: $(MAN) build_images = mkdir -p $(objtree)/Documentation/DocBook/media/ && \ - cp $(srctree)/Documentation/DocBook/dvb/*.png $(srctree)/Documentation/DocBook/v4l/*.gif $(objtree)/Documentation/DocBook/media/ + cp $(srctree)/Documentation/DocBook/dvb/*.png \ + $(srctree)/Documentation/DocBook/v4l/*.gif \ + $(srctree)/Documentation/DocBook/v4l/*.png \ + $(objtree)/Documentation/DocBook/media/ xmldoclinks: ifneq ($(objtree),$(srctree)) diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index 121db1549244..dbb9cb2e1ec6 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl @@ -86,6 +86,10 @@ <!ENTITY VIDIOC-S-PRIORITY "<link linkend='vidioc-g-priority'><constant>VIDIOC_S_PRIORITY</constant></link>"> <!ENTITY VIDIOC-S-STD "<link linkend='vidioc-g-std'><constant>VIDIOC_S_STD</constant></link>"> <!ENTITY VIDIOC-S-TUNER "<link linkend='vidioc-g-tuner'><constant>VIDIOC_S_TUNER</constant></link>"> +<!ENTITY VIDIOC-SUBDEV-ENUM-FRAME-SIZE "<link linkend='vidioc-subdev-enum-frame-size'><constant>VIDIOC_SUBDEV_ENUM_FRAME_SIZE</constant></link>"> +<!ENTITY VIDIOC-SUBDEV-ENUM-MBUS-CODE "<link linkend='vidioc-subdev-enum-mbus-code'><constant>VIDIOC_SUBDEV_ENUM_MBUS_CODE</constant></link>"> +<!ENTITY VIDIOC-SUBDEV-G-FMT "<link linkend='vidioc-subdev-g-fmt'><constant>VIDIOC_SUBDEV_G_FMT</constant></link>"> +<!ENTITY VIDIOC-SUBDEV-S-FMT "<link linkend='vidioc-subdev-g-fmt'><constant>VIDIOC_SUBDEV_S_FMT</constant></link>"> <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> @@ -107,6 +111,7 @@ <!ENTITY v4l2-field "enum <link linkend='v4l2-field'>v4l2_field</link>"> <!ENTITY v4l2-frmivaltypes "enum <link linkend='v4l2-frmivaltypes'>v4l2_frmivaltypes</link>"> <!ENTITY v4l2-frmsizetypes "enum <link linkend='v4l2-frmsizetypes'>v4l2_frmsizetypes</link>"> +<!ENTITY v4l2-mbus-pixelcode "enum <link linkend='v4l2-mbus-pixelcode'>v4l2_mbus_pixelcode</link>"> <!ENTITY v4l2-memory "enum <link linkend='v4l2-memory'>v4l2_memory</link>"> <!ENTITY v4l2-mpeg-audio-ac3-bitrate "enum <link linkend='v4l2-mpeg-audio-ac3-bitrate'>v4l2_mpeg_audio_ac3_bitrate</link>"> <!ENTITY v4l2-mpeg-audio-crc "enum <link linkend='v4l2-mpeg-audio-crc'>v4l2_mpeg_audio_crc</link>"> @@ -130,6 +135,7 @@ <!ENTITY v4l2-mpeg-video-encoding "enum <link linkend='v4l2-mpeg-video-encoding'>v4l2_mpeg_video_encoding</link>"> <!ENTITY v4l2-power-line-frequency "enum <link linkend='v4l2-power-line-frequency'>v4l2_power_line_frequency</link>"> <!ENTITY v4l2-priority "enum <link linkend='v4l2-priority'>v4l2_priority</link>"> +<!ENTITY v4l2-subdev-format-whence "enum <link linkend='v4l2-subdev-format-whence'>v4l2_subdev_format_whence</link>"> <!ENTITY v4l2-tuner-type "enum <link linkend='v4l2-tuner-type'>v4l2_tuner_type</link>"> <!ENTITY v4l2-preemphasis "enum <link linkend='v4l2-preemphasis'>v4l2_preemphasis</link>"> @@ -172,6 +178,7 @@ <!ENTITY v4l2-hw-freq-seek "struct <link linkend='v4l2-hw-freq-seek'>v4l2_hw_freq_seek</link>"> <!ENTITY v4l2-input "struct <link linkend='v4l2-input'>v4l2_input</link>"> <!ENTITY v4l2-jpegcompression "struct <link linkend='v4l2-jpegcompression'>v4l2_jpegcompression</link>"> +<!ENTITY v4l2-mbus-framefmt "struct <link linkend='v4l2-mbus-framefmt'>v4l2_mbus_framefmt</link>"> <!ENTITY v4l2-modulator "struct <link linkend='v4l2-modulator'>v4l2_modulator</link>"> <!ENTITY v4l2-mpeg-vbi-fmt-ivtv "struct <link linkend='v4l2-mpeg-vbi-fmt-ivtv'>v4l2_mpeg_vbi_fmt_ivtv</link>"> <!ENTITY v4l2-output "struct <link linkend='v4l2-output'>v4l2_output</link>"> @@ -186,6 +193,9 @@ <!ENTITY v4l2-sliced-vbi-cap "struct <link linkend='v4l2-sliced-vbi-cap'>v4l2_sliced_vbi_cap</link>"> <!ENTITY v4l2-sliced-vbi-data "struct <link linkend='v4l2-sliced-vbi-data'>v4l2_sliced_vbi_data</link>"> <!ENTITY v4l2-sliced-vbi-format "struct <link linkend='v4l2-sliced-vbi-format'>v4l2_sliced_vbi_format</link>"> +<!ENTITY v4l2-subdev-frame-size-enum "struct <link linkend='v4l2-subdev-frame-size-enum'>v4l2_subdev_frame_size_enum</link>"> +<!ENTITY v4l2-subdev-format "struct <link linkend='v4l2-subdev-format'>v4l2_subdev_format</link>"> +<!ENTITY v4l2-subdev-mbus-code-enum "struct <link linkend='v4l2-subdev-mbus-code-enum'>v4l2_subdev_mbus_code_enum</link>"> <!ENTITY v4l2-standard "struct <link linkend='v4l2-standard'>v4l2_standard</link>"> <!ENTITY v4l2-streamparm "struct <link linkend='v4l2-streamparm'>v4l2_streamparm</link>"> <!ENTITY v4l2-timecode "struct <link linkend='v4l2-timecode'>v4l2_timecode</link>"> @@ -215,6 +225,7 @@ <!ENTITY ENXIO "<errorcode>ENXIO</errorcode> error code"> <!ENTITY EMFILE "<errorcode>EMFILE</errorcode> error code"> <!ENTITY EPERM "<errorcode>EPERM</errorcode> error code"> +<!ENTITY EPIPE "<errorcode>EPIPE</errorcode> error code"> <!ENTITY ERANGE "<errorcode>ERANGE</errorcode> error code"> <!-- Subsections --> @@ -234,6 +245,7 @@ <!ENTITY sub-dev-raw-vbi SYSTEM "v4l/dev-raw-vbi.xml"> <!ENTITY sub-dev-rds SYSTEM "v4l/dev-rds.xml"> <!ENTITY sub-dev-sliced-vbi SYSTEM "v4l/dev-sliced-vbi.xml"> +<!ENTITY sub-dev-subdev SYSTEM "v4l/dev-subdev.xml"> <!ENTITY sub-dev-teletext SYSTEM "v4l/dev-teletext.xml"> <!ENTITY sub-driver SYSTEM "v4l/driver.xml"> <!ENTITY sub-libv4l SYSTEM "v4l/libv4l.xml"> @@ -319,6 +331,10 @@ <!ENTITY sub-reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> <!ENTITY sub-s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> <!ENTITY sub-streamon SYSTEM "v4l/vidioc-streamon.xml"> +<!ENTITY sub-subdev-enum-frame-size SYSTEM "v4l/vidioc-subdev-enum-frame-size.xml"> +<!ENTITY sub-subdev-enum-mbus-code SYSTEM "v4l/vidioc-subdev-enum-mbus-code.xml"> +<!ENTITY sub-subdev-formats SYSTEM "v4l/subdev-formats.xml"> +<!ENTITY sub-subdev-g-fmt SYSTEM "v4l/vidioc-subdev-g-fmt.xml"> <!ENTITY sub-capture-c SYSTEM "v4l/capture.c.xml"> <!ENTITY sub-keytable-c SYSTEM "v4l/keytable.c.xml"> <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> diff --git a/Documentation/DocBook/v4l/dev-subdev.xml b/Documentation/DocBook/v4l/dev-subdev.xml new file mode 100644 index 000000000000..fc62e65f45ef --- /dev/null +++ b/Documentation/DocBook/v4l/dev-subdev.xml @@ -0,0 +1,280 @@ + <title>Sub-device Interface</title> + + <note> + <title>Experimental</title> + <para>This is an <link linkend="experimental">experimental</link> + interface and may change in the future.</para> + </note> + + <para>The complex nature of V4L2 devices, where hardware is often made of + several integrated circuits that need to interact with each other in a + controlled way, leads to complex V4L2 drivers. The drivers usually reflect + the hardware model in software, and model the different hardware components + as software blocks called sub-devices.</para> + + <para>V4L2 sub-devices are usually kernel-only objects. If the V4L2 driver + implements the media device API, they will automatically inherit from media + entities. Applications will be able to enumerate the sub-devices and discover + the hardware topology using the media entities, pads and links enumeration + API.</para> + + <para>In addition to make sub-devices discoverable, drivers can also choose + to make them directly configurable by applications. When both the sub-device + driver and the V4L2 device driver support this, sub-devices will feature a + character device node on which ioctls can be called to + <itemizedlist> + <listitem>query, read and write sub-devices controls</listitem> + <listitem>subscribe and unsubscribe to events and retrieve them</listitem> + <listitem>negotiate image formats on individual pads</listitem> + </itemizedlist> + </para> + + <para>Sub-device character device nodes, conventionally named + <filename>/dev/v4l-subdev*</filename>, use major number 81.</para> + + <section> + <title>Controls</title> + <para>Most V4L2 controls are implemented by sub-device hardware. Drivers + usually merge all controls and expose them through video device nodes. + Applications can control all sub-devices through a single interface.</para> + + <para>Complex devices sometimes implement the same control in different + pieces of hardware. This situation is common in embedded platforms, where + both sensors and image processing hardware implement identical functions, + such as contrast adjustment, white balance or faulty pixels correction. As + the V4L2 controls API doesn't support several identical controls in a single + device, all but one of the identical controls are hidden.</para> + + <para>Applications can access those hidden controls through the sub-device + node with the V4L2 control API described in <xref linkend="control" />. The + ioctls behave identically as when issued on V4L2 device nodes, with the + exception that they deal only with controls implemented in the sub-device. + </para> + + <para>Depending on the driver, those controls might also be exposed through + one (or several) V4L2 device nodes.</para> + </section> + + <section> + <title>Events</title> + <para>V4L2 sub-devices can notify applications of events as described in + <xref linkend="event" />. The API behaves identically as when used on V4L2 + device nodes, with the exception that it only deals with events generated by + the sub-device. Depending on the driver, those events might also be reported + on one (or several) V4L2 device nodes.</para> + </section> + + <section id="pad-level-formats"> + <title>Pad-level Formats</title> + + <warning>Pad-level formats are only applicable to very complex device that + need to expose low-level format configuration to user space. Generic V4L2 + applications do <emphasis>not</emphasis> need to use the API described in + this section.</warning> + + <note>For the purpose of this section, the term + <wordasword>format</wordasword> means the combination of media bus data + format, frame width and frame height.</note> + + <para>Image formats are typically negotiated on video capture and output + devices using the <link linkend="crop">cropping and scaling</link> ioctls. + The driver is responsible for configuring every block in the video pipeline + according to the requested format at the pipeline input and/or + output.</para> + + <para>For complex devices, such as often found in embedded systems, + identical image sizes at the output of a pipeline can be achieved using + different hardware configurations. One such exemple is shown on + <xref linkend="pipeline-scaling" xrefstyle="template: Figure %n" />, where + image scaling can be performed on both the video sensor and the host image + processing hardware.</para> + + <figure id="pipeline-scaling"> + <title>Image Format Negotation on Pipelines</title> + <mediaobject> + <imageobject> + <imagedata fileref="pipeline.pdf" format="PS" /> + </imageobject> + <imageobject> + <imagedata fileref="pipeline.png" format="PNG" /> + </imageobject> + <textobject> + <phrase>High quality and high speed pipeline configuration</phrase> + </textobject> + </mediaobject> + </figure> + + <para>The sensor scaler is usually of less quality than the host scaler, but + scaling on the sensor is required to achieve higher frame rates. Depending + on the use case (quality vs. speed), the pipeline must be configured + differently. Applications need to configure the formats at every point in + the pipeline explicitly.</para> + + <para>Drivers that implement the <link linkend="media-controller-intro">media + API</link> can expose pad-level image format configuration to applications. + When they do, applications can use the &VIDIOC-SUBDEV-G-FMT; and + &VIDIOC-SUBDEV-S-FMT; ioctls. to negotiate formats on a per-pad basis.</para> + + <para>Applications are responsible for configuring coherent parameters on + the whole pipeline and making sure that connected pads have compatible + formats. The pipeline is checked for formats mismatch at &VIDIOC-STREAMON; + time, and an &EPIPE; is then returned if the configuration is + invalid.</para> + + <para>Pad-level image format configuration support can be tested by calling + the &VIDIOC-SUBDEV-G-FMT; ioctl on pad 0. If the driver returns an &EINVAL; + pad-level format configuration is not supported by the sub-device.</para> + + <section> + <title>Format Negotiation</title> + + <para>Acceptable formats on pads can (and usually do) depend on a number + of external parameters, such as formats on other pads, active links, or + even controls. Finding a combination of formats on all pads in a video + pipeline, acceptable to both application and driver, can't rely on formats + enumeration only. A format negotiation mechanism is required.</para> + + <para>Central to the format negotiation mechanism are the get/set format + operations. When called with the <structfield>which</structfield> argument + set to <constant>V4L2_SUBDEV_FORMAT_TRY</constant>, the + &VIDIOC-SUBDEV-G-FMT; and &VIDIOC-SUBDEV-S-FMT; ioctls operate on a set of + formats parameters that are not connected to the hardware configuration. + Modifying those 'try' formats leaves the device state untouched (this + applies to both the software state stored in the driver and the hardware + state stored in the device itself).</para> + + <para>While not kept as part of the device state, try formats are stored + in the sub-device file handles. A &VIDIOC-SUBDEV-G-FMT; call will return + the last try format set <emphasis>on the same sub-device file + handle</emphasis>. Several applications querying the same sub-device at + the same time will thus not interact with each other.</para> + + <para>To find out whether a particular format is supported by the device, + applications use the &VIDIOC-SUBDEV-S-FMT; ioctl. Drivers verify and, if + needed, change the requested <structfield>format</structfield> based on + device requirements and return the possibly modified value. Applications + can then choose to try a different format or accept the returned value and + continue.</para> + + <para>Formats returned by the driver during a negotiation iteration are + guaranteed to be supported by the device. In particular, drivers guarantee + that a returned format will not be further changed if passed to an + &VIDIOC-SUBDEV-S-FMT; call as-is (as long as external parameters, such as + formats on other pads or links' configuration are not changed).</para> + + <para>Drivers automatically propagate formats inside sub-devices. When a + try or active format is set on a pad, corresponding formats on other pads + of the same sub-device can be modified by the driver. Drivers are free to + modify formats as required by the device. However, they should comply with + the following rules when possible: + <itemizedlist> + <listitem>Formats should be propagated from sink pads to source pads. + Modifying a format on a source pad should not modify the format on any + sink pad.</listitem> + <listitem>Sub-devices that scale frames using variable scaling factors + should reset the scale factors to default values when sink pads formats + are modified. If the 1:1 scaling ratio is supported, this means that + source pads formats should be reset to the sink pads formats.</listitem> + </itemizedlist> + </para> + + <para>Formats are not propagated across links, as that would involve + propagating them from one sub-device file handle to another. Applications + must then take care to configure both ends of every link explicitly with + compatible formats. Identical formats on the two ends of a link are + guaranteed to be compatible. Drivers are free to accept different formats + matching device requirements as being compatible.</para> + + <para><xref linkend="sample-pipeline-config" xrefstyle="template:Table %n"/> + shows a sample configuration sequence for the pipeline described in + <xref linkend="pipeline-scaling" xrefstyle="template:Figure %n"/> (table + columns list entity names and pad numbers).</para> + + <table pgwide="0" frame="none" id="sample-pipeline-config"> + <title>Sample Pipeline Configuration</title> + <tgroup cols="3"> + <colspec colname="what"/> + <colspec colname="sensor-0" /> + <colspec colname="frontend-0" /> + <colspec colname="frontend-1" /> + <colspec colname="scaler-0" /> + <colspec colname="scaler-1" /> + <thead> + <row> + <entry></entry> + <entry>Sensor/0</entry> + <entry>Frontend/0</entry> + <entry>Frontend/1</entry> + <entry>Scaler/0</entry> + <entry>Scaler/1</entry> + </row> + </thead> + <tbody valign="top"> + <row> + <entry>Initial state</entry> + <entry>2048x1536</entry> + <entry>-</entry> + <entry>-</entry> + <entry>-</entry> + <entry>-</entry> + </row> + <row> + <entry>Configure frontend input</entry> + <entry>2048x1536</entry> + <entry><emphasis>2048x1536</emphasis></entry> + <entry><emphasis>2046x1534</emphasis></entry> + <entry>-</entry> + <entry>-</entry> + </row> + <row> + <entry>Configure scaler input</entry> + <entry>2048x1536</entry> + <entry>2048x1536</entry> + <entry>2046x1534</entry> + <entry><emphasis>2046x1534</emphasis></entry> + <entry><emphasis>2046x1534</emphasis></entry> + </row> + <row> + <entry>Configure scaler output</entry> + <entry>2048x1536</entry> + <entry>2048x1536</entry> + <entry>2046x1534</entry> + <entry>2046x1534</entry> + <entry><emphasis>1280x960</emphasis></entry> + </row> + </tbody> + </tgroup> + </table> + + <para> + <orderedlist> + <listitem>Initial state. The sensor output is set to its native 3MP + resolution. Resolutions on the host frontend and scaler input and output + pads are undefined.</listitem> + <listitem>The application configures the frontend input pad resolution to + 2048x1536. The driver propagates the format to the frontend output pad. + Note that the propagated output format can be different, as in this case, + than the input format, as the hardware might need to crop pixels (for + instance when converting a Bayer filter pattern to RGB or YUV).</listitem> + <listitem>The application configures the scaler input pad resolution to + 2046x1534 to match the frontend output resolution. The driver propagates + the format to the scaler output pad.</listitem> + <listitem>The application configures the scaler output pad resolution to + 1280x960.</listitem> + </orderedlist> + </para> + + <para>When satisfied with the try results, applications can set the active + formats by setting the <structfield>which</structfield> argument to + <constant>V4L2_SUBDEV_FORMAT_TRY</constant>. Active formats are changed + exactly as try formats by drivers. To avoid modifying the hardware state + during format negotiation, applications should negotiate try formats first + and then modify the active settings using the try formats returned during + the last negotiation iteration. This guarantees that the active format + will be applied as-is by the driver without being modified. + </para> + </section> + + </section> + + &sub-subdev-formats; diff --git a/Documentation/DocBook/v4l/subdev-formats.xml b/Documentation/DocBook/v4l/subdev-formats.xml new file mode 100644 index 000000000000..0cae57207006 --- /dev/null +++ b/Documentation/DocBook/v4l/subdev-formats.xml @@ -0,0 +1,2416 @@ +<section id="v4l2-mbus-format"> + <title>Media Bus Formats</title> + + <table pgwide="1" frame="none" id="v4l2-mbus-framefmt"> + <title>struct <structname>v4l2_mbus_framefmt</structname></title> + <tgroup cols="3"> + &cs-str; + <tbody valign="top"> + <row> + <entry>__u32</entry> + <entry><structfield>width</structfield></entry> + <entry>Image width, in pixels.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>height</structfield></entry> + <entry>Image height, in pixels.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>code</structfield></entry> + <entry>Format code, from &v4l2-mbus-pixelcode;.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>field</structfield></entry> + <entry>Field order, from &v4l2-field;. See + <xref linkend="field-order" /> for details.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>colorspace</structfield></entry> + <entry>Image colorspace, from &v4l2-colorspace;. See + <xref linkend="colorspaces" /> for details.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>reserved</structfield>[7]</entry> + <entry>Reserved for future extensions. Applications and drivers must + set the array to zero.</entry> + </row> + </tbody> + </tgroup> + </table> + + <section id="v4l2-mbus-pixelcode"> + <title>Media Bus Pixel Codes</title> + + <para>The media bus pixel codes describe image formats as flowing over + physical busses (both between separate physical components and inside SoC + devices). This should not be confused with the V4L2 pixel formats that + describe, using four character codes, image formats as stored in memory. + </para> + + <para>While there is a relationship between image formats on busses and + image formats in memory (a raw Bayer image won't be magically converted to + JPEG just by storing it to memory), there is no one-to-one correspondance + between them.</para> + + <section> + <title>Packed RGB Formats</title> + + <para>Those formats transfer pixel data as red, green and blue components. + The format code is made of the following information. + <itemizedlist> + <listitem>The red, green and blue components order code, as encoded in a + pixel sample. Possible values are RGB and BGR.</listitem> + <listitem>The number of bits per component, for each component. The values + can be different for all components. Common values are 555 and 565. + </listitem> + <listitem>The number of bus samples per pixel. Pixels that are wider than + the bus width must be transferred in multiple samples. Common values are + 1 and 2.</listitem> + <listitem>The bus width.</listitem> + <listitem>For formats where the total number of bits per pixel is smaller + than the number of bus samples per pixel times the bus width, a padding + value stating if the bytes are padded in their most high order bits + (PADHI) or low order bits (PADLO).</listitem> + <listitem>For formats where the number of bus samples per pixel is larger + than 1, an endianness value stating if the pixel is transferred MSB first + (BE) or LSB first (LE).</listitem> + </itemizedlist> + </para> + + <para>For instance, a format where pixels are encoded as 5-bits red, 5-bits + green and 5-bit blue values padded on the high bit, transferred as 2 8-bit + samples per pixel with the most significant bits (padding, red and half of + the green value) transferred first will be named + <constant>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</constant>. + </para> + + <para>The following tables list existing packet RGB formats.</para> + + <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-rgb"> + <title>RGB formats</title> + <tgroup cols="11"> + <colspec colname="id" align="left" /> + <colspec colname="code" align="center"/> + <colspec colname="bit" /> + <colspec colnum="4" colname="b07" align="center" /> + <colspec colnum="5" colname="b06" align="center" /> + <colspec colnum="6" colname="b05" align="center" /> + <colspec colnum="7" colname="b04" align="center" /> + <colspec colnum="8" colname="b03" align="center" /> + <colspec colnum="9" colname="b02" align="center" /> + <colspec colnum="10" colname="b01" align="center" /> + <colspec colnum="11" colname="b00" align="center" /> + <spanspec namest="b07" nameend="b00" spanname="b0" /> + <thead> + <row> + <entry>Identifier</entry> + <entry>Code</entry> + <entry></entry> + <entry spanname="b0">Data organization</entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry>Bit</entry> + <entry>7</entry> + <entry>6</entry> + <entry>5</entry> + <entry>4</entry> + <entry>3</entry> + <entry>2</entry> + <entry>1</entry> + <entry>0</entry> + </row> + </thead> + <tbody valign="top"> + <row id="V4L2-MBUS-FMT-RGB444-2X8-PADHI-BE"> + <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE</entry> + <entry>0x1001</entry> + <entry></entry> + <entry>0</entry> + <entry>0</entry> + <entry>0</entry> + <entry>0</entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>g<subscript>3</subscript></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-RGB444-2X8-PADHI-LE"> + <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE</entry> + <entry>0x1002</entry> + <entry></entry> + <entry>g<subscript>3</subscript></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>0</entry> + <entry>0</entry> + <entry>0</entry> + <entry>0</entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-RGB555-2X8-PADHI-BE"> + <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</entry> + <entry>0x1003</entry> + <entry></entry> + <entry>0</entry> + <entry>r<subscript>4</subscript></entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + <entry>g<subscript>4</subscript></entry> + <entry>g<subscript>3</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>b<subscript>4</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-RGB555-2X8-PADHI-LE"> + <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE</entry> + <entry>0x1004</entry> + <entry></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>b<subscript>4</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>0</entry> + <entry>r<subscript>4</subscript></entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + <entry>g<subscript>4</subscript></entry> + <entry>g<subscript>3</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-BGR565-2X8-BE"> + <entry>V4L2_MBUS_FMT_BGR565_2X8_BE</entry> + <entry>0x1005</entry> + <entry></entry> + <entry>b<subscript>4</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + <entry>g<subscript>5</subscript></entry> + <entry>g<subscript>4</subscript></entry> + <entry>g<subscript>3</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>r<subscript>4</subscript></entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-BGR565-2X8-LE"> + <entry>V4L2_MBUS_FMT_BGR565_2X8_LE</entry> + <entry>0x1006</entry> + <entry></entry> + <entry>g<subscript>2</subscript></entry> + <entry>g<subscript>1</subscript></entry> + <entry>g<subscript>0</subscript></entry> + <entry>r<subscript>4</subscript></entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>b<subscript>4</subscript></entry> + <entry>b<subscript>3</subscript></entry> + <entry>b<subscript>2</subscript></entry> + <entry>b<subscript>1</subscript></entry> + <entry>b<subscript>0</subscript></entry> + <entry>g<subscript>5</subscript></entry> + <entry>g<subscript>4</subscript></entry> + <entry>g<subscript>3</subscript></entry> + </row> + <row id="V4L2-MBUS-FMT-RGB565-2X8-BE"> + <entry>V4L2_MBUS_FMT_RGB565_2X8_BE</entry> + <entry>0x1007</entry> + <entry></entry> + <entry>r<subscript>4</subscript></entry> + <entry>r<subscript>3</subscript></entry> + <entry>r<subscript>2</subscript></entry> + <entry>r<subscript>1</subscript></entry> + <entry>r<subscript>0</subscript></entry> + <entry>g<subscript>5</subscript></entry> + <entry>g<subscript>4</subscript></entry> + <entry>g<subscript>3</subscript></entry> + </row> + <row> + <entry></entry> + <entry></entry> + <entry></entry> + <entry>g<subscrip |