diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-10-21 15:02:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-12-21 07:44:52 -0500 |
commit | 1202ecdc24fc88d5b144824f55ec9c8899591caf (patch) | |
tree | 97a4925b3ba400fbcd20b72ea81818a3bf62688f | |
parent | 1b5901331ff3af4bdc1b998a056a248c9924e2d1 (diff) |
[media] v4l: Define video buffer flags for timestamp types
Define video buffer flags for different timestamp types. Everything up to
now have used either realtime clock or monotonic clock, without a way to
tell which clock the timestamp was taken from.
Also document that the clock source of the timestamp in the timestamp field
depends on buffer flags.
[mchehab@redhat.com: fix a few wrong references to Kernel 3.8 - as this patch
is meant for 3.9]
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | Documentation/DocBook/media/v4l/compat.xml | 12 | ||||
-rw-r--r-- | Documentation/DocBook/media/v4l/io.xml | 53 | ||||
-rw-r--r-- | Documentation/DocBook/media/v4l/v4l2.xml | 12 | ||||
-rw-r--r-- | include/uapi/linux/videodev2.h | 4 |
4 files changed, 69 insertions, 12 deletions
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 3dd9e78815d1..ebd2bfd1ee8e 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml | |||
@@ -2477,6 +2477,18 @@ that used it. It was originally scheduled for removal in 2.6.35. | |||
2477 | </orderedlist> | 2477 | </orderedlist> |
2478 | </section> | 2478 | </section> |
2479 | 2479 | ||
2480 | <section> | ||
2481 | <title>V4L2 in Linux 3.9</title> | ||
2482 | <orderedlist> | ||
2483 | <listitem> | ||
2484 | <para>Added timestamp types to | ||
2485 | <structfield>flags</structfield> field in | ||
2486 | <structname>v4l2_buffer</structname>. See <xref | ||
2487 | linkend="buffer-flags" />.</para> | ||
2488 | </listitem> | ||
2489 | </orderedlist> | ||
2490 | </section> | ||
2491 | |||
2480 | <section id="other"> | 2492 | <section id="other"> |
2481 | <title>Relation of V4L2 to other Linux multimedia APIs</title> | 2493 | <title>Relation of V4L2 to other Linux multimedia APIs</title> |
2482 | 2494 | ||
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index 388a34032653..09e8dcf5e9c4 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml | |||
@@ -741,17 +741,19 @@ applications when an output stream.</entry> | |||
741 | <entry>struct timeval</entry> | 741 | <entry>struct timeval</entry> |
742 | <entry><structfield>timestamp</structfield></entry> | 742 | <entry><structfield>timestamp</structfield></entry> |
743 | <entry></entry> | 743 | <entry></entry> |
744 | <entry><para>For input streams this is the | 744 | <entry><para>For input streams this is time when the first data |
745 | system time (as returned by the <function>gettimeofday()</function> | 745 | byte was captured, as returned by the |
746 | function) when the first data byte was captured. For output streams | 746 | <function>clock_gettime()</function> function for the relevant |
747 | the data will not be displayed before this time, secondary to the | 747 | clock id; see <constant>V4L2_BUF_FLAG_TIMESTAMP_*</constant> in |
748 | nominal frame rate determined by the current video standard in | 748 | <xref linkend="buffer-flags" />. For output streams the data |
749 | enqueued order. Applications can for example zero this field to | 749 | will not be displayed before this time, secondary to the nominal |
750 | display frames as soon as possible. The driver stores the time at | 750 | frame rate determined by the current video standard in enqueued |
751 | which the first data byte was actually sent out in the | 751 | order. Applications can for example zero this field to display |
752 | <structfield>timestamp</structfield> field. This permits | 752 | frames as soon as possible. The driver stores the time at which |
753 | applications to monitor the drift between the video and system | 753 | the first data byte was actually sent out in the |
754 | clock.</para></entry> | 754 | <structfield>timestamp</structfield> field. This permits |
755 | applications to monitor the drift between the video and system | ||
756 | clock.</para></entry> | ||
755 | </row> | 757 | </row> |
756 | <row> | 758 | <row> |
757 | <entry>&v4l2-timecode;</entry> | 759 | <entry>&v4l2-timecode;</entry> |
@@ -1114,6 +1116,35 @@ Typically applications shall use this flag for output buffers if the data | |||
1114 | in this buffer has not been created by the CPU but by some DMA-capable unit, | 1116 | in this buffer has not been created by the CPU but by some DMA-capable unit, |
1115 | in which case caches have not been used.</entry> | 1117 | in which case caches have not been used.</entry> |
1116 | </row> | 1118 | </row> |
1119 | <row> | ||
1120 | <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_MASK</constant></entry> | ||
1121 | <entry>0xe000</entry> | ||
1122 | <entry>Mask for timestamp types below. To test the | ||
1123 | timestamp type, mask out bits not belonging to timestamp | ||
1124 | type by performing a logical and operation with buffer | ||
1125 | flags and timestamp mask.</entry> | ||
1126 | </row> | ||
1127 | <row> | ||
1128 | <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN</constant></entry> | ||
1129 | <entry>0x0000</entry> | ||
1130 | <entry>Unknown timestamp type. This type is used by | ||
1131 | drivers before Linux 3.9 and may be either monotonic (see | ||
1132 | below) or realtime (wall clock). Monotonic clock has been | ||
1133 | favoured in embedded systems whereas most of the drivers | ||
1134 | use the realtime clock. Either kinds of timestamps are | ||
1135 | available in user space via | ||
1136 | <function>clock_gettime(2)</function> using clock IDs | ||
1137 | <constant>CLOCK_MONOTONIC</constant> and | ||
1138 | <constant>CLOCK_REALTIME</constant>, respectively.</entry> | ||
1139 | </row> | ||
1140 | <row> | ||
1141 | <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC</constant></entry> | ||
1142 | <entry>0x2000</entry> | ||
1143 | <entry>The buffer timestamp has been taken from the | ||
1144 | <constant>CLOCK_MONOTONIC</constant> clock. To access the | ||
1145 | same clock outside V4L2, use | ||
1146 | <function>clock_gettime(2)</function> .</entry> | ||
1147 | </row> | ||
1117 | </tbody> | 1148 | </tbody> |
1118 | </tgroup> | 1149 | </tgroup> |
1119 | </table> | 1150 | </table> |
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 4d110b1ad3e9..8fe29427c8e4 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml | |||
@@ -140,6 +140,16 @@ structs, ioctls) must be noted in more detail in the history chapter | |||
140 | applications. --> | 140 | applications. --> |
141 | 141 | ||
142 | <revision> | 142 | <revision> |
143 | <revnumber>3.9</revnumber> | ||
144 | <date>2012-12-03</date> | ||
145 | <authorinitials>sa</authorinitials> | ||
146 | <revremark>Added timestamp types to | ||
147 | <structname>v4l2_buffer</structname>, see <xref | ||
148 | linkend="buffer-flags" />. | ||
149 | </revremark> | ||
150 | </revision> | ||
151 | |||
152 | <revision> | ||
143 | <revnumber>3.6</revnumber> | 153 | <revnumber>3.6</revnumber> |
144 | <date>2012-07-02</date> | 154 | <date>2012-07-02</date> |
145 | <authorinitials>hv</authorinitials> | 155 | <authorinitials>hv</authorinitials> |
@@ -472,7 +482,7 @@ and discussions on the V4L mailing list.</revremark> | |||
472 | </partinfo> | 482 | </partinfo> |
473 | 483 | ||
474 | <title>Video for Linux Two API Specification</title> | 484 | <title>Video for Linux Two API Specification</title> |
475 | <subtitle>Revision 3.6</subtitle> | 485 | <subtitle>Revision 3.9</subtitle> |
476 | 486 | ||
477 | <chapter id="common"> | 487 | <chapter id="common"> |
478 | &sub-common; | 488 | &sub-common; |
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 39d2cecdf38c..94cbe26e9f00 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h | |||
@@ -701,6 +701,10 @@ struct v4l2_buffer { | |||
701 | /* Cache handling flags */ | 701 | /* Cache handling flags */ |
702 | #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 | 702 | #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 |
703 | #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 | 703 | #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 |
704 | /* Timestamp type */ | ||
705 | #define V4L2_BUF_FLAG_TIMESTAMP_MASK 0xe000 | ||
706 | #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x0000 | ||
707 | #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x2000 | ||
704 | 708 | ||
705 | /** | 709 | /** |
706 | * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor | 710 | * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor |