Commit 91235537 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] DocBook media: improve the poll() documentation

The poll documentation was incomplete: document how events (POLLPRI)
are handled and fix the documentation of what poll does for display devices
and streaming I/O.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent acf92046
...@@ -29,9 +29,12 @@ can suspend execution until the driver has captured data or is ready ...@@ -29,9 +29,12 @@ can suspend execution until the driver has captured data or is ready
to accept data for output.</para> to accept data for output.</para>
<para>When streaming I/O has been negotiated this function waits <para>When streaming I/O has been negotiated this function waits
until a buffer has been filled or displayed and can be dequeued with until a buffer has been filled by the capture device and can be dequeued
the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing with the &VIDIOC-DQBUF; ioctl. For output devices this function waits
queue of the driver the function returns immediately.</para> until the device is ready to accept a new buffer to be queued up with
the &VIDIOC-QBUF; ioctl for display. When buffers are already in the outgoing
queue of the driver (capture) or the incoming queue isn't full (display)
the function returns immediately.</para>
<para>On success <function>poll()</function> returns the number of <para>On success <function>poll()</function> returns the number of
file descriptors that have been selected (that is, file descriptors file descriptors that have been selected (that is, file descriptors
...@@ -57,6 +60,10 @@ as well, but it sets the <constant>POLLOUT</constant> and ...@@ -57,6 +60,10 @@ as well, but it sets the <constant>POLLOUT</constant> and
<constant>POLLWRNORM</constant> flags in the <structfield>revents</structfield> <constant>POLLWRNORM</constant> flags in the <structfield>revents</structfield>
field.</para> field.</para>
<para>If an event occurred (see &VIDIOC-DQEVENT;) then
<constant>POLLPRI</constant> will be set in the <structfield>revents</structfield>
field and <function>poll()</function> will return.</para>
<para>When use of the <function>read()</function> function has <para>When use of the <function>read()</function> function has
been negotiated and the driver does not capture yet, the been negotiated and the driver does not capture yet, the
<function>poll</function> function starts capturing. When that fails <function>poll</function> function starts capturing. When that fails
...@@ -66,10 +73,18 @@ continuously (as opposed to, for example, still images) the function ...@@ -66,10 +73,18 @@ continuously (as opposed to, for example, still images) the function
may return immediately.</para> may return immediately.</para>
<para>When use of the <function>write()</function> function has <para>When use of the <function>write()</function> function has
been negotiated the <function>poll</function> function just waits been negotiated and the driver does not stream yet, the
<function>poll</function> function starts streaming. When that fails
it returns a <constant>POLLERR</constant> as above. Otherwise it waits
until the driver is ready for a non-blocking until the driver is ready for a non-blocking
<function>write()</function> call.</para> <function>write()</function> call.</para>
<para>If the caller is only interested in events (just
<constant>POLLPRI</constant> is set in the <structfield>events</structfield>
field), then <function>poll()</function> will <emphasis>not</emphasis>
start streaming if the driver does not stream yet. This makes it
possible to just poll for events and not for buffers.</para>
<para>All drivers implementing the <function>read()</function> or <para>All drivers implementing the <function>read()</function> or
<function>write()</function> function or streaming I/O must also <function>write()</function> function or streaming I/O must also
support the <function>poll()</function> function.</para> support the <function>poll()</function> function.</para>
......
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