Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM v4l2
0004 
0005 #if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_V4L2_H
0007 
0008 #include <linux/tracepoint.h>
0009 #include <media/videobuf2-v4l2.h>
0010 
0011 /* Enums require being exported to userspace, for user tool parsing */
0012 #undef EM
0013 #undef EMe
0014 #define EM(a, b)    TRACE_DEFINE_ENUM(a);
0015 #define EMe(a, b)   TRACE_DEFINE_ENUM(a);
0016 
0017 #define show_type(type)                         \
0018     __print_symbolic(type, SHOW_TYPE)
0019 
0020 #define SHOW_TYPE                           \
0021     EM( V4L2_BUF_TYPE_VIDEO_CAPTURE,    "VIDEO_CAPTURE" )   \
0022     EM( V4L2_BUF_TYPE_VIDEO_OUTPUT,     "VIDEO_OUTPUT" )    \
0023     EM( V4L2_BUF_TYPE_VIDEO_OVERLAY,    "VIDEO_OVERLAY" )   \
0024     EM( V4L2_BUF_TYPE_VBI_CAPTURE,      "VBI_CAPTURE" )     \
0025     EM( V4L2_BUF_TYPE_VBI_OUTPUT,       "VBI_OUTPUT" )      \
0026     EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,   "SLICED_VBI_CAPTURE" )  \
0027     EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,    "SLICED_VBI_OUTPUT" )   \
0028     EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \
0029     EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \
0030     EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,  "VIDEO_OUTPUT_MPLANE" ) \
0031     EM( V4L2_BUF_TYPE_SDR_CAPTURE,          "SDR_CAPTURE" )     \
0032     EM( V4L2_BUF_TYPE_SDR_OUTPUT,           "SDR_OUTPUT" )      \
0033     EM( V4L2_BUF_TYPE_META_CAPTURE,     "META_CAPTURE" )    \
0034     EMe(V4L2_BUF_TYPE_PRIVATE,      "PRIVATE" )
0035 
0036 SHOW_TYPE
0037 
0038 #define show_field(field)                       \
0039     __print_symbolic(field, SHOW_FIELD)
0040 
0041 #define SHOW_FIELD                          \
0042     EM( V4L2_FIELD_ANY,     "ANY" )             \
0043     EM( V4L2_FIELD_NONE,        "NONE" )            \
0044     EM( V4L2_FIELD_TOP,     "TOP" )             \
0045     EM( V4L2_FIELD_BOTTOM,      "BOTTOM" )          \
0046     EM( V4L2_FIELD_INTERLACED,  "INTERLACED" )          \
0047     EM( V4L2_FIELD_SEQ_TB,      "SEQ_TB" )          \
0048     EM( V4L2_FIELD_SEQ_BT,      "SEQ_BT" )          \
0049     EM( V4L2_FIELD_ALTERNATE,   "ALTERNATE" )           \
0050     EM( V4L2_FIELD_INTERLACED_TB,   "INTERLACED_TB" )       \
0051     EMe( V4L2_FIELD_INTERLACED_BT,  "INTERLACED_BT" )
0052 
0053 SHOW_FIELD
0054 
0055 /*
0056  * Now redefine the EM() and EMe() macros to map the enums to the strings
0057  * that will be printed in the output.
0058  */
0059 #undef EM
0060 #undef EMe
0061 #define EM(a, b)    {a, b},
0062 #define EMe(a, b)   {a, b}
0063 
0064 /* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
0065 
0066 #define show_timecode_type(type)                    \
0067     __print_symbolic(type,                      \
0068         { V4L2_TC_TYPE_24FPS,       "24FPS" },      \
0069         { V4L2_TC_TYPE_25FPS,       "25FPS" },      \
0070         { V4L2_TC_TYPE_30FPS,       "30FPS" },      \
0071         { V4L2_TC_TYPE_50FPS,       "50FPS" },      \
0072         { V4L2_TC_TYPE_60FPS,       "60FPS" })
0073 
0074 #define show_flags(flags)                             \
0075     __print_flags(flags, "|",                         \
0076         { V4L2_BUF_FLAG_MAPPED,          "MAPPED" },          \
0077         { V4L2_BUF_FLAG_QUEUED,          "QUEUED" },          \
0078         { V4L2_BUF_FLAG_DONE,            "DONE" },            \
0079         { V4L2_BUF_FLAG_KEYFRAME,        "KEYFRAME" },        \
0080         { V4L2_BUF_FLAG_PFRAME,          "PFRAME" },          \
0081         { V4L2_BUF_FLAG_BFRAME,          "BFRAME" },          \
0082         { V4L2_BUF_FLAG_ERROR,           "ERROR" },           \
0083         { V4L2_BUF_FLAG_TIMECODE,        "TIMECODE" },        \
0084         { V4L2_BUF_FLAG_PREPARED,        "PREPARED" },        \
0085         { V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, "NO_CACHE_INVALIDATE" }, \
0086         { V4L2_BUF_FLAG_NO_CACHE_CLEAN,      "NO_CACHE_CLEAN" },      \
0087         { V4L2_BUF_FLAG_TIMESTAMP_MASK,      "TIMESTAMP_MASK" },      \
0088         { V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,   "TIMESTAMP_UNKNOWN" },   \
0089         { V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, "TIMESTAMP_MONOTONIC" }, \
0090         { V4L2_BUF_FLAG_TIMESTAMP_COPY,      "TIMESTAMP_COPY" },      \
0091         { V4L2_BUF_FLAG_LAST,                "LAST" })
0092 
0093 #define show_timecode_flags(flags)                    \
0094     __print_flags(flags, "|",                     \
0095         { V4L2_TC_FLAG_DROPFRAME,       "DROPFRAME" },        \
0096         { V4L2_TC_FLAG_COLORFRAME,      "COLORFRAME" },       \
0097         { V4L2_TC_USERBITS_USERDEFINED, "USERBITS_USERDEFINED" }, \
0098         { V4L2_TC_USERBITS_8BITCHARS,   "USERBITS_8BITCHARS" })
0099 
0100 DECLARE_EVENT_CLASS(v4l2_event_class,
0101     TP_PROTO(int minor, struct v4l2_buffer *buf),
0102 
0103     TP_ARGS(minor, buf),
0104 
0105     TP_STRUCT__entry(
0106         __field(int, minor)
0107         __field(u32, index)
0108         __field(u32, type)
0109         __field(u32, bytesused)
0110         __field(u32, flags)
0111         __field(u32, field)
0112         __field(s64, timestamp)
0113         __field(u32, timecode_type)
0114         __field(u32, timecode_flags)
0115         __field(u8, timecode_frames)
0116         __field(u8, timecode_seconds)
0117         __field(u8, timecode_minutes)
0118         __field(u8, timecode_hours)
0119         __field(u8, timecode_userbits0)
0120         __field(u8, timecode_userbits1)
0121         __field(u8, timecode_userbits2)
0122         __field(u8, timecode_userbits3)
0123         __field(u32, sequence)
0124     ),
0125 
0126     TP_fast_assign(
0127         __entry->minor = minor;
0128         __entry->index = buf->index;
0129         __entry->type = buf->type;
0130         __entry->bytesused = buf->bytesused;
0131         __entry->flags = buf->flags;
0132         __entry->field = buf->field;
0133         __entry->timestamp = v4l2_buffer_get_timestamp(buf);
0134         __entry->timecode_type = buf->timecode.type;
0135         __entry->timecode_flags = buf->timecode.flags;
0136         __entry->timecode_frames = buf->timecode.frames;
0137         __entry->timecode_seconds = buf->timecode.seconds;
0138         __entry->timecode_minutes = buf->timecode.minutes;
0139         __entry->timecode_hours = buf->timecode.hours;
0140         __entry->timecode_userbits0 = buf->timecode.userbits[0];
0141         __entry->timecode_userbits1 = buf->timecode.userbits[1];
0142         __entry->timecode_userbits2 = buf->timecode.userbits[2];
0143         __entry->timecode_userbits3 = buf->timecode.userbits[3];
0144         __entry->sequence = buf->sequence;
0145     ),
0146 
0147     TP_printk("minor = %d, index = %u, type = %s, bytesused = %u, "
0148           "flags = %s, field = %s, timestamp = %llu, "
0149           "timecode = { type = %s, flags = %s, frames = %u, "
0150           "seconds = %u, minutes = %u, hours = %u, "
0151           "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
0152           __entry->index, show_type(__entry->type),
0153           __entry->bytesused,
0154           show_flags(__entry->flags),
0155           show_field(__entry->field),
0156           __entry->timestamp,
0157           show_timecode_type(__entry->timecode_type),
0158           show_timecode_flags(__entry->timecode_flags),
0159           __entry->timecode_frames,
0160           __entry->timecode_seconds,
0161           __entry->timecode_minutes,
0162           __entry->timecode_hours,
0163           __entry->timecode_userbits0,
0164           __entry->timecode_userbits1,
0165           __entry->timecode_userbits2,
0166           __entry->timecode_userbits3,
0167           __entry->sequence
0168     )
0169 )
0170 
0171 DEFINE_EVENT(v4l2_event_class, v4l2_dqbuf,
0172     TP_PROTO(int minor, struct v4l2_buffer *buf),
0173     TP_ARGS(minor, buf)
0174 );
0175 
0176 DEFINE_EVENT(v4l2_event_class, v4l2_qbuf,
0177     TP_PROTO(int minor, struct v4l2_buffer *buf),
0178     TP_ARGS(minor, buf)
0179 );
0180 
0181 DECLARE_EVENT_CLASS(vb2_v4l2_event_class,
0182     TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
0183     TP_ARGS(q, vb),
0184 
0185     TP_STRUCT__entry(
0186         __field(int, minor)
0187         __field(u32, flags)
0188         __field(u32, field)
0189         __field(u64, timestamp)
0190         __field(u32, timecode_type)
0191         __field(u32, timecode_flags)
0192         __field(u8, timecode_frames)
0193         __field(u8, timecode_seconds)
0194         __field(u8, timecode_minutes)
0195         __field(u8, timecode_hours)
0196         __field(u8, timecode_userbits0)
0197         __field(u8, timecode_userbits1)
0198         __field(u8, timecode_userbits2)
0199         __field(u8, timecode_userbits3)
0200         __field(u32, sequence)
0201     ),
0202 
0203     TP_fast_assign(
0204         struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
0205         struct v4l2_fh *owner = q->owner;
0206 
0207         __entry->minor = owner ? owner->vdev->minor : -1;
0208         __entry->flags = vbuf->flags;
0209         __entry->field = vbuf->field;
0210         __entry->timestamp = vb->timestamp;
0211         __entry->timecode_type = vbuf->timecode.type;
0212         __entry->timecode_flags = vbuf->timecode.flags;
0213         __entry->timecode_frames = vbuf->timecode.frames;
0214         __entry->timecode_seconds = vbuf->timecode.seconds;
0215         __entry->timecode_minutes = vbuf->timecode.minutes;
0216         __entry->timecode_hours = vbuf->timecode.hours;
0217         __entry->timecode_userbits0 = vbuf->timecode.userbits[0];
0218         __entry->timecode_userbits1 = vbuf->timecode.userbits[1];
0219         __entry->timecode_userbits2 = vbuf->timecode.userbits[2];
0220         __entry->timecode_userbits3 = vbuf->timecode.userbits[3];
0221         __entry->sequence = vbuf->sequence;
0222     ),
0223 
0224     TP_printk("minor=%d flags = %s, field = %s, "
0225           "timestamp = %llu, timecode = { type = %s, flags = %s, "
0226           "frames = %u, seconds = %u, minutes = %u, hours = %u, "
0227           "userbits = { %u %u %u %u } }, sequence = %u", __entry->minor,
0228           show_flags(__entry->flags),
0229           show_field(__entry->field),
0230           __entry->timestamp,
0231           show_timecode_type(__entry->timecode_type),
0232           show_timecode_flags(__entry->timecode_flags),
0233           __entry->timecode_frames,
0234           __entry->timecode_seconds,
0235           __entry->timecode_minutes,
0236           __entry->timecode_hours,
0237           __entry->timecode_userbits0,
0238           __entry->timecode_userbits1,
0239           __entry->timecode_userbits2,
0240           __entry->timecode_userbits3,
0241           __entry->sequence
0242     )
0243 )
0244 
0245 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_buf_done,
0246     TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
0247     TP_ARGS(q, vb)
0248 );
0249 
0250 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_buf_queue,
0251     TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
0252     TP_ARGS(q, vb)
0253 );
0254 
0255 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_dqbuf,
0256     TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
0257     TP_ARGS(q, vb)
0258 );
0259 
0260 DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_qbuf,
0261     TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),
0262     TP_ARGS(q, vb)
0263 );
0264 
0265 #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */
0266 
0267 /* This part must be outside protection */
0268 #include <trace/define_trace.h>