Commit | Line | Data |
---|---|---|
2d012373 WF |
1 | #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> | |
8 | ||
43d0f71f SRRH |
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); | |
14 | ||
15 | #define show_type(type) \ | |
16 | __print_symbolic(type, SHOW_TYPE) | |
17 | ||
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" ) | |
31 | ||
32 | SHOW_TYPE | |
2d012373 WF |
33 | |
34 | #define show_field(field) \ | |
43d0f71f SRRH |
35 | __print_symbolic(field, SHOW_FIELD) |
36 | ||
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" ) | |
48 | ||
49 | SHOW_FIELD | |
50 | ||
51 | /* | |
52 | * Now redefine the EM() and EMe() macros to map the enums to the strings | |
53 | * that will be printed in the output. | |
54 | */ | |
55 | #undef EM | |
56 | #undef EMe | |
57 | #define EM(a, b) {a, b}, | |
58 | #define EMe(a, b) {a, b} | |
59 | ||
60 | /* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */ | |
2d012373 WF |
61 | |
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" }) | |
69 | ||
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" }, \ | |
dc199241 PS |
86 | { V4L2_BUF_FLAG_TIMESTAMP_COPY, "TIMESTAMP_COPY" }, \ |
87 | { V4L2_BUF_FLAG_LAST, "LAST" }) | |
2d012373 WF |
88 | |
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" }) | |
95 | ||
85efe4e5 PZ |
96 | DECLARE_EVENT_CLASS(v4l2_event_class, |
97 | TP_PROTO(int minor, struct v4l2_buffer *buf), | |
98 | ||
99 | TP_ARGS(minor, buf), | |
100 | ||
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) | |
120 | ), | |
121 | ||
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; | |
141 | ), | |
142 | ||
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 | |
2d012373 | 164 | ) |
85efe4e5 | 165 | ) |
2d012373 | 166 | |
85efe4e5 PZ |
167 | DEFINE_EVENT(v4l2_event_class, v4l2_dqbuf, |
168 | TP_PROTO(int minor, struct v4l2_buffer *buf), | |
169 | TP_ARGS(minor, buf) | |
170 | ); | |
171 | ||
172 | DEFINE_EVENT(v4l2_event_class, v4l2_qbuf, | |
173 | TP_PROTO(int minor, struct v4l2_buffer *buf), | |
174 | TP_ARGS(minor, buf) | |
175 | ); | |
2d012373 | 176 | |
2091f518 PZ |
177 | DECLARE_EVENT_CLASS(vb2_event_class, |
178 | TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb), | |
179 | TP_ARGS(q, vb), | |
180 | ||
181 | TP_STRUCT__entry( | |
182 | __field(int, minor) | |
183 | __field(u32, queued_count) | |
184 | __field(int, owned_by_drv_count) | |
185 | __field(u32, index) | |
186 | __field(u32, type) | |
187 | __field(u32, bytesused) | |
188 | __field(u32, flags) | |
189 | __field(u32, field) | |
190 | __field(s64, timestamp) | |
191 | __field(u32, timecode_type) | |
192 | __field(u32, timecode_flags) | |
193 | __field(u8, timecode_frames) | |
194 | __field(u8, timecode_seconds) | |
195 | __field(u8, timecode_minutes) | |
196 | __field(u8, timecode_hours) | |
197 | __field(u8, timecode_userbits0) | |
198 | __field(u8, timecode_userbits1) | |
199 | __field(u8, timecode_userbits2) | |
200 | __field(u8, timecode_userbits3) | |
201 | __field(u32, sequence) | |
202 | ), | |
203 | ||
204 | TP_fast_assign( | |
2d700715 | 205 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); |
2091f518 PZ |
206 | __entry->minor = q->owner ? q->owner->vdev->minor : -1; |
207 | __entry->queued_count = q->queued_count; | |
208 | __entry->owned_by_drv_count = | |
209 | atomic_read(&q->owned_by_drv_count); | |
2d700715 JS |
210 | __entry->index = vb->index; |
211 | __entry->type = vb->type; | |
212 | __entry->bytesused = vb->planes[0].bytesused; | |
213 | __entry->flags = vbuf->flags; | |
214 | __entry->field = vbuf->field; | |
215 | __entry->timestamp = timeval_to_ns(&vbuf->timestamp); | |
216 | __entry->timecode_type = vbuf->timecode.type; | |
217 | __entry->timecode_flags = vbuf->timecode.flags; | |
218 | __entry->timecode_frames = vbuf->timecode.frames; | |
219 | __entry->timecode_seconds = vbuf->timecode.seconds; | |
220 | __entry->timecode_minutes = vbuf->timecode.minutes; | |
221 | __entry->timecode_hours = vbuf->timecode.hours; | |
222 | __entry->timecode_userbits0 = vbuf->timecode.userbits[0]; | |
223 | __entry->timecode_userbits1 = vbuf->timecode.userbits[1]; | |
224 | __entry->timecode_userbits2 = vbuf->timecode.userbits[2]; | |
225 | __entry->timecode_userbits3 = vbuf->timecode.userbits[3]; | |
226 | __entry->sequence = vbuf->sequence; | |
2091f518 PZ |
227 | ), |
228 | ||
229 | TP_printk("minor = %d, queued = %u, owned_by_drv = %d, index = %u, " | |
230 | "type = %s, bytesused = %u, flags = %s, field = %s, " | |
231 | "timestamp = %llu, timecode = { type = %s, flags = %s, " | |
232 | "frames = %u, seconds = %u, minutes = %u, hours = %u, " | |
233 | "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor, | |
234 | __entry->queued_count, | |
235 | __entry->owned_by_drv_count, | |
236 | __entry->index, show_type(__entry->type), | |
237 | __entry->bytesused, | |
238 | show_flags(__entry->flags), | |
239 | show_field(__entry->field), | |
240 | __entry->timestamp, | |
241 | show_timecode_type(__entry->timecode_type), | |
242 | show_timecode_flags(__entry->timecode_flags), | |
243 | __entry->timecode_frames, | |
244 | __entry->timecode_seconds, | |
245 | __entry->timecode_minutes, | |
246 | __entry->timecode_hours, | |
247 | __entry->timecode_userbits0, | |
248 | __entry->timecode_userbits1, | |
249 | __entry->timecode_userbits2, | |
250 | __entry->timecode_userbits3, | |
251 | __entry->sequence | |
252 | ) | |
253 | ) | |
254 | ||
255 | DEFINE_EVENT(vb2_event_class, vb2_buf_done, | |
256 | TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb), | |
257 | TP_ARGS(q, vb) | |
258 | ); | |
259 | ||
260 | DEFINE_EVENT(vb2_event_class, vb2_buf_queue, | |
261 | TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb), | |
262 | TP_ARGS(q, vb) | |
263 | ); | |
264 | ||
265 | DEFINE_EVENT(vb2_event_class, vb2_dqbuf, | |
266 | TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb), | |
267 | TP_ARGS(q, vb) | |
268 | ); | |
269 | ||
270 | DEFINE_EVENT(vb2_event_class, vb2_qbuf, | |
271 | TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb), | |
272 | TP_ARGS(q, vb) | |
273 | ); | |
274 | ||
2d012373 WF |
275 | #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */ |
276 | ||
277 | /* This part must be outside protection */ | |
278 | #include <trace/define_trace.h> |