blob: 375b1a3138c2d176a554518677b7a914d7437973 [file] [log] [blame]
Wade Farnsworth2d012372013-11-22 16:48:28 -03001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM v4l2
3
4#if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_V4L2_H
6
7#include <linux/tracepoint.h>
Junghak Sungbed04f92015-10-06 06:37:47 -03008#include <media/videobuf2-v4l2.h>
Wade Farnsworth2d012372013-11-22 16:48:28 -03009
Steven Rostedt (Red Hat)43d0f712015-03-27 17:04:45 -040010/* 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);
15
16#define show_type(type) \
17 __print_symbolic(type, SHOW_TYPE)
18
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 EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" )
32
33SHOW_TYPE
Wade Farnsworth2d012372013-11-22 16:48:28 -030034
35#define show_field(field) \
Steven Rostedt (Red Hat)43d0f712015-03-27 17:04:45 -040036 __print_symbolic(field, SHOW_FIELD)
37
38#define SHOW_FIELD \
39 EM( V4L2_FIELD_ANY, "ANY" ) \
40 EM( V4L2_FIELD_NONE, "NONE" ) \
41 EM( V4L2_FIELD_TOP, "TOP" ) \
42 EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \
43 EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \
44 EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \
45 EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \
46 EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \
47 EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \
48 EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" )
49
50SHOW_FIELD
51
52/*
53 * Now redefine the EM() and EMe() macros to map the enums to the strings
54 * that will be printed in the output.
55 */
56#undef EM
57#undef EMe
58#define EM(a, b) {a, b},
59#define EMe(a, b) {a, b}
60
61/* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
Wade Farnsworth2d012372013-11-22 16:48:28 -030062
63#define show_timecode_type(type) \
64 __print_symbolic(type, \
65 { V4L2_TC_TYPE_24FPS, "24FPS" }, \
66 { V4L2_TC_TYPE_25FPS, "25FPS" }, \
67 { V4L2_TC_TYPE_30FPS, "30FPS" }, \
68 { V4L2_TC_TYPE_50FPS, "50FPS" }, \
69 { V4L2_TC_TYPE_60FPS, "60FPS" })
70
71#define show_flags(flags) \
72 __print_flags(flags, "|", \
73 { V4L2_BUF_FLAG_MAPPED, "MAPPED" }, \
74 { V4L2_BUF_FLAG_QUEUED, "QUEUED" }, \
75 { V4L2_BUF_FLAG_DONE, "DONE" }, \
76 { V4L2_BUF_FLAG_KEYFRAME, "KEYFRAME" }, \
77 { V4L2_BUF_FLAG_PFRAME, "PFRAME" }, \
78 { V4L2_BUF_FLAG_BFRAME, "BFRAME" }, \
79 { V4L2_BUF_FLAG_ERROR, "ERROR" }, \
80 { V4L2_BUF_FLAG_TIMECODE, "TIMECODE" }, \
81 { V4L2_BUF_FLAG_PREPARED, "PREPARED" }, \
82 { V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \
83 { V4L2_BUF_FLAG_NO_CACHE_CLEAN, "NO_CACHE_CLEAN" }, \
84 { V4L2_BUF_FLAG_TIMESTAMP_MASK, "TIMESTAMP_MASK" }, \
85 { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN, "TIMESTAMP_UNKNOWN" }, \
86 { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
Peter Seidererdc199242015-05-04 07:51:05 -030087 { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \
88 { V4L2_BUF_FLAG_LAST, "LAST" })
Wade Farnsworth2d012372013-11-22 16:48:28 -030089
90#define show_timecode_flags(flags) \
91 __print_flags(flags, "|", \
92 { V4L2_TC_FLAG_DROPFRAME, "DROPFRAME" }, \
93 { V4L2_TC_FLAG_COLORFRAME, "COLORFRAME" }, \
94 { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \
95 { V4L2_TC_USERBITS_8BITCHARS, "USERBITS_8BITCHARS" })
96
Philipp Zabel85efe4e2015-07-10 10:49:24 -030097DECLARE_EVENT_CLASS(v4l2_event_class,
98 TP_PROTO(int minor, struct v4l2_buffer *buf),
Wade Farnsworth2d012372013-11-22 16:48:28 -030099
Philipp Zabel85efe4e2015-07-10 10:49:24 -0300100 TP_ARGS(minor, buf),
101
102 TP_STRUCT__entry(
103 __field(int, minor)
104 __field(u32, index)
105 __field(u32, type)
106 __field(u32, bytesused)
107 __field(u32, flags)
108 __field(u32, field)
109 __field(s64, timestamp)
110 __field(u32, timecode_type)
111 __field(u32, timecode_flags)
112 __field(u8, timecode_frames)
113 __field(u8, timecode_seconds)
114 __field(u8, timecode_minutes)
115 __field(u8, timecode_hours)
116 __field(u8, timecode_userbits0)
117 __field(u8, timecode_userbits1)
118 __field(u8, timecode_userbits2)
119 __field(u8, timecode_userbits3)
120 __field(u32, sequence)
121 ),
122
123 TP_fast_assign(
124 __entry->minor = minor;
125 __entry->index = buf->index;
126 __entry->type = buf->type;
127 __entry->bytesused = buf->bytesused;
128 __entry->flags = buf->flags;
129 __entry->field = buf->field;
130 __entry->timestamp = timeval_to_ns(&buf->timestamp);
131 __entry->timecode_type = buf->timecode.type;
132 __entry->timecode_flags = buf->timecode.flags;
133 __entry->timecode_frames = buf->timecode.frames;
134 __entry->timecode_seconds = buf->timecode.seconds;
135 __entry->timecode_minutes = buf->timecode.minutes;
136 __entry->timecode_hours = buf->timecode.hours;
137 __entry->timecode_userbits0 = buf->timecode.userbits[0];
138 __entry->timecode_userbits1 = buf->timecode.userbits[1];
139 __entry->timecode_userbits2 = buf->timecode.userbits[2];
140 __entry->timecode_userbits3 = buf->timecode.userbits[3];
141 __entry->sequence = buf->sequence;
142 ),
143
144 TP_printk("minor = %d, index = %u, type = %s, bytesused = %u, "
145 "flags = %s, field = %s, timestamp = %llu, "
146 "timecode = { type = %s, flags = %s, frames = %u, "
147 "seconds = %u, minutes = %u, hours = %u, "
148 "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
149 __entry->index, show_type(__entry->type),
150 __entry->bytesused,
151 show_flags(__entry->flags),
152 show_field(__entry->field),
153 __entry->timestamp,
154 show_timecode_type(__entry->timecode_type),
155 show_timecode_flags(__entry->timecode_flags),
156 __entry->timecode_frames,
157 __entry->timecode_seconds,
158 __entry->timecode_minutes,
159 __entry->timecode_hours,
160 __entry->timecode_userbits0,
161 __entry->timecode_userbits1,
162 __entry->timecode_userbits2,
163 __entry->timecode_userbits3,
164 __entry->sequence
165 )
166)
167
168DEFINE_EVENT(v4l2_event_class, v4l2_dqbuf,
169 TP_PROTO(int minor, struct v4l2_buffer *buf),
170 TP_ARGS(minor, buf)
171);
172
173DEFINE_EVENT(v4l2_event_class, v4l2_qbuf,
174 TP_PROTO(int minor, struct v4l2_buffer *buf),
175 TP_ARGS(minor, buf)
176);
Wade Farnsworth2d012372013-11-22 16:48:28 -0300177
Philipp Zabel2091f512015-07-10 10:49:26 -0300178DECLARE_EVENT_CLASS(vb2_event_class,
179 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
180 TP_ARGS(q, vb),
181
182 TP_STRUCT__entry(
183 __field(int, minor)
184 __field(u32, queued_count)
185 __field(int, owned_by_drv_count)
186 __field(u32, index)
187 __field(u32, type)
188 __field(u32, bytesused)
189 __field(u32, flags)
190 __field(u32, field)
191 __field(s64, timestamp)
192 __field(u32, timecode_type)
193 __field(u32, timecode_flags)
194 __field(u8, timecode_frames)
195 __field(u8, timecode_seconds)
196 __field(u8, timecode_minutes)
197 __field(u8, timecode_hours)
198 __field(u8, timecode_userbits0)
199 __field(u8, timecode_userbits1)
200 __field(u8, timecode_userbits2)
201 __field(u8, timecode_userbits3)
202 __field(u32, sequence)
203 ),
204
205 TP_fast_assign(
Junghak Sung2d700712015-09-22 10:30:30 -0300206 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
Junghak Sungbed04f92015-10-06 06:37:47 -0300207 struct v4l2_fh *owner = q->owner;
208
209 __entry->minor = owner ? owner->vdev->minor : -1;
Philipp Zabel2091f512015-07-10 10:49:26 -0300210 __entry->queued_count = q->queued_count;
211 __entry->owned_by_drv_count =
212 atomic_read(&q->owned_by_drv_count);
Junghak Sung2d700712015-09-22 10:30:30 -0300213 __entry->index = vb->index;
214 __entry->type = vb->type;
215 __entry->bytesused = vb->planes[0].bytesused;
216 __entry->flags = vbuf->flags;
217 __entry->field = vbuf->field;
218 __entry->timestamp = timeval_to_ns(&vbuf->timestamp);
219 __entry->timecode_type = vbuf->timecode.type;
220 __entry->timecode_flags = vbuf->timecode.flags;
221 __entry->timecode_frames = vbuf->timecode.frames;
222 __entry->timecode_seconds = vbuf->timecode.seconds;
223 __entry->timecode_minutes = vbuf->timecode.minutes;
224 __entry->timecode_hours = vbuf->timecode.hours;
225 __entry->timecode_userbits0 = vbuf->timecode.userbits[0];
226 __entry->timecode_userbits1 = vbuf->timecode.userbits[1];
227 __entry->timecode_userbits2 = vbuf->timecode.userbits[2];
228 __entry->timecode_userbits3 = vbuf->timecode.userbits[3];
229 __entry->sequence = vbuf->sequence;
Philipp Zabel2091f512015-07-10 10:49:26 -0300230 ),
231
232 TP_printk("minor = %d, queued = %u, owned_by_drv = %d, index = %u, "
233 "type = %s, bytesused = %u, flags = %s, field = %s, "
234 "timestamp = %llu, timecode = { type = %s, flags = %s, "
235 "frames = %u, seconds = %u, minutes = %u, hours = %u, "
236 "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
237 __entry->queued_count,
238 __entry->owned_by_drv_count,
239 __entry->index, show_type(__entry->type),
240 __entry->bytesused,
241 show_flags(__entry->flags),
242 show_field(__entry->field),
243 __entry->timestamp,
244 show_timecode_type(__entry->timecode_type),
245 show_timecode_flags(__entry->timecode_flags),
246 __entry->timecode_frames,
247 __entry->timecode_seconds,
248 __entry->timecode_minutes,
249 __entry->timecode_hours,
250 __entry->timecode_userbits0,
251 __entry->timecode_userbits1,
252 __entry->timecode_userbits2,
253 __entry->timecode_userbits3,
254 __entry->sequence
255 )
256)
257
258DEFINE_EVENT(vb2_event_class, vb2_buf_done,
259 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
260 TP_ARGS(q, vb)
261);
262
263DEFINE_EVENT(vb2_event_class, vb2_buf_queue,
264 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
265 TP_ARGS(q, vb)
266);
267
268DEFINE_EVENT(vb2_event_class, vb2_dqbuf,
269 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
270 TP_ARGS(q, vb)
271);
272
273DEFINE_EVENT(vb2_event_class, vb2_qbuf,
274 TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
275 TP_ARGS(q, vb)
276);
277
Wade Farnsworth2d012372013-11-22 16:48:28 -0300278#endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
279
280/* This part must be outside protection */
281#include <trace/define_trace.h>