[media] v4l2-dev: use event class to deduplicate v4l2 trace events
[linux-2.6/btrfs-unstable.git] / include / trace / events / v4l2.h
blob4c88a3241c18deee3cd8c7bd412eb6dd299a8654
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM v4l2
4 #if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_V4L2_H
7 #include <linux/tracepoint.h>
9 /* Enums require being exported to userspace, for user tool parsing */
10 #undef EM
11 #undef EMe
12 #define EM(a, b) TRACE_DEFINE_ENUM(a);
13 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
15 #define show_type(type) \
16 __print_symbolic(type, SHOW_TYPE)
18 #define SHOW_TYPE \
19 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" ) \
20 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" ) \
21 EM( V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" ) \
22 EM( V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" ) \
23 EM( V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" ) \
24 EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" ) \
25 EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" ) \
26 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \
27 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \
28 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \
29 EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \
30 EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" )
32 SHOW_TYPE
34 #define show_field(field) \
35 __print_symbolic(field, SHOW_FIELD)
37 #define SHOW_FIELD \
38 EM( V4L2_FIELD_ANY, "ANY" ) \
39 EM( V4L2_FIELD_NONE, "NONE" ) \
40 EM( V4L2_FIELD_TOP, "TOP" ) \
41 EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \
42 EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \
43 EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \
44 EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \
45 EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \
46 EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \
47 EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" )
49 SHOW_FIELD
52 * Now redefine the EM() and EMe() macros to map the enums to the strings
53 * that will be printed in the output.
55 #undef EM
56 #undef EMe
57 #define EM(a, b) {a, b},
58 #define EMe(a, b) {a, b}
60 /* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
62 #define show_timecode_type(type) \
63 __print_symbolic(type, \
64 { V4L2_TC_TYPE_24FPS, "24FPS" }, \
65 { V4L2_TC_TYPE_25FPS, "25FPS" }, \
66 { V4L2_TC_TYPE_30FPS, "30FPS" }, \
67 { V4L2_TC_TYPE_50FPS, "50FPS" }, \
68 { V4L2_TC_TYPE_60FPS, "60FPS" })
70 #define show_flags(flags) \
71 __print_flags(flags, "|", \
72 { V4L2_BUF_FLAG_MAPPED, "MAPPED" }, \
73 { V4L2_BUF_FLAG_QUEUED, "QUEUED" }, \
74 { V4L2_BUF_FLAG_DONE, "DONE" }, \
75 { V4L2_BUF_FLAG_KEYFRAME, "KEYFRAME" }, \
76 { V4L2_BUF_FLAG_PFRAME, "PFRAME" }, \
77 { V4L2_BUF_FLAG_BFRAME, "BFRAME" }, \
78 { V4L2_BUF_FLAG_ERROR, "ERROR" }, \
79 { V4L2_BUF_FLAG_TIMECODE, "TIMECODE" }, \
80 { V4L2_BUF_FLAG_PREPARED, "PREPARED" }, \
81 { V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \
82 { V4L2_BUF_FLAG_NO_CACHE_CLEAN, "NO_CACHE_CLEAN" }, \
83 { V4L2_BUF_FLAG_TIMESTAMP_MASK, "TIMESTAMP_MASK" }, \
84 { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \
85 { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
86 { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \
87 { V4L2_BUF_FLAG_LAST, "LAST" })
89 #define show_timecode_flags(flags) \
90 __print_flags(flags, "|", \
91 { V4L2_TC_FLAG_DROPFRAME, "DROPFRAME" }, \
92 { V4L2_TC_FLAG_COLORFRAME, "COLORFRAME" }, \
93 { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \
94 { V4L2_TC_USERBITS_8BITCHARS, "USERBITS_8BITCHARS" })
96 DECLARE_EVENT_CLASS(v4l2_event_class,
97 TP_PROTO(int minor, struct v4l2_buffer *buf),
99 TP_ARGS(minor, buf),
101 TP_STRUCT__entry(
102 __field(int, minor)
103 __field(u32, index)
104 __field(u32, type)
105 __field(u32, bytesused)
106 __field(u32, flags)
107 __field(u32, field)
108 __field(s64, timestamp)
109 __field(u32, timecode_type)
110 __field(u32, timecode_flags)
111 __field(u8, timecode_frames)
112 __field(u8, timecode_seconds)
113 __field(u8, timecode_minutes)
114 __field(u8, timecode_hours)
115 __field(u8, timecode_userbits0)
116 __field(u8, timecode_userbits1)
117 __field(u8, timecode_userbits2)
118 __field(u8, timecode_userbits3)
119 __field(u32, sequence)
122 TP_fast_assign(
123 __entry->minor = minor;
124 __entry->index = buf->index;
125 __entry->type = buf->type;
126 __entry->bytesused = buf->bytesused;
127 __entry->flags = buf->flags;
128 __entry->field = buf->field;
129 __entry->timestamp = timeval_to_ns(&buf->timestamp);
130 __entry->timecode_type = buf->timecode.type;
131 __entry->timecode_flags = buf->timecode.flags;
132 __entry->timecode_frames = buf->timecode.frames;
133 __entry->timecode_seconds = buf->timecode.seconds;
134 __entry->timecode_minutes = buf->timecode.minutes;
135 __entry->timecode_hours = buf->timecode.hours;
136 __entry->timecode_userbits0 = buf->timecode.userbits[0];
137 __entry->timecode_userbits1 = buf->timecode.userbits[1];
138 __entry->timecode_userbits2 = buf->timecode.userbits[2];
139 __entry->timecode_userbits3 = buf->timecode.userbits[3];
140 __entry->sequence = buf->sequence;
143 TP_printk("minor = %d, index = %u, type = %s, bytesused = %u, "
144 "flags = %s, field = %s, timestamp = %llu, "
145 "timecode = { type = %s, flags = %s, frames = %u, "
146 "seconds = %u, minutes = %u, hours = %u, "
147 "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
148 __entry->index, show_type(__entry->type),
149 __entry->bytesused,
150 show_flags(__entry->flags),
151 show_field(__entry->field),
152 __entry->timestamp,
153 show_timecode_type(__entry->timecode_type),
154 show_timecode_flags(__entry->timecode_flags),
155 __entry->timecode_frames,
156 __entry->timecode_seconds,
157 __entry->timecode_minutes,
158 __entry->timecode_hours,
159 __entry->timecode_userbits0,
160 __entry->timecode_userbits1,
161 __entry->timecode_userbits2,
162 __entry->timecode_userbits3,
163 __entry->sequence
167 DEFINE_EVENT(v4l2_event_class, v4l2_dqbuf,
168 TP_PROTO(int minor, struct v4l2_buffer *buf),
169 TP_ARGS(minor, buf)
172 DEFINE_EVENT(v4l2_event_class, v4l2_qbuf,
173 TP_PROTO(int minor, struct v4l2_buffer *buf),
174 TP_ARGS(minor, buf)
177 #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
179 /* This part must be outside protection */
180 #include <trace/define_trace.h>