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