v4l2.h 5.9 KB

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