aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-09-28 07:10:58 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:28:27 -0400
commit55093284fb6f9009a339e522773417bdd54ec144 (patch)
treec9c91afddcec2fd5890e003e19558f7aa2018979 /Documentation
parent21db3e07e1c6302556ae3215ddf0539f5d763b62 (diff)
[media] V4L: document the new VIDIOC_CREATE_BUFS and VIDIOC_PREPARE_BUF ioctl()s
[mchehab@redhat.com: remove emacs format crap at the end of the new files] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/DocBook/media/v4l/compat.xml3
-rw-r--r--Documentation/DocBook/media/v4l/io.xml27
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml2
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-create-bufs.xml139
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml88
5 files changed, 259 insertions, 0 deletions
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
index 91410b6e7e08..b68698f96e7f 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2486,6 +2486,9 @@ ioctls.</para>
2486 <listitem> 2486 <listitem>
2487 <para>Flash API. <xref linkend="flash-controls" /></para> 2487 <para>Flash API. <xref linkend="flash-controls" /></para>
2488 </listitem> 2488 </listitem>
2489 <listitem>
2490 <para>&VIDIOC-CREATE-BUFS; and &VIDIOC-PREPARE-BUF; ioctls.</para>
2491 </listitem>
2489 </itemizedlist> 2492 </itemizedlist>
2490 </section> 2493 </section>
2491 2494
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml
index c57d1ec6291c..3f47df1aa54a 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -927,6 +927,33 @@ ioctl is called.</entry>
927Applications set or clear this flag before calling the 927Applications set or clear this flag before calling the
928<constant>VIDIOC_QBUF</constant> ioctl.</entry> 928<constant>VIDIOC_QBUF</constant> ioctl.</entry>
929 </row> 929 </row>
930 <row>
931 <entry><constant>V4L2_BUF_FLAG_PREPARED</constant></entry>
932 <entry>0x0400</entry>
933 <entry>The buffer has been prepared for I/O and can be queued by the
934application. Drivers set or clear this flag when the
935<link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link
936 linkend="vidioc-qbuf">VIDIOC_PREPARE_BUF</link>, <link
937 linkend="vidioc-qbuf">VIDIOC_QBUF</link> or <link
938 linkend="vidioc-qbuf">VIDIOC_DQBUF</link> ioctl is called.</entry>
939 </row>
940 <row>
941 <entry><constant>V4L2_BUF_FLAG_NO_CACHE_INVALIDATE</constant></entry>
942 <entry>0x0400</entry>
943 <entry>Caches do not have to be invalidated for this buffer.
944Typically applications shall use this flag if the data captured in the buffer
945is not going to be touched by the CPU, instead the buffer will, probably, be
946passed on to a DMA-capable hardware unit for further processing or output.
947</entry>
948 </row>
949 <row>
950 <entry><constant>V4L2_BUF_FLAG_NO_CACHE_CLEAN</constant></entry>
951 <entry>0x0800</entry>
952 <entry>Caches do not have to be cleaned for this buffer.
953Typically applications shall use this flag for output buffers if the data
954in this buffer has not been created by the CPU but by some DMA-capable unit,
955in which case caches have not been used.</entry>
956 </row>
930 </tbody> 957 </tbody>
931 </tgroup> 958 </tgroup>
932 </table> 959 </table>
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index 40132c277647..2ab365c10fb9 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -469,6 +469,7 @@ and discussions on the V4L mailing list.</revremark>
469 &sub-close; 469 &sub-close;
470 &sub-ioctl; 470 &sub-ioctl;
471 <!-- All ioctls go here. --> 471 <!-- All ioctls go here. -->
472 &sub-create-bufs;
472 &sub-cropcap; 473 &sub-cropcap;
473 &sub-dbg-g-chip-ident; 474 &sub-dbg-g-chip-ident;
474 &sub-dbg-g-register; 475 &sub-dbg-g-register;
@@ -511,6 +512,7 @@ and discussions on the V4L mailing list.</revremark>
511 &sub-queryctrl; 512 &sub-queryctrl;
512 &sub-query-dv-preset; 513 &sub-query-dv-preset;
513 &sub-querystd; 514 &sub-querystd;
515 &sub-prepare-buf;
514 &sub-reqbufs; 516 &sub-reqbufs;
515 &sub-s-hw-freq-seek; 517 &sub-s-hw-freq-seek;
516 &sub-streamon; 518 &sub-streamon;
diff --git a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
new file mode 100644
index 000000000000..73ae8a6cd004
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
@@ -0,0 +1,139 @@
1<refentry id="vidioc-create-bufs">
2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_CREATE_BUFS</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>VIDIOC_CREATE_BUFS</refname>
9 <refpurpose>Create buffers for Memory Mapped or User Pointer I/O</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_create_buffers *<parameter>argp</parameter></paramdef>
19 </funcprototype>
20 </funcsynopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Arguments</title>
25
26 <variablelist>
27 <varlistentry>
28 <term><parameter>fd</parameter></term>
29 <listitem>
30 <para>&fd;</para>
31 </listitem>
32 </varlistentry>
33 <varlistentry>
34 <term><parameter>request</parameter></term>
35 <listitem>
36 <para>VIDIOC_CREATE_BUFS</para>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term><parameter>argp</parameter></term>
41 <listitem>
42 <para></para>
43 </listitem>
44 </varlistentry>
45 </variablelist>
46 </refsect1>
47
48 <refsect1>
49 <title>Description</title>
50
51 <para>This ioctl is used to create buffers for <link linkend="mmap">memory
52mapped</link> or <link linkend="userp">user pointer</link>
53I/O. It can be used as an alternative or in addition to the
54<constant>VIDIOC_REQBUFS</constant> ioctl, when a tighter control over buffers
55is required. This ioctl can be called multiple times to create buffers of
56different sizes.</para>
57
58 <para>To allocate device buffers applications initialize relevant fields of
59the <structname>v4l2_create_buffers</structname> structure. They set the
60<structfield>type</structfield> field in the
61<structname>v4l2_format</structname> structure, embedded in this
62structure, to the respective stream or buffer type.
63<structfield>count</structfield> must be set to the number of required buffers.
64<structfield>memory</structfield> specifies the required I/O method. The
65<structfield>format</structfield> field shall typically be filled in using
66either the <constant>VIDIOC_TRY_FMT</constant> or
67<constant>VIDIOC_G_FMT</constant> ioctl(). Additionally, applications can adjust
68<structfield>sizeimage</structfield> fields to fit their specific needs. The
69<structfield>reserved</structfield> array must be zeroed.</para>
70
71 <para>When the ioctl is called with a pointer to this structure the driver
72will attempt to allocate up to the requested number of buffers and store the
73actual number allocated and the starting index in the
74<structfield>count</structfield> and the <structfield>index</structfield> fields
75respectively. On return <structfield>count</structfield> can be smaller than
76the number requested. The driver may also increase buffer sizes if required,
77however, it will not update <structfield>sizeimage</structfield> field values.
78The user has to use <constant>VIDIOC_QUERYBUF</constant> to retrieve that
79information.</para>
80
81 <table pgwide="1" frame="none" id="v4l2-create-buffers">
82 <title>struct <structname>v4l2_create_buffers</structname></title>
83 <tgroup cols="3">
84 &cs-str;
85 <tbody valign="top">
86 <row>
87 <entry>__u32</entry>
88 <entry><structfield>index</structfield></entry>
89 <entry>The starting buffer index, returned by the driver.</entry>
90 </row>
91 <row>
92 <entry>__u32</entry>
93 <entry><structfield>count</structfield></entry>
94 <entry>The number of buffers requested or granted.</entry>
95 </row>
96 <row>
97 <entry>&v4l2-memory;</entry>
98 <entry><structfield>memory</structfield></entry>
99 <entry>Applications set this field to
100<constant>V4L2_MEMORY_MMAP</constant> or
101<constant>V4L2_MEMORY_USERPTR</constant>.</entry>
102 </row>
103 <row>
104 <entry>&v4l2-format;</entry>
105 <entry><structfield>format</structfield></entry>
106 <entry>Filled in by the application, preserved by the driver.</entry>
107 </row>
108 <row>
109 <entry>__u32</entry>
110 <entry><structfield>reserved</structfield>[8]</entry>
111 <entry>A place holder for future extensions.</entry>
112 </row>
113 </tbody>
114 </tgroup>
115 </table>
116 </refsect1>
117
118 <refsect1>
119 &return-value;
120
121 <variablelist>
122 <varlistentry>
123 <term><errorcode>ENOMEM</errorcode></term>
124 <listitem>
125 <para>No memory to allocate buffers for <link linkend="mmap">memory
126mapped</link> I/O.</para>
127 </listitem>
128 </varlistentry>
129 <varlistentry>
130 <term><errorcode>EINVAL</errorcode></term>
131 <listitem>
132 <para>The buffer type (<structfield>type</structfield> field) or the
133requested I/O method (<structfield>memory</structfield>) is not
134supported.</para>
135 </listitem>
136 </varlistentry>
137 </variablelist>
138 </refsect1>
139</refentry>
diff --git a/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml b/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml
new file mode 100644
index 000000000000..7bde698760e4
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml
@@ -0,0 +1,88 @@
1<refentry id="vidioc-prepare-buf">
2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_PREPARE_BUF</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>VIDIOC_PREPARE_BUF</refname>
9 <refpurpose>Prepare a buffer for I/O</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef>
19 </funcprototype>
20 </funcsynopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Arguments</title>
25
26 <variablelist>
27 <varlistentry>
28 <term><parameter>fd</parameter></term>
29 <listitem>
30 <para>&fd;</para>
31 </listitem>
32 </varlistentry>
33 <varlistentry>
34 <term><parameter>request</parameter></term>
35 <listitem>
36 <para>VIDIOC_PREPARE_BUF</para>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term><parameter>argp</parameter></term>
41 <listitem>
42 <para></para>
43 </listitem>
44 </varlistentry>
45 </variablelist>
46 </refsect1>
47
48 <refsect1>
49 <title>Description</title>
50
51 <para>Applications can optionally call the
52<constant>VIDIOC_PREPARE_BUF</constant> ioctl to pass ownership of the buffer
53to the driver before actually enqueuing it, using the
54<constant>VIDIOC_QBUF</constant> ioctl, and to prepare it for future I/O.
55Such preparations may include cache invalidation or cleaning. Performing them
56in advance saves time during the actual I/O. In case such cache operations are
57not required, the application can use one of
58<constant>V4L2_BUF_FLAG_NO_CACHE_INVALIDATE</constant> and
59<constant>V4L2_BUF_FLAG_NO_CACHE_CLEAN</constant> flags to skip the respective
60step.</para>
61
62 <para>The <structname>v4l2_buffer</structname> structure is
63specified in <xref linkend="buffer" />.</para>
64 </refsect1>
65
66 <refsect1>
67 &return-value;
68
69 <variablelist>
70 <varlistentry>
71 <term><errorcode>EBUSY</errorcode></term>
72 <listitem>
73 <para>File I/O is in progress.</para>
74 </listitem>
75 </varlistentry>
76 <varlistentry>
77 <term><errorcode>EINVAL</errorcode></term>
78 <listitem>
79 <para>The buffer <structfield>type</structfield> is not
80supported, or the <structfield>index</structfield> is out of bounds,
81or no buffers have been allocated yet, or the
82<structfield>userptr</structfield> or
83<structfield>length</structfield> are invalid.</para>
84 </listitem>
85 </varlistentry>
86 </variablelist>
87 </refsect1>
88</refentry>