xref: /openbmc/linux/include/trace/events/v4l2.h (revision f7018c21)
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 #define show_type(type)							       \
10 	__print_symbolic(type,						       \
11 		{ V4L2_BUF_TYPE_VIDEO_CAPTURE,	      "VIDEO_CAPTURE" },       \
12 		{ V4L2_BUF_TYPE_VIDEO_OUTPUT,	      "VIDEO_OUTPUT" },	       \
13 		{ V4L2_BUF_TYPE_VIDEO_OVERLAY,	      "VIDEO_OVERLAY" },       \
14 		{ V4L2_BUF_TYPE_VBI_CAPTURE,	      "VBI_CAPTURE" },	       \
15 		{ V4L2_BUF_TYPE_VBI_OUTPUT,	      "VBI_OUTPUT" },	       \
16 		{ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,   "SLICED_VBI_CAPTURE" },  \
17 		{ V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,    "SLICED_VBI_OUTPUT" },   \
18 		{ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\
19 		{ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\
20 		{ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,  "VIDEO_OUTPUT_MPLANE" }, \
21 		{ V4L2_BUF_TYPE_SDR_CAPTURE,          "SDR_CAPTURE" },         \
22 		{ V4L2_BUF_TYPE_PRIVATE,	      "PRIVATE" })
23 
24 #define show_field(field)						\
25 	__print_symbolic(field,						\
26 		{ V4L2_FIELD_ANY,		"ANY" },		\
27 		{ V4L2_FIELD_NONE,		"NONE" },		\
28 		{ V4L2_FIELD_TOP,		"TOP" },		\
29 		{ V4L2_FIELD_BOTTOM,		"BOTTOM" },		\
30 		{ V4L2_FIELD_INTERLACED,	"INTERLACED" },		\
31 		{ V4L2_FIELD_SEQ_TB,		"SEQ_TB" },		\
32 		{ V4L2_FIELD_SEQ_BT,		"SEQ_BT" },		\
33 		{ V4L2_FIELD_ALTERNATE,		"ALTERNATE" },		\
34 		{ V4L2_FIELD_INTERLACED_TB,	"INTERLACED_TB" },      \
35 		{ V4L2_FIELD_INTERLACED_BT,	"INTERLACED_BT" })
36 
37 #define show_timecode_type(type)					\
38 	__print_symbolic(type,						\
39 		{ V4L2_TC_TYPE_24FPS,		"24FPS" },		\
40 		{ V4L2_TC_TYPE_25FPS,		"25FPS" },		\
41 		{ V4L2_TC_TYPE_30FPS,		"30FPS" },		\
42 		{ V4L2_TC_TYPE_50FPS,		"50FPS" },		\
43 		{ V4L2_TC_TYPE_60FPS,		"60FPS" })
44 
45 #define show_flags(flags)						      \
46 	__print_flags(flags, "|",					      \
47 		{ V4L2_BUF_FLAG_MAPPED,		     "MAPPED" },	      \
48 		{ V4L2_BUF_FLAG_QUEUED,		     "QUEUED" },	      \
49 		{ V4L2_BUF_FLAG_DONE,		     "DONE" },		      \
50 		{ V4L2_BUF_FLAG_KEYFRAME,	     "KEYFRAME" },	      \
51 		{ V4L2_BUF_FLAG_PFRAME,		     "PFRAME" },	      \
52 		{ V4L2_BUF_FLAG_BFRAME,		     "BFRAME" },	      \
53 		{ V4L2_BUF_FLAG_ERROR,		     "ERROR" },		      \
54 		{ V4L2_BUF_FLAG_TIMECODE,	     "TIMECODE" },	      \
55 		{ V4L2_BUF_FLAG_PREPARED,	     "PREPARED" },	      \
56 		{ V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \
57 		{ V4L2_BUF_FLAG_NO_CACHE_CLEAN,	     "NO_CACHE_CLEAN" },      \
58 		{ V4L2_BUF_FLAG_TIMESTAMP_MASK,	     "TIMESTAMP_MASK" },      \
59 		{ V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,   "TIMESTAMP_UNKNOWN" },   \
60 		{ V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
61 		{ V4L2_BUF_FLAG_TIMESTAMP_COPY,	     "TIMESTAMP_COPY" })
62 
63 #define show_timecode_flags(flags)					  \
64 	__print_flags(flags, "|",					  \
65 		{ V4L2_TC_FLAG_DROPFRAME,       "DROPFRAME" },		  \
66 		{ V4L2_TC_FLAG_COLORFRAME,      "COLORFRAME" },		  \
67 		{ V4L2_TC_USERBITS_USERDEFINED,	"USERBITS_USERDEFINED" }, \
68 		{ V4L2_TC_USERBITS_8BITCHARS,	"USERBITS_8BITCHARS" })
69 
70 #define V4L2_TRACE_EVENT(event_name)					\
71 	TRACE_EVENT(event_name,						\
72 		TP_PROTO(int minor, struct v4l2_buffer *buf),		\
73 									\
74 		TP_ARGS(minor, buf),					\
75 									\
76 		TP_STRUCT__entry(					\
77 			__field(int, minor)				\
78 			__field(u32, index)				\
79 			__field(u32, type)				\
80 			__field(u32, bytesused)				\
81 			__field(u32, flags)				\
82 			__field(u32, field)				\
83 			__field(s64, timestamp)				\
84 			__field(u32, timecode_type)			\
85 			__field(u32, timecode_flags)			\
86 			__field(u8, timecode_frames)			\
87 			__field(u8, timecode_seconds)			\
88 			__field(u8, timecode_minutes)			\
89 			__field(u8, timecode_hours)			\
90 			__field(u8, timecode_userbits0)			\
91 			__field(u8, timecode_userbits1)			\
92 			__field(u8, timecode_userbits2)			\
93 			__field(u8, timecode_userbits3)			\
94 			__field(u32, sequence)				\
95 		),							\
96 									\
97 		TP_fast_assign(						\
98 			__entry->minor = minor;				\
99 			__entry->index = buf->index;			\
100 			__entry->type = buf->type;			\
101 			__entry->bytesused = buf->bytesused;		\
102 			__entry->flags = buf->flags;			\
103 			__entry->field = buf->field;			\
104 			__entry->timestamp =				\
105 				timeval_to_ns(&buf->timestamp);		\
106 			__entry->timecode_type = buf->timecode.type;	\
107 			__entry->timecode_flags = buf->timecode.flags;	\
108 			__entry->timecode_frames =			\
109 				buf->timecode.frames;			\
110 			__entry->timecode_seconds =			\
111 				buf->timecode.seconds;			\
112 			__entry->timecode_minutes =			\
113 				buf->timecode.minutes;			\
114 			__entry->timecode_hours = buf->timecode.hours;	\
115 			__entry->timecode_userbits0 =			\
116 				buf->timecode.userbits[0];		\
117 			__entry->timecode_userbits1 =			\
118 				buf->timecode.userbits[1];		\
119 			__entry->timecode_userbits2 =			\
120 				buf->timecode.userbits[2];		\
121 			__entry->timecode_userbits3 =			\
122 				buf->timecode.userbits[3];		\
123 			__entry->sequence = buf->sequence;		\
124 		),							\
125 									\
126 		TP_printk("minor = %d, index = %u, type = %s, "		\
127 			  "bytesused = %u, flags = %s, "		\
128 			  "field = %s, timestamp = %llu, timecode = { "	\
129 			  "type = %s, flags = %s, frames = %u, "	\
130 			  "seconds = %u, minutes = %u, hours = %u, "	\
131 			  "userbits = { %u %u %u %u } }, "		\
132 			  "sequence = %u", __entry->minor,		\
133 			  __entry->index, show_type(__entry->type),	\
134 			  __entry->bytesused,				\
135 			  show_flags(__entry->flags),			\
136 			  show_field(__entry->field),			\
137 			  __entry->timestamp,				\
138 			  show_timecode_type(__entry->timecode_type),	\
139 			  show_timecode_flags(__entry->timecode_flags),	\
140 			  __entry->timecode_frames,			\
141 			  __entry->timecode_seconds,			\
142 			  __entry->timecode_minutes,			\
143 			  __entry->timecode_hours,			\
144 			  __entry->timecode_userbits0,			\
145 			  __entry->timecode_userbits1,			\
146 			  __entry->timecode_userbits2,			\
147 			  __entry->timecode_userbits3,			\
148 			  __entry->sequence				\
149 		)							\
150 	)
151 
152 V4L2_TRACE_EVENT(v4l2_dqbuf);
153 V4L2_TRACE_EVENT(v4l2_qbuf);
154 
155 #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
156 
157 /* This part must be outside protection */
158 #include <trace/define_trace.h>
159