xref: /linux/drivers/media/test-drivers/visl/visl-trace-h264.h (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_VISL_TRACE_H264_H_) || defined(TRACE_HEADER_MULTI_READ)
3 #define _VISL_TRACE_H264_H_
4 
5 #include <linux/tracepoint.h>
6 #include "visl.h"
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM visl_h264_controls
10 
11 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_sps_tmpl,
12 	TP_PROTO(const struct v4l2_ctrl_h264_sps *s),
13 	TP_ARGS(s),
14 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_sps, s)),
15 	TP_fast_assign(__entry->s = *s),
16 	TP_printk("\nprofile_idc %u\n"
17 		  "constraint_set_flags %s\n"
18 		  "level_idc %u\n"
19 		  "seq_parameter_set_id %u\n"
20 		  "chroma_format_idc %u\n"
21 		  "bit_depth_luma_minus8 %u\n"
22 		  "bit_depth_chroma_minus8 %u\n"
23 		  "log2_max_frame_num_minus4 %u\n"
24 		  "pic_order_cnt_type %u\n"
25 		  "log2_max_pic_order_cnt_lsb_minus4 %u\n"
26 		  "max_num_ref_frames %u\n"
27 		  "num_ref_frames_in_pic_order_cnt_cycle %u\n"
28 		  "offset_for_ref_frame %s\n"
29 		  "offset_for_non_ref_pic %d\n"
30 		  "offset_for_top_to_bottom_field %d\n"
31 		  "pic_width_in_mbs_minus1 %u\n"
32 		  "pic_height_in_map_units_minus1 %u\n"
33 		  "flags %s",
34 		  __entry->s.profile_idc,
35 		  __print_flags(__entry->s.constraint_set_flags, "|",
36 		  {V4L2_H264_SPS_CONSTRAINT_SET0_FLAG, "CONSTRAINT_SET0_FLAG"},
37 		  {V4L2_H264_SPS_CONSTRAINT_SET1_FLAG, "CONSTRAINT_SET1_FLAG"},
38 		  {V4L2_H264_SPS_CONSTRAINT_SET2_FLAG, "CONSTRAINT_SET2_FLAG"},
39 		  {V4L2_H264_SPS_CONSTRAINT_SET3_FLAG, "CONSTRAINT_SET3_FLAG"},
40 		  {V4L2_H264_SPS_CONSTRAINT_SET4_FLAG, "CONSTRAINT_SET4_FLAG"},
41 		  {V4L2_H264_SPS_CONSTRAINT_SET5_FLAG, "CONSTRAINT_SET5_FLAG"}),
42 		  __entry->s.level_idc,
43 		  __entry->s.seq_parameter_set_id,
44 		  __entry->s.chroma_format_idc,
45 		  __entry->s.bit_depth_luma_minus8,
46 		  __entry->s.bit_depth_chroma_minus8,
47 		  __entry->s.log2_max_frame_num_minus4,
48 		  __entry->s.pic_order_cnt_type,
49 		  __entry->s.log2_max_pic_order_cnt_lsb_minus4,
50 		  __entry->s.max_num_ref_frames,
51 		  __entry->s.num_ref_frames_in_pic_order_cnt_cycle,
52 		  __print_array(__entry->s.offset_for_ref_frame,
53 				ARRAY_SIZE(__entry->s.offset_for_ref_frame),
54 				sizeof(__entry->s.offset_for_ref_frame[0])),
55 		  __entry->s.offset_for_non_ref_pic,
56 		  __entry->s.offset_for_top_to_bottom_field,
57 		  __entry->s.pic_width_in_mbs_minus1,
58 		  __entry->s.pic_height_in_map_units_minus1,
59 		  __print_flags(__entry->s.flags, "|",
60 		  {V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE, "SEPARATE_COLOUR_PLANE"},
61 		  {V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS, "QPPRIME_Y_ZERO_TRANSFORM_BYPASS"},
62 		  {V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO, "DELTA_PIC_ORDER_ALWAYS_ZERO"},
63 		  {V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED, "GAPS_IN_FRAME_NUM_VALUE_ALLOWED"},
64 		  {V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY, "FRAME_MBS_ONLY"},
65 		  {V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD, "MB_ADAPTIVE_FRAME_FIELD"},
66 		  {V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE, "DIRECT_8X8_INFERENCE"}
67 		  ))
68 );
69 
70 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_pps_tmpl,
71 	TP_PROTO(const struct v4l2_ctrl_h264_pps *p),
72 	TP_ARGS(p),
73 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_pps, p)),
74 	TP_fast_assign(__entry->p = *p),
75 	TP_printk("\npic_parameter_set_id %u\n"
76 		  "seq_parameter_set_id %u\n"
77 		  "num_slice_groups_minus1 %u\n"
78 		  "num_ref_idx_l0_default_active_minus1 %u\n"
79 		  "num_ref_idx_l1_default_active_minus1 %u\n"
80 		  "weighted_bipred_idc %u\n"
81 		  "pic_init_qp_minus26 %d\n"
82 		  "pic_init_qs_minus26 %d\n"
83 		  "chroma_qp_index_offset %d\n"
84 		  "second_chroma_qp_index_offset %d\n"
85 		  "flags %s",
86 		  __entry->p.pic_parameter_set_id,
87 		  __entry->p.seq_parameter_set_id,
88 		  __entry->p.num_slice_groups_minus1,
89 		  __entry->p.num_ref_idx_l0_default_active_minus1,
90 		  __entry->p.num_ref_idx_l1_default_active_minus1,
91 		  __entry->p.weighted_bipred_idc,
92 		  __entry->p.pic_init_qp_minus26,
93 		  __entry->p.pic_init_qs_minus26,
94 		  __entry->p.chroma_qp_index_offset,
95 		  __entry->p.second_chroma_qp_index_offset,
96 		  __print_flags(__entry->p.flags, "|",
97 		  {V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE, "ENTROPY_CODING_MODE"},
98 		  {V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT, "BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT"},
99 		  {V4L2_H264_PPS_FLAG_WEIGHTED_PRED, "WEIGHTED_PRED"},
100 		  {V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT, "DEBLOCKING_FILTER_CONTROL_PRESENT"},
101 		  {V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED, "CONSTRAINED_INTRA_PRED"},
102 		  {V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT, "REDUNDANT_PIC_CNT_PRESENT"},
103 		  {V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE, "TRANSFORM_8X8_MODE"},
104 		  {V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT, "SCALING_MATRIX_PRESENT"}
105 		  ))
106 );
107 
108 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_scaling_matrix_tmpl,
109 	TP_PROTO(const struct v4l2_ctrl_h264_scaling_matrix *s),
110 	TP_ARGS(s),
111 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_scaling_matrix, s)),
112 	TP_fast_assign(__entry->s = *s),
113 	TP_printk("\nscaling_list_4x4 {%s}\nscaling_list_8x8 {%s}",
114 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
115 				   __entry->s.scaling_list_4x4,
116 				   sizeof(__entry->s.scaling_list_4x4),
117 				   false),
118 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
119 				   __entry->s.scaling_list_8x8,
120 				   sizeof(__entry->s.scaling_list_8x8),
121 				   false)
122 	)
123 );
124 
125 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_pred_weights_tmpl,
126 	TP_PROTO(const struct v4l2_ctrl_h264_pred_weights *p),
127 	TP_ARGS(p),
128 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_pred_weights, p)),
129 	TP_fast_assign(__entry->p = *p),
130 	TP_printk("\nluma_log2_weight_denom %u\n"
131 		  "chroma_log2_weight_denom %u\n"
132 		  "weight_factor[0].luma_weight %s\n"
133 		  "weight_factor[0].luma_offset %s\n"
134 		  "weight_factor[0].chroma_weight {%s}\n"
135 		  "weight_factor[0].chroma_offset {%s}\n"
136 		  "weight_factor[1].luma_weight %s\n"
137 		  "weight_factor[1].luma_offset %s\n"
138 		  "weight_factor[1].chroma_weight {%s}\n"
139 		  "weight_factor[1].chroma_offset {%s}\n",
140 		  __entry->p.luma_log2_weight_denom,
141 		  __entry->p.chroma_log2_weight_denom,
142 		  __print_array(__entry->p.weight_factors[0].luma_weight,
143 				ARRAY_SIZE(__entry->p.weight_factors[0].luma_weight),
144 				sizeof(__entry->p.weight_factors[0].luma_weight[0])),
145 		  __print_array(__entry->p.weight_factors[0].luma_offset,
146 				ARRAY_SIZE(__entry->p.weight_factors[0].luma_offset),
147 				sizeof(__entry->p.weight_factors[0].luma_offset[0])),
148 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
149 				   __entry->p.weight_factors[0].chroma_weight,
150 				   sizeof(__entry->p.weight_factors[0].chroma_weight),
151 				   false),
152 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
153 				   __entry->p.weight_factors[0].chroma_offset,
154 				   sizeof(__entry->p.weight_factors[0].chroma_offset),
155 				   false),
156 		  __print_array(__entry->p.weight_factors[1].luma_weight,
157 				ARRAY_SIZE(__entry->p.weight_factors[1].luma_weight),
158 				sizeof(__entry->p.weight_factors[1].luma_weight[0])),
159 		  __print_array(__entry->p.weight_factors[1].luma_offset,
160 				ARRAY_SIZE(__entry->p.weight_factors[1].luma_offset),
161 				sizeof(__entry->p.weight_factors[1].luma_offset[0])),
162 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
163 				   __entry->p.weight_factors[1].chroma_weight,
164 				   sizeof(__entry->p.weight_factors[1].chroma_weight),
165 				   false),
166 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
167 				   __entry->p.weight_factors[1].chroma_offset,
168 				   sizeof(__entry->p.weight_factors[1].chroma_offset),
169 				   false)
170 	)
171 );
172 
173 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_slice_params_tmpl,
174 	TP_PROTO(const struct v4l2_ctrl_h264_slice_params *s),
175 	TP_ARGS(s),
176 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_slice_params, s)),
177 	TP_fast_assign(__entry->s = *s),
178 	TP_printk("\nheader_bit_size %u\n"
179 		  "first_mb_in_slice %u\n"
180 		  "slice_type %s\n"
181 		  "colour_plane_id %u\n"
182 		  "redundant_pic_cnt %u\n"
183 		  "cabac_init_idc %u\n"
184 		  "slice_qp_delta %d\n"
185 		  "slice_qs_delta %d\n"
186 		  "disable_deblocking_filter_idc %u\n"
187 		  "slice_alpha_c0_offset_div2 %u\n"
188 		  "slice_beta_offset_div2 %u\n"
189 		  "num_ref_idx_l0_active_minus1 %u\n"
190 		  "num_ref_idx_l1_active_minus1 %u\n"
191 		  "flags %s",
192 		  __entry->s.header_bit_size,
193 		  __entry->s.first_mb_in_slice,
194 		  __print_symbolic(__entry->s.slice_type,
195 		  {V4L2_H264_SLICE_TYPE_P, "P"},
196 		  {V4L2_H264_SLICE_TYPE_B, "B"},
197 		  {V4L2_H264_SLICE_TYPE_I, "I"},
198 		  {V4L2_H264_SLICE_TYPE_SP, "SP"},
199 		  {V4L2_H264_SLICE_TYPE_SI, "SI"}),
200 		  __entry->s.colour_plane_id,
201 		  __entry->s.redundant_pic_cnt,
202 		  __entry->s.cabac_init_idc,
203 		  __entry->s.slice_qp_delta,
204 		  __entry->s.slice_qs_delta,
205 		  __entry->s.disable_deblocking_filter_idc,
206 		  __entry->s.slice_alpha_c0_offset_div2,
207 		  __entry->s.slice_beta_offset_div2,
208 		  __entry->s.num_ref_idx_l0_active_minus1,
209 		  __entry->s.num_ref_idx_l1_active_minus1,
210 		  __print_flags(__entry->s.flags, "|",
211 		  {V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED, "DIRECT_SPATIAL_MV_PRED"},
212 		  {V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH, "SP_FOR_SWITCH"})
213 	)
214 );
215 
216 DECLARE_EVENT_CLASS(v4l2_h264_reference_tmpl,
217 	TP_PROTO(const struct v4l2_h264_reference *r, int i),
218 	TP_ARGS(r, i),
219 	TP_STRUCT__entry(__field_struct(struct v4l2_h264_reference, r)
220 			 __field(int, i)),
221 	TP_fast_assign(__entry->r = *r; __entry->i = i;),
222 	TP_printk("[%d]: fields %s index %u",
223 		  __entry->i,
224 		  __print_flags(__entry->r.fields, "|",
225 		  {V4L2_H264_TOP_FIELD_REF, "TOP_FIELD_REF"},
226 		  {V4L2_H264_BOTTOM_FIELD_REF, "BOTTOM_FIELD_REF"},
227 		  {V4L2_H264_FRAME_REF, "FRAME_REF"}),
228 		  __entry->r.index
229 	)
230 );
231 
232 DECLARE_EVENT_CLASS(v4l2_ctrl_h264_decode_params_tmpl,
233 	TP_PROTO(const struct v4l2_ctrl_h264_decode_params *d),
234 	TP_ARGS(d),
235 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_h264_decode_params, d)),
236 	TP_fast_assign(__entry->d = *d),
237 	TP_printk("\nnal_ref_idc %u\n"
238 		  "frame_num %u\n"
239 		  "top_field_order_cnt %d\n"
240 		  "bottom_field_order_cnt %d\n"
241 		  "idr_pic_id %u\n"
242 		  "pic_order_cnt_lsb %u\n"
243 		  "delta_pic_order_cnt_bottom %d\n"
244 		  "delta_pic_order_cnt0 %d\n"
245 		  "delta_pic_order_cnt1 %d\n"
246 		  "dec_ref_pic_marking_bit_size %u\n"
247 		  "pic_order_cnt_bit_size %u\n"
248 		  "slice_group_change_cycle %u\n"
249 		  "flags %s\n",
250 		  __entry->d.nal_ref_idc,
251 		  __entry->d.frame_num,
252 		  __entry->d.top_field_order_cnt,
253 		  __entry->d.bottom_field_order_cnt,
254 		  __entry->d.idr_pic_id,
255 		  __entry->d.pic_order_cnt_lsb,
256 		  __entry->d.delta_pic_order_cnt_bottom,
257 		  __entry->d.delta_pic_order_cnt0,
258 		  __entry->d.delta_pic_order_cnt1,
259 		  __entry->d.dec_ref_pic_marking_bit_size,
260 		  __entry->d.pic_order_cnt_bit_size,
261 		  __entry->d.slice_group_change_cycle,
262 		  __print_flags(__entry->d.flags, "|",
263 		  {V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC, "IDR_PIC"},
264 		  {V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC, "FIELD_PIC"},
265 		  {V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD, "BOTTOM_FIELD"},
266 		  {V4L2_H264_DECODE_PARAM_FLAG_PFRAME, "PFRAME"},
267 		  {V4L2_H264_DECODE_PARAM_FLAG_BFRAME, "BFRAME"})
268 	)
269 );
270 
271 DECLARE_EVENT_CLASS(v4l2_h264_dpb_entry_tmpl,
272 	TP_PROTO(const struct v4l2_h264_dpb_entry *e, int i),
273 	TP_ARGS(e, i),
274 	TP_STRUCT__entry(__field_struct(struct v4l2_h264_dpb_entry, e)
275 			 __field(int, i)),
276 	TP_fast_assign(__entry->e = *e; __entry->i = i;),
277 	TP_printk("[%d]: reference_ts %llu, pic_num %u frame_num %u fields %s "
278 		  "top_field_order_cnt %d bottom_field_order_cnt %d flags %s",
279 		  __entry->i,
280 		  __entry->e.reference_ts,
281 		  __entry->e.pic_num,
282 		  __entry->e.frame_num,
283 		  __print_flags(__entry->e.fields, "|",
284 		  {V4L2_H264_TOP_FIELD_REF, "TOP_FIELD_REF"},
285 		  {V4L2_H264_BOTTOM_FIELD_REF, "BOTTOM_FIELD_REF"},
286 		  {V4L2_H264_FRAME_REF, "FRAME_REF"}),
287 		  __entry->e.top_field_order_cnt,
288 		  __entry->e.bottom_field_order_cnt,
289 		  __print_flags(__entry->e.flags, "|",
290 		  {V4L2_H264_DPB_ENTRY_FLAG_VALID, "VALID"},
291 		  {V4L2_H264_DPB_ENTRY_FLAG_ACTIVE, "ACTIVE"},
292 		  {V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM, "LONG_TERM"},
293 		  {V4L2_H264_DPB_ENTRY_FLAG_FIELD, "FIELD"})
294 
295 	)
296 );
297 
298 DEFINE_EVENT(v4l2_ctrl_h264_sps_tmpl, v4l2_ctrl_h264_sps,
299 	TP_PROTO(const struct v4l2_ctrl_h264_sps *s),
300 	TP_ARGS(s)
301 );
302 
303 DEFINE_EVENT(v4l2_ctrl_h264_pps_tmpl, v4l2_ctrl_h264_pps,
304 	TP_PROTO(const struct v4l2_ctrl_h264_pps *p),
305 	TP_ARGS(p)
306 );
307 
308 DEFINE_EVENT(v4l2_ctrl_h264_scaling_matrix_tmpl, v4l2_ctrl_h264_scaling_matrix,
309 	TP_PROTO(const struct v4l2_ctrl_h264_scaling_matrix *s),
310 	TP_ARGS(s)
311 );
312 
313 DEFINE_EVENT(v4l2_ctrl_h264_pred_weights_tmpl, v4l2_ctrl_h264_pred_weights,
314 	TP_PROTO(const struct v4l2_ctrl_h264_pred_weights *p),
315 	TP_ARGS(p)
316 );
317 
318 DEFINE_EVENT(v4l2_ctrl_h264_slice_params_tmpl, v4l2_ctrl_h264_slice_params,
319 	TP_PROTO(const struct v4l2_ctrl_h264_slice_params *s),
320 	TP_ARGS(s)
321 );
322 
323 DEFINE_EVENT(v4l2_h264_reference_tmpl, v4l2_h264_ref_pic_list0,
324 	TP_PROTO(const struct v4l2_h264_reference *r, int i),
325 	TP_ARGS(r, i)
326 );
327 
328 DEFINE_EVENT(v4l2_h264_reference_tmpl, v4l2_h264_ref_pic_list1,
329 	TP_PROTO(const struct v4l2_h264_reference *r, int i),
330 	TP_ARGS(r, i)
331 );
332 
333 DEFINE_EVENT(v4l2_ctrl_h264_decode_params_tmpl, v4l2_ctrl_h264_decode_params,
334 	TP_PROTO(const struct v4l2_ctrl_h264_decode_params *d),
335 	TP_ARGS(d)
336 );
337 
338 DEFINE_EVENT(v4l2_h264_dpb_entry_tmpl, v4l2_h264_dpb_entry,
339 	TP_PROTO(const struct v4l2_h264_dpb_entry *e, int i),
340 	TP_ARGS(e, i)
341 );
342 
343 #endif
344 
345 #undef TRACE_INCLUDE_PATH
346 #undef TRACE_INCLUDE_FILE
347 #define TRACE_INCLUDE_PATH ../../drivers/media/test-drivers/visl
348 #define TRACE_INCLUDE_FILE visl-trace-h264
349 #include <trace/define_trace.h>
350