Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / include / trace / events / v4l2.h
blobb3a85b3df53e4eb0fd4dc62219a99c7dac42e01e
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>
8 #include <media/videobuf2-v4l2.h>
10 /* Enums require being exported to userspace, for user tool parsing */
11 #undef EM
12 #undef EMe
13 #define EM(a, b) TRACE_DEFINE_ENUM(a);
14 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
16 #define show_type(type) \
17 __print_symbolic(type, SHOW_TYPE)
19 #define SHOW_TYPE \
20 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" ) \
21 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" ) \
22 EM( V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" ) \
23 EM( V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" ) \
24 EM( V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" ) \
25 EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" ) \
26 EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" ) \
27 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \
28 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \
29 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \
30 EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \
31 EM( V4L2_BUF_TYPE_SDR_OUTPUT, "SDR_OUTPUT" ) \
32 EM( V4L2_BUF_TYPE_META_CAPTURE, "META_CAPTURE" ) \
33 EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" )
35 SHOW_TYPE
37 #define show_field(field) \
38 __print_symbolic(field, SHOW_FIELD)
40 #define SHOW_FIELD \
41 EM( V4L2_FIELD_ANY, "ANY" ) \
42 EM( V4L2_FIELD_NONE, "NONE" ) \
43 EM( V4L2_FIELD_TOP, "TOP" ) \
44 EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \
45 EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \
46 EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \
47 EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \
48 EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \
49 EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \
50 EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" )
52 SHOW_FIELD
55 * Now redefine the EM() and EMe() macros to map the enums to the strings
56 * that will be printed in the output.
58 #undef EM
59 #undef EMe
60 #define EM(a, b) {a, b},
61 #define EMe(a, b) {a, b}
63 /* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
65 #define show_timecode_type(type) \
66 __print_symbolic(type, \
67 { V4L2_TC_TYPE_24FPS, "24FPS" }, \
68 { V4L2_TC_TYPE_25FPS, "25FPS" }, \
69 { V4L2_TC_TYPE_30FPS, "30FPS" }, \
70 { V4L2_TC_TYPE_50FPS, "50FPS" }, \
71 { V4L2_TC_TYPE_60FPS, "60FPS" })
73 #define show_flags(flags) \
74 __print_flags(flags, "|", \
75 { V4L2_BUF_FLAG_MAPPED, "MAPPED" }, \
76 { V4L2_BUF_FLAG_QUEUED, "QUEUED" }, \
77 { V4L2_BUF_FLAG_DONE, "DONE" }, \
78 { V4L2_BUF_FLAG_KEYFRAME, "KEYFRAME" }, \
79 { V4L2_BUF_FLAG_PFRAME, "PFRAME" }, \
80 { V4L2_BUF_FLAG_BFRAME, "BFRAME" }, \
81 { V4L2_BUF_FLAG_ERROR, "ERROR" }, \
82 { V4L2_BUF_FLAG_TIMECODE, "TIMECODE" }, \
83 { V4L2_BUF_FLAG_PREPARED, "PREPARED" }, \
84 { V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \
85 { V4L2_BUF_FLAG_NO_CACHE_CLEAN, "NO_CACHE_CLEAN" }, \
86 { V4L2_BUF_FLAG_TIMESTAMP_MASK, "TIMESTAMP_MASK" }, \
87 { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \
88 { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
89 { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \
90 { V4L2_BUF_FLAG_LAST, "LAST" })
92 #define show_timecode_flags(flags) \
93 __print_flags(flags, "|", \
94 { V4L2_TC_FLAG_DROPFRAME, "DROPFRAME" }, \
95 { V4L2_TC_FLAG_COLORFRAME, "COLORFRAME" }, \
96 { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \
97 { V4L2_TC_USERBITS_8BITCHARS, "USERBITS_8BITCHARS" })
99 DECLARE_EVENT_CLASS(v4l2_event_class,
100 TP_PROTO(int minor, struct v4l2_buffer *buf),
102 TP_ARGS(minor, buf),
104 TP_STRUCT__entry(
105 __field(int, minor)
106 __field(u32, index)
107 __field(u32, type)
108 __field(u32, bytesused)
109 __field(u32, flags)
110 __field(u32, field)
111 __field(s64, timestamp)
112 __field(u32, timecode_type)
113 __field(u32, timecode_flags)
114 __field(u8, timecode_frames)
115 __field(u8, timecode_seconds)
116 __field(u8, timecode_minutes)
117 __field(u8, timecode_hours)
118 __field(u8, timecode_userbits0)
119 __field(u8, timecode_userbits1)
120 __field(u8, timecode_userbits2)
121 __field(u8, timecode_userbits3)
122 __field(u32, sequence)
125 TP_fast_assign(
126 __entry->minor = minor;
127 __entry->index = buf->index;
128 __entry->type = buf->type;
129 __entry->bytesused = buf->bytesused;
130 __entry->flags = buf->flags;
131 __entry->field = buf->field;
132 __entry->timestamp = timeval_to_ns(&buf->timestamp);
133 __entry->timecode_type = buf->timecode.type;
134 __entry->timecode_flags = buf->timecode.flags;
135 __entry->timecode_frames = buf->timecode.frames;
136 __entry->timecode_seconds = buf->timecode.seconds;
137 __entry->timecode_minutes = buf->timecode.minutes;
138 __entry->timecode_hours = buf->timecode.hours;
139 __entry->timecode_userbits0 = buf->timecode.userbits[0];
140 __entry->timecode_userbits1 = buf->timecode.userbits[1];
141 __entry->timecode_userbits2 = buf->timecode.userbits[2];
142 __entry->timecode_userbits3 = buf->timecode.userbits[3];
143 __entry->sequence = buf->sequence;
146 TP_printk("minor = %d, index = %u, type = %s, bytesused = %u, "
147 "flags = %s, field = %s, timestamp = %llu, "
148 "timecode = { type = %s, flags = %s, frames = %u, "
149 "seconds = %u, minutes = %u, hours = %u, "
150 "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
151 __entry->index, show_type(__entry->type),
152 __entry->bytesused,
153 show_flags(__entry->flags),
154 show_field(__entry->field),
155 __entry->timestamp,
156 show_timecode_type(__entry->timecode_type),
157 show_timecode_flags(__entry->timecode_flags),
158 __entry->timecode_frames,
159 __entry->timecode_seconds,
160 __entry->timecode_minutes,
161 __entry->timecode_hours,
162 __entry->timecode_userbits0,
163 __entry->timecode_userbits1,
164 __entry->timecode_userbits2,
165 __entry->timecode_userbits3,
166 __entry->sequence
170 DEFINE_EVENT(v4l2_event_class, v4l2_dqbuf,
171 TP_PROTO(int minor, struct v4l2_buffer *buf),
172 TP_ARGS(minor, buf)
175 DEFINE_EVENT(v4l2_event_class, v4l2_qbuf,
176 TP_PROTO(int minor, struct v4l2_buffer *buf),
177 TP_ARGS(minor, buf)
180 DECLARE_EVENT_CLASS(vb2_v4l2_event_class,
181 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
182 TP_ARGS(q, vb),
184 TP_STRUCT__entry(
185 __field(int, minor)
186 __field(u32, flags)
187 __field(u32, field)
188 __field(u64, timestamp)
189 __field(u32, timecode_type)
190 __field(u32, timecode_flags)
191 __field(u8, timecode_frames)
192 __field(u8, timecode_seconds)
193 __field(u8, timecode_minutes)
194 __field(u8, timecode_hours)
195 __field(u8, timecode_userbits0)
196 __field(u8, timecode_userbits1)
197 __field(u8, timecode_userbits2)
198 __field(u8, timecode_userbits3)
199 __field(u32, sequence)
202 TP_fast_assign(
203 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
204 struct v4l2_fh *owner = q->owner;
206 __entry->minor = owner ? owner->vdev->minor : -1;
207 __entry->flags = vbuf->flags;
208 __entry->field = vbuf->field;
209 __entry->timestamp = vb->timestamp;
210 __entry->timecode_type = vbuf->timecode.type;
211 __entry->timecode_flags = vbuf->timecode.flags;
212 __entry->timecode_frames = vbuf->timecode.frames;
213 __entry->timecode_seconds = vbuf->timecode.seconds;
214 __entry->timecode_minutes = vbuf->timecode.minutes;
215 __entry->timecode_hours = vbuf->timecode.hours;
216 __entry->timecode_userbits0 = vbuf->timecode.userbits[0];
217 __entry->timecode_userbits1 = vbuf->timecode.userbits[1];
218 __entry->timecode_userbits2 = vbuf->timecode.userbits[2];
219 __entry->timecode_userbits3 = vbuf->timecode.userbits[3];
220 __entry->sequence = vbuf->sequence;
223 TP_printk("minor=%d flags = %s, field = %s, "
224 "timestamp = %llu, timecode = { type = %s, flags = %s, "
225 "frames = %u, seconds = %u, minutes = %u, hours = %u, "
226 "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
227 show_flags(__entry->flags),
228 show_field(__entry->field),
229 __entry->timestamp,
230 show_timecode_type(__entry->timecode_type),
231 show_timecode_flags(__entry->timecode_flags),
232 __entry->timecode_frames,
233 __entry->timecode_seconds,
234 __entry->timecode_minutes,
235 __entry->timecode_hours,
236 __entry->timecode_userbits0,
237 __entry->timecode_userbits1,
238 __entry->timecode_userbits2,
239 __entry->timecode_userbits3,
240 __entry->sequence
244 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_buf_done,
245 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
246 TP_ARGS(q, vb)
249 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_buf_queue,
250 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
251 TP_ARGS(q, vb)
254 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_dqbuf,
255 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
256 TP_ARGS(q, vb)
259 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_qbuf,
260 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
261 TP_ARGS(q, vb)
264 #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
266 /* This part must be outside protection */
267 #include <trace/define_trace.h>