1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_VISL_TRACE_VP9_H_) || defined(TRACE_HEADER_MULTI_READ)
3 #define _VISL_TRACE_VP9_H_
4 
5 #include <linux/tracepoint.h>
6 #include "visl.h"
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM visl_vp9_controls
10 
11 DECLARE_EVENT_CLASS(v4l2_ctrl_vp9_frame_tmpl,
12 	TP_PROTO(const struct v4l2_ctrl_vp9_frame *f),
13 	TP_ARGS(f),
14 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_vp9_frame, f)),
15 	TP_fast_assign(__entry->f = *f;),
16 	TP_printk("\nlf.ref_deltas %s\n"
17 		  "lf.mode_deltas %s\n"
18 		  "lf.level %u\n"
19 		  "lf.sharpness %u\n"
20 		  "lf.flags %s\n"
21 		  "quant.base_q_idx %u\n"
22 		  "quant.delta_q_y_dc %d\n"
23 		  "quant.delta_q_uv_dc %d\n"
24 		  "quant.delta_q_uv_ac %d\n"
25 		  "seg.feature_data {%s}\n"
26 		  "seg.feature_enabled %s\n"
27 		  "seg.tree_probs %s\n"
28 		  "seg.pred_probs %s\n"
29 		  "seg.flags %s\n"
30 		  "flags %s\n"
31 		  "compressed_header_size %u\n"
32 		  "uncompressed_header_size %u\n"
33 		  "frame_width_minus_1 %u\n"
34 		  "frame_height_minus_1 %u\n"
35 		  "render_width_minus_1 %u\n"
36 		  "render_height_minus_1 %u\n"
37 		  "last_frame_ts %llu\n"
38 		  "golden_frame_ts %llu\n"
39 		  "alt_frame_ts %llu\n"
40 		  "ref_frame_sign_bias %s\n"
41 		  "reset_frame_context %s\n"
42 		  "frame_context_idx %u\n"
43 		  "profile %u\n"
44 		  "bit_depth %u\n"
45 		  "interpolation_filter %s\n"
46 		  "tile_cols_log2 %u\n"
47 		  "tile_rows_log_2 %u\n"
48 		  "reference_mode %s\n",
49 		  __print_array(__entry->f.lf.ref_deltas,
50 				ARRAY_SIZE(__entry->f.lf.ref_deltas),
51 				sizeof(__entry->f.lf.ref_deltas[0])),
52 		  __print_array(__entry->f.lf.mode_deltas,
53 				ARRAY_SIZE(__entry->f.lf.mode_deltas),
54 				sizeof(__entry->f.lf.mode_deltas[0])),
55 		  __entry->f.lf.level,
56 		  __entry->f.lf.sharpness,
57 		  __print_flags(__entry->f.lf.flags, "|",
58 		  {V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED, "DELTA_ENABLED"},
59 		  {V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE, "DELTA_UPDATE"}),
60 		  __entry->f.quant.base_q_idx,
61 		  __entry->f.quant.delta_q_y_dc,
62 		  __entry->f.quant.delta_q_uv_dc,
63 		  __entry->f.quant.delta_q_uv_ac,
64 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
65 				   __entry->f.seg.feature_data,
66 				   sizeof(__entry->f.seg.feature_data),
67 				   false),
68 		  __print_array(__entry->f.seg.feature_enabled,
69 				ARRAY_SIZE(__entry->f.seg.feature_enabled),
70 				sizeof(__entry->f.seg.feature_enabled[0])),
71 		  __print_array(__entry->f.seg.tree_probs,
72 				ARRAY_SIZE(__entry->f.seg.tree_probs),
73 				sizeof(__entry->f.seg.tree_probs[0])),
74 		  __print_array(__entry->f.seg.pred_probs,
75 				ARRAY_SIZE(__entry->f.seg.pred_probs),
76 				sizeof(__entry->f.seg.pred_probs[0])),
77 		  __print_flags(__entry->f.seg.flags, "|",
78 		  {V4L2_VP9_SEGMENTATION_FLAG_ENABLED, "ENABLED"},
79 		  {V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP, "UPDATE_MAP"},
80 		  {V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE, "TEMPORAL_UPDATE"},
81 		  {V4L2_VP9_SEGMENTATION_FLAG_UPDATE_DATA, "UPDATE_DATA"},
82 		  {V4L2_VP9_SEGMENTATION_FLAG_ABS_OR_DELTA_UPDATE, "ABS_OR_DELTA_UPDATE"}),
83 		  __print_flags(__entry->f.flags, "|",
84 		  {V4L2_VP9_FRAME_FLAG_KEY_FRAME, "KEY_FRAME"},
85 		  {V4L2_VP9_FRAME_FLAG_SHOW_FRAME, "SHOW_FRAME"},
86 		  {V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT, "ERROR_RESILIENT"},
87 		  {V4L2_VP9_FRAME_FLAG_INTRA_ONLY, "INTRA_ONLY"},
88 		  {V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV, "ALLOW_HIGH_PREC_MV"},
89 		  {V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX, "REFRESH_FRAME_CTX"},
90 		  {V4L2_VP9_FRAME_FLAG_PARALLEL_DEC_MODE, "PARALLEL_DEC_MODE"},
91 		  {V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING, "X_SUBSAMPLING"},
92 		  {V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING, "Y_SUBSAMPLING"},
93 		  {V4L2_VP9_FRAME_FLAG_COLOR_RANGE_FULL_SWING, "COLOR_RANGE_FULL_SWING"}),
94 		  __entry->f.compressed_header_size,
95 		  __entry->f.uncompressed_header_size,
96 		  __entry->f.frame_width_minus_1,
97 		  __entry->f.frame_height_minus_1,
98 		  __entry->f.render_width_minus_1,
99 		  __entry->f.render_height_minus_1,
100 		  __entry->f.last_frame_ts,
101 		  __entry->f.golden_frame_ts,
102 		  __entry->f.alt_frame_ts,
103 		  __print_symbolic(__entry->f.ref_frame_sign_bias,
104 		  {V4L2_VP9_SIGN_BIAS_LAST, "SIGN_BIAS_LAST"},
105 		  {V4L2_VP9_SIGN_BIAS_GOLDEN, "SIGN_BIAS_GOLDEN"},
106 		  {V4L2_VP9_SIGN_BIAS_ALT, "SIGN_BIAS_ALT"}),
107 		  __print_symbolic(__entry->f.reset_frame_context,
108 		  {V4L2_VP9_RESET_FRAME_CTX_NONE, "RESET_FRAME_CTX_NONE"},
109 		  {V4L2_VP9_RESET_FRAME_CTX_SPEC, "RESET_FRAME_CTX_SPEC"},
110 		  {V4L2_VP9_RESET_FRAME_CTX_ALL, "RESET_FRAME_CTX_ALL"}),
111 		  __entry->f.frame_context_idx,
112 		  __entry->f.profile,
113 		  __entry->f.bit_depth,
114 		  __print_symbolic(__entry->f.interpolation_filter,
115 		  {V4L2_VP9_INTERP_FILTER_EIGHTTAP, "INTERP_FILTER_EIGHTTAP"},
116 		  {V4L2_VP9_INTERP_FILTER_EIGHTTAP_SMOOTH, "INTERP_FILTER_EIGHTTAP_SMOOTH"},
117 		  {V4L2_VP9_INTERP_FILTER_EIGHTTAP_SHARP, "INTERP_FILTER_EIGHTTAP_SHARP"},
118 		  {V4L2_VP9_INTERP_FILTER_BILINEAR, "INTERP_FILTER_BILINEAR"},
119 		  {V4L2_VP9_INTERP_FILTER_SWITCHABLE, "INTERP_FILTER_SWITCHABLE"}),
120 		  __entry->f.tile_cols_log2,
121 		  __entry->f.tile_rows_log2,
122 		  __print_symbolic(__entry->f.reference_mode,
123 		  {V4L2_VP9_REFERENCE_MODE_SINGLE_REFERENCE, "REFERENCE_MODE_SINGLE_REFERENCE"},
124 		  {V4L2_VP9_REFERENCE_MODE_COMPOUND_REFERENCE, "REFERENCE_MODE_COMPOUND_REFERENCE"},
125 		  {V4L2_VP9_REFERENCE_MODE_SELECT, "REFERENCE_MODE_SELECT"}))
126 );
127 
128 DECLARE_EVENT_CLASS(v4l2_ctrl_vp9_compressed_hdr_tmpl,
129 	TP_PROTO(const struct v4l2_ctrl_vp9_compressed_hdr *h),
130 	TP_ARGS(h),
131 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_vp9_compressed_hdr, h)),
132 	TP_fast_assign(__entry->h = *h;),
133 	TP_printk("\ntx_mode %s\n"
134 		  "tx8 {%s}\n"
135 		  "tx16 {%s}\n"
136 		  "tx32 {%s}\n"
137 		  "skip %s\n"
138 		  "inter_mode {%s}\n"
139 		  "interp_filter {%s}\n"
140 		  "is_inter %s\n"
141 		  "comp_mode %s\n"
142 		  "single_ref {%s}\n"
143 		  "comp_ref %s\n"
144 		  "y_mode {%s}\n"
145 		  "uv_mode {%s}\n"
146 		  "partition {%s}\n",
147 		  __print_symbolic(__entry->h.tx_mode,
148 		  {V4L2_VP9_TX_MODE_ONLY_4X4, "TX_MODE_ONLY_4X4"},
149 		  {V4L2_VP9_TX_MODE_ALLOW_8X8, "TX_MODE_ALLOW_8X8"},
150 		  {V4L2_VP9_TX_MODE_ALLOW_16X16, "TX_MODE_ALLOW_16X16"},
151 		  {V4L2_VP9_TX_MODE_ALLOW_32X32, "TX_MODE_ALLOW_32X32"},
152 		  {V4L2_VP9_TX_MODE_SELECT, "TX_MODE_SELECT"}),
153 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
154 				   __entry->h.tx8,
155 				   sizeof(__entry->h.tx8),
156 				   false),
157 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
158 				   __entry->h.tx16,
159 				   sizeof(__entry->h.tx16),
160 				   false),
161 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
162 				   __entry->h.tx32,
163 				   sizeof(__entry->h.tx32),
164 				   false),
165 		  __print_array(__entry->h.skip,
166 				ARRAY_SIZE(__entry->h.skip),
167 				sizeof(__entry->h.skip[0])),
168 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
169 				   __entry->h.inter_mode,
170 				   sizeof(__entry->h.inter_mode),
171 				   false),
172 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
173 				   __entry->h.interp_filter,
174 				   sizeof(__entry->h.interp_filter),
175 				   false),
176 		  __print_array(__entry->h.is_inter,
177 				ARRAY_SIZE(__entry->h.is_inter),
178 				sizeof(__entry->h.is_inter[0])),
179 		  __print_array(__entry->h.comp_mode,
180 				ARRAY_SIZE(__entry->h.comp_mode),
181 				sizeof(__entry->h.comp_mode[0])),
182 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
183 				   __entry->h.single_ref,
184 				   sizeof(__entry->h.single_ref),
185 				   false),
186 		  __print_array(__entry->h.comp_ref,
187 				ARRAY_SIZE(__entry->h.comp_ref),
188 				sizeof(__entry->h.comp_ref[0])),
189 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
190 				   __entry->h.y_mode,
191 				   sizeof(__entry->h.y_mode),
192 				   false),
193 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
194 				   __entry->h.uv_mode,
195 				   sizeof(__entry->h.uv_mode),
196 				   false),
197 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
198 				   __entry->h.partition,
199 				   sizeof(__entry->h.partition),
200 				   false)
201 	)
202 );
203 
204 DECLARE_EVENT_CLASS(v4l2_ctrl_vp9_compressed_coef_tmpl,
205 	TP_PROTO(const struct v4l2_ctrl_vp9_compressed_hdr *h),
206 	TP_ARGS(h),
207 	TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_vp9_compressed_hdr, h)),
208 	TP_fast_assign(__entry->h = *h;),
209 	TP_printk("\n coef {%s}",
210 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
211 				   __entry->h.coef,
212 				   sizeof(__entry->h.coef),
213 				   false)
214 	)
215 );
216 
217 DECLARE_EVENT_CLASS(v4l2_vp9_mv_probs_tmpl,
218 	TP_PROTO(const struct v4l2_vp9_mv_probs *p),
219 	TP_ARGS(p),
220 	TP_STRUCT__entry(__field_struct(struct v4l2_vp9_mv_probs, p)),
221 	TP_fast_assign(__entry->p = *p;),
222 	TP_printk("\n joint %s\n"
223 		  "sign %s\n"
224 		  "classes {%s}\n"
225 		  "class0_bit %s\n"
226 		  "bits {%s}\n"
227 		  "class0_fr {%s}\n"
228 		  "fr {%s}\n"
229 		  "class0_hp %s\n"
230 		  "hp %s\n",
231 		  __print_array(__entry->p.joint,
232 				ARRAY_SIZE(__entry->p.joint),
233 				sizeof(__entry->p.joint[0])),
234 		  __print_array(__entry->p.sign,
235 				ARRAY_SIZE(__entry->p.sign),
236 				sizeof(__entry->p.sign[0])),
237 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
238 				   __entry->p.classes,
239 				   sizeof(__entry->p.classes),
240 				   false),
241 		  __print_array(__entry->p.class0_bit,
242 				ARRAY_SIZE(__entry->p.class0_bit),
243 				sizeof(__entry->p.class0_bit[0])),
244 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
245 				   __entry->p.bits,
246 				   sizeof(__entry->p.bits),
247 				   false),
248 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
249 				   __entry->p.class0_fr,
250 				   sizeof(__entry->p.class0_fr),
251 				   false),
252 		  __print_hex_dump("", DUMP_PREFIX_NONE, 32, 1,
253 				   __entry->p.fr,
254 				   sizeof(__entry->p.fr),
255 				   false),
256 		  __print_array(__entry->p.class0_hp,
257 				ARRAY_SIZE(__entry->p.class0_hp),
258 				sizeof(__entry->p.class0_hp[0])),
259 		  __print_array(__entry->p.hp,
260 				ARRAY_SIZE(__entry->p.hp),
261 				sizeof(__entry->p.hp[0]))
262 	)
263 );
264 
265 DEFINE_EVENT(v4l2_ctrl_vp9_frame_tmpl, v4l2_ctrl_vp9_frame,
266 	TP_PROTO(const struct v4l2_ctrl_vp9_frame *f),
267 	TP_ARGS(f)
268 );
269 
270 DEFINE_EVENT(v4l2_ctrl_vp9_compressed_hdr_tmpl, v4l2_ctrl_vp9_compressed_hdr,
271 	TP_PROTO(const struct v4l2_ctrl_vp9_compressed_hdr *h),
272 	TP_ARGS(h)
273 );
274 
275 DEFINE_EVENT(v4l2_ctrl_vp9_compressed_coef_tmpl, v4l2_ctrl_vp9_compressed_coeff,
276 	TP_PROTO(const struct v4l2_ctrl_vp9_compressed_hdr *h),
277 	TP_ARGS(h)
278 );
279 
280 
281 DEFINE_EVENT(v4l2_vp9_mv_probs_tmpl, v4l2_vp9_mv_probs,
282 	TP_PROTO(const struct v4l2_vp9_mv_probs *p),
283 	TP_ARGS(p)
284 );
285 
286 #endif
287 
288 #undef TRACE_INCLUDE_PATH
289 #undef TRACE_INCLUDE_FILE
290 #define TRACE_INCLUDE_PATH ../../drivers/media/test-drivers/visl
291 #define TRACE_INCLUDE_FILE visl-trace-vp9
292 #include <trace/define_trace.h>
293