v4l2.h 9.2 KB

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