v4l2.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. #define show_timecode_flags(flags) \
  75. __print_flags(flags, "|", \
  76. { V4L2_TC_FLAG_DROPFRAME, "DROPFRAME" }, \
  77. { V4L2_TC_FLAG_COLORFRAME, "COLORFRAME" }, \
  78. { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \
  79. { V4L2_TC_USERBITS_8BITCHARS, "USERBITS_8BITCHARS" })
  80. #define V4L2_TRACE_EVENT(event_name) \
  81. TRACE_EVENT(event_name, \
  82. TP_PROTO(int minor, struct v4l2_buffer *buf), \
  83. \
  84. TP_ARGS(minor, buf), \
  85. \
  86. TP_STRUCT__entry( \
  87. __field(int, minor) \
  88. __field(u32, index) \
  89. __field(u32, type) \
  90. __field(u32, bytesused) \
  91. __field(u32, flags) \
  92. __field(u32, field) \
  93. __field(s64, timestamp) \
  94. __field(u32, timecode_type) \
  95. __field(u32, timecode_flags) \
  96. __field(u8, timecode_frames) \
  97. __field(u8, timecode_seconds) \
  98. __field(u8, timecode_minutes) \
  99. __field(u8, timecode_hours) \
  100. __field(u8, timecode_userbits0) \
  101. __field(u8, timecode_userbits1) \
  102. __field(u8, timecode_userbits2) \
  103. __field(u8, timecode_userbits3) \
  104. __field(u32, sequence) \
  105. ), \
  106. \
  107. TP_fast_assign( \
  108. __entry->minor = minor; \
  109. __entry->index = buf->index; \
  110. __entry->type = buf->type; \
  111. __entry->bytesused = buf->bytesused; \
  112. __entry->flags = buf->flags; \
  113. __entry->field = buf->field; \
  114. __entry->timestamp = \
  115. timeval_to_ns(&buf->timestamp); \
  116. __entry->timecode_type = buf->timecode.type; \
  117. __entry->timecode_flags = buf->timecode.flags; \
  118. __entry->timecode_frames = \
  119. buf->timecode.frames; \
  120. __entry->timecode_seconds = \
  121. buf->timecode.seconds; \
  122. __entry->timecode_minutes = \
  123. buf->timecode.minutes; \
  124. __entry->timecode_hours = buf->timecode.hours; \
  125. __entry->timecode_userbits0 = \
  126. buf->timecode.userbits[0]; \
  127. __entry->timecode_userbits1 = \
  128. buf->timecode.userbits[1]; \
  129. __entry->timecode_userbits2 = \
  130. buf->timecode.userbits[2]; \
  131. __entry->timecode_userbits3 = \
  132. buf->timecode.userbits[3]; \
  133. __entry->sequence = buf->sequence; \
  134. ), \
  135. \
  136. TP_printk("minor = %d, index = %u, type = %s, " \
  137. "bytesused = %u, flags = %s, " \
  138. "field = %s, timestamp = %llu, timecode = { " \
  139. "type = %s, flags = %s, frames = %u, " \
  140. "seconds = %u, minutes = %u, hours = %u, " \
  141. "userbits = { %u %u %u %u } }, " \
  142. "sequence = %u", __entry->minor, \
  143. __entry->index, show_type(__entry->type), \
  144. __entry->bytesused, \
  145. show_flags(__entry->flags), \
  146. show_field(__entry->field), \
  147. __entry->timestamp, \
  148. show_timecode_type(__entry->timecode_type), \
  149. show_timecode_flags(__entry->timecode_flags), \
  150. __entry->timecode_frames, \
  151. __entry->timecode_seconds, \
  152. __entry->timecode_minutes, \
  153. __entry->timecode_hours, \
  154. __entry->timecode_userbits0, \
  155. __entry->timecode_userbits1, \
  156. __entry->timecode_userbits2, \
  157. __entry->timecode_userbits3, \
  158. __entry->sequence \
  159. ) \
  160. )
  161. V4L2_TRACE_EVENT(v4l2_dqbuf);
  162. V4L2_TRACE_EVENT(v4l2_qbuf);
  163. #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
  164. /* This part must be outside protection */
  165. #include <trace/define_trace.h>