diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-02-20 07:41:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:11:05 -0500 |
commit | 995f5fefb0c6abba3688b3aadf40e422b64b814a (patch) | |
tree | 560d626bee9f74cf64c96e1d9ff93bfeb230c686 /Documentation | |
parent | 340dde817a4f68af79453ed295ca0e8de7232669 (diff) |
V4L/DVB: media-spec: Fix documentation mistakes regarding I/O streaming
The media spec contains several errors in the description of the
I/O streaming ioctls, in particular with respect to the userptr
I/O method.
The most important change is that you really need to set count
and index in v4l2_requestbuffer and v4l2_buffer when dealing with
user pointer streaming.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/v4l/io.xml | 3 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-qbuf.xml | 40 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-querybuf.xml | 7 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-reqbufs.xml | 36 |
4 files changed, 42 insertions, 44 deletions
diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml index f92f24323b2a..e870330cbf77 100644 --- a/Documentation/DocBook/v4l/io.xml +++ b/Documentation/DocBook/v4l/io.xml | |||
@@ -589,7 +589,8 @@ number of a video input as in &v4l2-input; field | |||
589 | <entry></entry> | 589 | <entry></entry> |
590 | <entry>A place holder for future extensions and custom | 590 | <entry>A place holder for future extensions and custom |
591 | (driver defined) buffer types | 591 | (driver defined) buffer types |
592 | <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher.</entry> | 592 | <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher. Applications |
593 | should set this to 0.</entry> | ||
593 | </row> | 594 | </row> |
594 | </tbody> | 595 | </tbody> |
595 | </tgroup> | 596 | </tgroup> |
diff --git a/Documentation/DocBook/v4l/vidioc-qbuf.xml b/Documentation/DocBook/v4l/vidioc-qbuf.xml index 187081778154..b843bd7b3897 100644 --- a/Documentation/DocBook/v4l/vidioc-qbuf.xml +++ b/Documentation/DocBook/v4l/vidioc-qbuf.xml | |||
@@ -54,12 +54,10 @@ to enqueue an empty (capturing) or filled (output) buffer in the | |||
54 | driver's incoming queue. The semantics depend on the selected I/O | 54 | driver's incoming queue. The semantics depend on the selected I/O |
55 | method.</para> | 55 | method.</para> |
56 | 56 | ||
57 | <para>To enqueue a <link linkend="mmap">memory mapped</link> | 57 | <para>To enqueue a buffer applications set the <structfield>type</structfield> |
58 | buffer applications set the <structfield>type</structfield> field of a | 58 | field of a &v4l2-buffer; to the same buffer type as was previously used |
59 | &v4l2-buffer; to the same buffer type as previously &v4l2-format; | 59 | with &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; |
60 | <structfield>type</structfield> and &v4l2-requestbuffers; | 60 | <structfield>type</structfield>. Applications must also set the |
61 | <structfield>type</structfield>, the <structfield>memory</structfield> | ||
62 | field to <constant>V4L2_MEMORY_MMAP</constant> and the | ||
63 | <structfield>index</structfield> field. Valid index numbers range from | 61 | <structfield>index</structfield> field. Valid index numbers range from |
64 | zero to the number of buffers allocated with &VIDIOC-REQBUFS; | 62 | zero to the number of buffers allocated with &VIDIOC-REQBUFS; |
65 | (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. The | 63 | (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. The |
@@ -70,8 +68,19 @@ intended for output (<structfield>type</structfield> is | |||
70 | <constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant>) applications must also | 68 | <constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant>) applications must also |
71 | initialize the <structfield>bytesused</structfield>, | 69 | initialize the <structfield>bytesused</structfield>, |
72 | <structfield>field</structfield> and | 70 | <structfield>field</structfield> and |
73 | <structfield>timestamp</structfield> fields. See <xref | 71 | <structfield>timestamp</structfield> fields, see <xref |
74 | linkend="buffer" /> for details. When | 72 | linkend="buffer" /> for details. |
73 | Applications must also set <structfield>flags</structfield> to 0. If a driver | ||
74 | supports capturing from specific video inputs and you want to specify a video | ||
75 | input, then <structfield>flags</structfield> should be set to | ||
76 | <constant>V4L2_BUF_FLAG_INPUT</constant> and the field | ||
77 | <structfield>input</structfield> must be initialized to the desired input. | ||
78 | The <structfield>reserved</structfield> field must be set to 0. | ||
79 | </para> | ||
80 | |||
81 | <para>To enqueue a <link linkend="mmap">memory mapped</link> | ||
82 | buffer applications set the <structfield>memory</structfield> | ||
83 | field to <constant>V4L2_MEMORY_MMAP</constant>. When | ||
75 | <constant>VIDIOC_QBUF</constant> is called with a pointer to this | 84 | <constant>VIDIOC_QBUF</constant> is called with a pointer to this |
76 | structure the driver sets the | 85 | structure the driver sets the |
77 | <constant>V4L2_BUF_FLAG_MAPPED</constant> and | 86 | <constant>V4L2_BUF_FLAG_MAPPED</constant> and |
@@ -81,14 +90,10 @@ structure the driver sets the | |||
81 | &EINVAL;.</para> | 90 | &EINVAL;.</para> |
82 | 91 | ||
83 | <para>To enqueue a <link linkend="userp">user pointer</link> | 92 | <para>To enqueue a <link linkend="userp">user pointer</link> |
84 | buffer applications set the <structfield>type</structfield> field of a | 93 | buffer applications set the <structfield>memory</structfield> |
85 | &v4l2-buffer; to the same buffer type as previously &v4l2-format; | 94 | field to <constant>V4L2_MEMORY_USERPTR</constant>, the |
86 | <structfield>type</structfield> and &v4l2-requestbuffers; | ||
87 | <structfield>type</structfield>, the <structfield>memory</structfield> | ||
88 | field to <constant>V4L2_MEMORY_USERPTR</constant> and the | ||
89 | <structfield>m.userptr</structfield> field to the address of the | 95 | <structfield>m.userptr</structfield> field to the address of the |
90 | buffer and <structfield>length</structfield> to its size. When the | 96 | buffer and <structfield>length</structfield> to its size. |
91 | buffer is intended for output additional fields must be set as above. | ||
92 | When <constant>VIDIOC_QBUF</constant> is called with a pointer to this | 97 | When <constant>VIDIOC_QBUF</constant> is called with a pointer to this |
93 | structure the driver sets the <constant>V4L2_BUF_FLAG_QUEUED</constant> | 98 | structure the driver sets the <constant>V4L2_BUF_FLAG_QUEUED</constant> |
94 | flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and | 99 | flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and |
@@ -96,13 +101,14 @@ flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and | |||
96 | <structfield>flags</structfield> field, or it returns an error code. | 101 | <structfield>flags</structfield> field, or it returns an error code. |
97 | This ioctl locks the memory pages of the buffer in physical memory, | 102 | This ioctl locks the memory pages of the buffer in physical memory, |
98 | they cannot be swapped out to disk. Buffers remain locked until | 103 | they cannot be swapped out to disk. Buffers remain locked until |
99 | dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl are | 104 | dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is |
100 | called, or until the device is closed.</para> | 105 | called, or until the device is closed.</para> |
101 | 106 | ||
102 | <para>Applications call the <constant>VIDIOC_DQBUF</constant> | 107 | <para>Applications call the <constant>VIDIOC_DQBUF</constant> |
103 | ioctl to dequeue a filled (capturing) or displayed (output) buffer | 108 | ioctl to dequeue a filled (capturing) or displayed (output) buffer |
104 | from the driver's outgoing queue. They just set the | 109 | from the driver's outgoing queue. They just set the |
105 | <structfield>type</structfield> and <structfield>memory</structfield> | 110 | <structfield>type</structfield>, <structfield>memory</structfield> |
111 | and <structfield>reserved</structfield> | ||
106 | fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> | 112 | fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> |
107 | is called with a pointer to this structure the driver fills the | 113 | is called with a pointer to this structure the driver fills the |
108 | remaining fields or returns an error code.</para> | 114 | remaining fields or returns an error code.</para> |
diff --git a/Documentation/DocBook/v4l/vidioc-querybuf.xml b/Documentation/DocBook/v4l/vidioc-querybuf.xml index d834993e6191..e649805a4908 100644 --- a/Documentation/DocBook/v4l/vidioc-querybuf.xml +++ b/Documentation/DocBook/v4l/vidioc-querybuf.xml | |||
@@ -54,12 +54,13 @@ buffer at any time after buffers have been allocated with the | |||
54 | &VIDIOC-REQBUFS; ioctl.</para> | 54 | &VIDIOC-REQBUFS; ioctl.</para> |
55 | 55 | ||
56 | <para>Applications set the <structfield>type</structfield> field | 56 | <para>Applications set the <structfield>type</structfield> field |
57 | of a &v4l2-buffer; to the same buffer type as previously | 57 | of a &v4l2-buffer; to the same buffer type as was previously used with |
58 | &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; | 58 | &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; |
59 | <structfield>type</structfield>, and the <structfield>index</structfield> | 59 | <structfield>type</structfield>, and the <structfield>index</structfield> |
60 | field. Valid index numbers range from zero | 60 | field. Valid index numbers range from zero |
61 | to the number of buffers allocated with &VIDIOC-REQBUFS; | 61 | to the number of buffers allocated with &VIDIOC-REQBUFS; |
62 | (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. | 62 | (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. |
63 | The <structfield>reserved</structfield> field should to set to 0. | ||
63 | After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to | 64 | After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to |
64 | this structure drivers return an error code or fill the rest of | 65 | this structure drivers return an error code or fill the rest of |
65 | the structure.</para> | 66 | the structure.</para> |
@@ -68,8 +69,8 @@ the structure.</para> | |||
68 | <constant>V4L2_BUF_FLAG_MAPPED</constant>, | 69 | <constant>V4L2_BUF_FLAG_MAPPED</constant>, |
69 | <constant>V4L2_BUF_FLAG_QUEUED</constant> and | 70 | <constant>V4L2_BUF_FLAG_QUEUED</constant> and |
70 | <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The | 71 | <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The |
71 | <structfield>memory</structfield> field will be set to | 72 | <structfield>memory</structfield> field will be set to the current |
72 | <constant>V4L2_MEMORY_MMAP</constant>, the <structfield>m.offset</structfield> | 73 | I/O method, the <structfield>m.offset</structfield> |
73 | contains the offset of the buffer from the start of the device memory, | 74 | contains the offset of the buffer from the start of the device memory, |
74 | the <structfield>length</structfield> field its size. The driver may | 75 | the <structfield>length</structfield> field its size. The driver may |
75 | or may not set the remaining fields and flags, they are meaningless in | 76 | or may not set the remaining fields and flags, they are meaningless in |
diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml index bab38084454f..1c0816372074 100644 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/v4l/vidioc-reqbufs.xml | |||
@@ -54,23 +54,23 @@ I/O. Memory mapped buffers are located in device memory and must be | |||
54 | allocated with this ioctl before they can be mapped into the | 54 | allocated with this ioctl before they can be mapped into the |
55 | application's address space. User buffers are allocated by | 55 | application's address space. User buffers are allocated by |
56 | applications themselves, and this ioctl is merely used to switch the | 56 | applications themselves, and this ioctl is merely used to switch the |
57 | driver into user pointer I/O mode.</para> | 57 | driver into user pointer I/O mode and to setup some internal structures.</para> |
58 | 58 | ||
59 | <para>To allocate device buffers applications initialize three | 59 | <para>To allocate device buffers applications initialize all |
60 | fields of a <structname>v4l2_requestbuffers</structname> structure. | 60 | fields of the <structname>v4l2_requestbuffers</structname> structure. |
61 | They set the <structfield>type</structfield> field to the respective | 61 | They set the <structfield>type</structfield> field to the respective |
62 | stream or buffer type, the <structfield>count</structfield> field to | 62 | stream or buffer type, the <structfield>count</structfield> field to |
63 | the desired number of buffers, and <structfield>memory</structfield> | 63 | the desired number of buffers, <structfield>memory</structfield> |
64 | must be set to <constant>V4L2_MEMORY_MMAP</constant>. When the ioctl | 64 | must be set to the requested I/O method and the reserved array |
65 | is called with a pointer to this structure the driver attempts to | 65 | must be zeroed. When the ioctl |
66 | allocate the requested number of buffers and stores the actual number | 66 | is called with a pointer to this structure the driver will attempt to allocate |
67 | the requested number of buffers and it stores the actual number | ||
67 | allocated in the <structfield>count</structfield> field. It can be | 68 | allocated in the <structfield>count</structfield> field. It can be |
68 | smaller than the number requested, even zero, when the driver runs out | 69 | smaller than the number requested, even zero, when the driver runs out |
69 | of free memory. A larger number is possible when the driver requires | 70 | of free memory. A larger number is also possible when the driver requires |
70 | more buffers to function correctly.<footnote> | 71 | more buffers to function correctly. For example video output requires at least two buffers, |
71 | <para>For example video output requires at least two buffers, | ||
72 | one displayed and one filled by the application.</para> | 72 | one displayed and one filled by the application.</para> |
73 | </footnote> When memory mapping I/O is not supported the ioctl | 73 | <para>When the I/O method is not supported the ioctl |
74 | returns an &EINVAL;.</para> | 74 | returns an &EINVAL;.</para> |
75 | 75 | ||
76 | <para>Applications can call <constant>VIDIOC_REQBUFS</constant> | 76 | <para>Applications can call <constant>VIDIOC_REQBUFS</constant> |
@@ -81,14 +81,6 @@ in progress, an implicit &VIDIOC-STREAMOFF;. <!-- mhs: I see no | |||
81 | reason why munmap()ping one or even all buffers must imply | 81 | reason why munmap()ping one or even all buffers must imply |
82 | streamoff.--></para> | 82 | streamoff.--></para> |
83 | 83 | ||
84 | <para>To negotiate user pointer I/O, applications initialize only | ||
85 | the <structfield>type</structfield> field and set | ||
86 | <structfield>memory</structfield> to | ||
87 | <constant>V4L2_MEMORY_USERPTR</constant>. When the ioctl is called | ||
88 | with a pointer to this structure the driver prepares for user pointer | ||
89 | I/O, when this I/O method is not supported the ioctl returns an | ||
90 | &EINVAL;.</para> | ||
91 | |||
92 | <table pgwide="1" frame="none" id="v4l2-requestbuffers"> | 84 | <table pgwide="1" frame="none" id="v4l2-requestbuffers"> |
93 | <title>struct <structname>v4l2_requestbuffers</structname></title> | 85 | <title>struct <structname>v4l2_requestbuffers</structname></title> |
94 | <tgroup cols="3"> | 86 | <tgroup cols="3"> |
@@ -97,9 +89,7 @@ I/O, when this I/O method is not supported the ioctl returns an | |||
97 | <row> | 89 | <row> |
98 | <entry>__u32</entry> | 90 | <entry>__u32</entry> |
99 | <entry><structfield>count</structfield></entry> | 91 | <entry><structfield>count</structfield></entry> |
100 | <entry>The number of buffers requested or granted. This | 92 | <entry>The number of buffers requested or granted.</entry> |
101 | field is only used when <structfield>memory</structfield> is set to | ||
102 | <constant>V4L2_MEMORY_MMAP</constant>.</entry> | ||
103 | </row> | 93 | </row> |
104 | <row> | 94 | <row> |
105 | <entry>&v4l2-buf-type;</entry> | 95 | <entry>&v4l2-buf-type;</entry> |
@@ -120,7 +110,7 @@ as the &v4l2-format; <structfield>type</structfield> field. See <xref | |||
120 | <entry><structfield>reserved</structfield>[2]</entry> | 110 | <entry><structfield>reserved</structfield>[2]</entry> |
121 | <entry>A place holder for future extensions and custom | 111 | <entry>A place holder for future extensions and custom |
122 | (driver defined) buffer types <constant>V4L2_BUF_TYPE_PRIVATE</constant> and | 112 | (driver defined) buffer types <constant>V4L2_BUF_TYPE_PRIVATE</constant> and |
123 | higher.</entry> | 113 | higher. This array should be zeroed by applications.</entry> |
124 | </row> | 114 | </row> |
125 | </tbody> | 115 | </tbody> |
126 | </tgroup> | 116 | </tgroup> |