media: add V4L2_BUF_FLAG_TIMESTAMP_UTC and V4L2_BUF_FLAG_TIMESTAMP_TAI.
Subsystems (2)
PATCH 1/1 media: add V4L2_BUF_FLAG_TIMESTAMP_UTC and V4L2_BUF_FLAG_TIMESTAMP_TAI.
Since V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN and V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC were added long ago, no other flag was introduced to indicate precisely the reference clock used for timestamps associated to v4l2 buffers. Add here the ability for drivers to use the realtime (= UTC) or TAI clock.
--- Documentation/userspace-api/media/v4l/buffer.rst | 14 ++++++++++++++ include/trace/events/v4l2.h | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 18 insertions(+)
Documentation/userspace-api/media/v4l/buffer.rst +14 -0
@@ -637,6 +637,20 @@ Buffer Flags - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, use :c:func:`clock_gettime`. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-UTC`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_UTC`` + - 0x00008000 + - The buffer timestamp has been taken from the ``CLOCK_REALTIME`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime`. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-TAI`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_TAI`` + - 0x0000a000 + - The buffer timestamp has been taken from the ``CLOCK_TAI`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime`. * .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: - ``V4L2_BUF_FLAG_TIMESTAMP_COPY``
include/trace/events/v4l2.h +2 -0
@@ -88,6 +88,8 @@ { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \ { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \ { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \ + { V4L2_BUF_FLAG_TIMESTAMP_UTC, "TIMESTAMP_UTC" }, \ + { V4L2_BUF_FLAG_TIMESTAMP_TAI, "TIMESTAMP_TAI" }, \ { V4L2_BUF_FLAG_LAST, "LAST" }) #define show_timecode_flags(flags) \
include/uapi/linux/videodev2.h +2 -0
@@ -1101,6 +1101,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv)#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000#define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 +#define V4L2_BUF_FLAG_TIMESTAMP_UTC 0x00008000 +#define V4L2_BUF_FLAG_TIMESTAMP_TAI 0x0000a000/* Timestamp sources. */ #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000#define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000
Signature · 1 line
1.8.4
Hi Philippe,
I'm cleaning up old patches and I decided to mark this as Obsolete since there has been no activity for a long time. If you still want to pursue this, then post a v2.
In any case, this patch can only be accepted if there is also a driver in the mainline kernel that uses it.
Regards,
Hans
Quoted 64 lines · Philippe De Muyter
Since
V4L2_BUF_FLAG_TIMESTAMP_UNKNOWNandV4L2_BUF_FLAG_TIMESTAMP_MONOTONICwere added long ago, no other flag was introduced to indicate precisely the reference clock used for timestamps associated to v4l2 buffers. Add here the ability for drivers to use the realtime (= UTC) or TAI clock.Signed-off-by Philippe De Muyter <[email protected]>--- Documentation/userspace-api/media/v4l/buffer.rst | 14 ++++++++++++++ include/trace/events/v4l2.h | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 18 insertions(+)Documentation/userspace-api/media/v4l/buffer.rst +14
-0@@ -637,6 +637,20 @@ Buffer Flags - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, use :c:func:`clock_gettime`. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-UTC`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_UTC`` + - 0x00008000 + - The buffer timestamp has been taken from the ``CLOCK_REALTIME`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime`. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-TAI`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_TAI`` + - 0x0000a000 + - The buffer timestamp has been taken from the ``CLOCK_TAI`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime`. * .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: - ``V4L2_BUF_FLAG_TIMESTAMP_COPY``include/trace/events/v4l2.h +2
-0@@ -88,6 +88,8 @@ { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \ { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \ { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \ + { V4L2_BUF_FLAG_TIMESTAMP_UTC, "TIMESTAMP_UTC" }, \ + { V4L2_BUF_FLAG_TIMESTAMP_TAI, "TIMESTAMP_TAI" }, \ { V4L2_BUF_FLAG_LAST, "LAST" }) #define show_timecode_flags(flags) \include/uapi/linux/videodev2.h +2
-0@@ -1101,6 +1101,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv)#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000#define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 +#define V4L2_BUF_FLAG_TIMESTAMP_UTC 0x00008000 +#define V4L2_BUF_FLAG_TIMESTAMP_TAI 0x0000a000/* Timestamp sources. */ #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000#define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000