From c293a2e8acd08864eeca80550da298c96533a5bc Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 11 Feb 2020 15:13:53 -0500 Subject: [PATCH] fix: media: v4l2: abstract timeval handling in v4l2_buffer (v5.6) See upstream commit : commit 77cdffcb0bfb87fe3645894335cb8cb94917e6ac Author: Arnd Bergmann Date: Mon Dec 16 15:15:00 2019 +0100 media: v4l2: abstract timeval handling in v4l2_buffer As a preparation for adding 64-bit time_t support in the uapi, change the drivers to no longer care about the format of the timestamp field in struct v4l2_buffer. The v4l2_timeval_to_ns() function is no longer needed in the kernel after this, but there is userspace code relying on it to be part of the uapi header. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- instrumentation/events/lttng-module/v4l2.h | 27 ++++++++++++++++++++++ probes/lttng-probe-v4l2.c | 1 + 2 files changed, 28 insertions(+) diff --git a/instrumentation/events/lttng-module/v4l2.h b/instrumentation/events/lttng-module/v4l2.h index 37669853..6b7c78fd 100644 --- a/instrumentation/events/lttng-module/v4l2.h +++ b/instrumentation/events/lttng-module/v4l2.h @@ -7,6 +7,32 @@ #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +LTTNG_TRACEPOINT_EVENT_CLASS(v4l2_class, + + TP_PROTO(int minor, struct v4l2_buffer *buf), + + TP_ARGS(minor, buf), + + TP_FIELDS( + ctf_integer(int, minor, minor) + ctf_integer(u32, index, buf->index) + ctf_integer(u32, type, buf->type) + ctf_integer(u32, bytesused, buf->bytesused) + ctf_integer(u32, flags, buf->flags) + ctf_integer(u32, field, buf->field) + ctf_integer(s64, timestamp, v4l2_buffer_get_timestamp(buf)) + ctf_integer(u32, timecode_type, buf->timecode.type) + ctf_integer(u32, timecode_flags, buf->timecode.flags) + ctf_integer(u8, timecode_frames, buf->timecode.frames) + ctf_integer(u8, timecode_seconds, buf->timecode.seconds) + ctf_integer(u8, timecode_minutes, buf->timecode.minutes) + ctf_integer(u8, timecode_hours, buf->timecode.hours) + ctf_array(u8, timecode_userbits, buf->timecode.userbits, 4) + ctf_integer(u32, sequence, buf->sequence) + ) +) +#else LTTNG_TRACEPOINT_EVENT_CLASS(v4l2_class, TP_PROTO(int minor, struct v4l2_buffer *buf), @@ -31,6 +57,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(v4l2_class, ctf_integer(u32, sequence, buf->sequence) ) ) +#endif LTTNG_TRACEPOINT_EVENT_INSTANCE(v4l2_class, v4l2_dqbuf, diff --git a/probes/lttng-probe-v4l2.c b/probes/lttng-probe-v4l2.c index 064c656b..44665ecb 100644 --- a/probes/lttng-probe-v4l2.c +++ b/probes/lttng-probe-v4l2.c @@ -11,6 +11,7 @@ #include #include #include +#include #include /* * Create the tracepoint static inlines from the kernel to validate that our -- 2.34.1