Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livep...
[sfrench/cifs-2.6.git] / include / trace / events / v4l2.h
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
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
33
34 #define show_field(field)                                               \
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 */
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" }, \
86                 { V4L2_BUF_FLAG_TIMESTAMP_COPY,      "TIMESTAMP_COPY" },      \
87                 { V4L2_BUF_FLAG_LAST,                "LAST" })
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
96 #define V4L2_TRACE_EVENT(event_name)                                    \
97         TRACE_EVENT(event_name,                                         \
98                 TP_PROTO(int minor, struct v4l2_buffer *buf),           \
99                                                                         \
100                 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 =                            \
131                                 timeval_to_ns(&buf->timestamp);         \
132                         __entry->timecode_type = buf->timecode.type;    \
133                         __entry->timecode_flags = buf->timecode.flags;  \
134                         __entry->timecode_frames =                      \
135                                 buf->timecode.frames;                   \
136                         __entry->timecode_seconds =                     \
137                                 buf->timecode.seconds;                  \
138                         __entry->timecode_minutes =                     \
139                                 buf->timecode.minutes;                  \
140                         __entry->timecode_hours = buf->timecode.hours;  \
141                         __entry->timecode_userbits0 =                   \
142                                 buf->timecode.userbits[0];              \
143                         __entry->timecode_userbits1 =                   \
144                                 buf->timecode.userbits[1];              \
145                         __entry->timecode_userbits2 =                   \
146                                 buf->timecode.userbits[2];              \
147                         __entry->timecode_userbits3 =                   \
148                                 buf->timecode.userbits[3];              \
149                         __entry->sequence = buf->sequence;              \
150                 ),                                                      \
151                                                                         \
152                 TP_printk("minor = %d, index = %u, type = %s, "         \
153                           "bytesused = %u, flags = %s, "                \
154                           "field = %s, timestamp = %llu, timecode = { " \
155                           "type = %s, flags = %s, frames = %u, "        \
156                           "seconds = %u, minutes = %u, hours = %u, "    \
157                           "userbits = { %u %u %u %u } }, "              \
158                           "sequence = %u", __entry->minor,              \
159                           __entry->index, show_type(__entry->type),     \
160                           __entry->bytesused,                           \
161                           show_flags(__entry->flags),                   \
162                           show_field(__entry->field),                   \
163                           __entry->timestamp,                           \
164                           show_timecode_type(__entry->timecode_type),   \
165                           show_timecode_flags(__entry->timecode_flags), \
166                           __entry->timecode_frames,                     \
167                           __entry->timecode_seconds,                    \
168                           __entry->timecode_minutes,                    \
169                           __entry->timecode_hours,                      \
170                           __entry->timecode_userbits0,                  \
171                           __entry->timecode_userbits1,                  \
172                           __entry->timecode_userbits2,                  \
173                           __entry->timecode_userbits3,                  \
174                           __entry->sequence                             \
175                 )                                                       \
176         )
177
178 V4L2_TRACE_EVENT(v4l2_dqbuf);
179 V4L2_TRACE_EVENT(v4l2_qbuf);
180
181 #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
182
183 /* This part must be outside protection */
184 #include <trace/define_trace.h>