xref: /linux/drivers/gpu/drm/i915/display/intel_display_trace.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright © 2021 Intel Corporation
4  */
5 
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM i915
8 
9 #if !defined(__INTEL_DISPLAY_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
10 #define __INTEL_DISPLAY_TRACE_H__
11 
12 #include <linux/string.h>
13 #include <linux/string_helpers.h>
14 #include <linux/types.h>
15 #include <linux/tracepoint.h>
16 
17 #include "i915_drv.h"
18 #include "intel_crtc.h"
19 #include "intel_display_limits.h"
20 #include "intel_display_types.h"
21 #include "intel_vblank.h"
22 
23 #define __dev_name_display(display) dev_name((display)->drm->dev)
24 #define __dev_name_kms(obj) dev_name((obj)->base.dev->dev)
25 
26 /*
27  * Using identifiers from enum pipe in TP_printk() will confuse tools that
28  * parse /sys/kernel/debug/tracing/{xe,i915}/<event>/format. So we use CPP
29  * macros instead.
30  */
31 #define _TRACE_PIPE_A	0
32 #define _TRACE_PIPE_B	1
33 #define _TRACE_PIPE_C	2
34 #define _TRACE_PIPE_D	3
35 
36 /*
37  * FIXME: Several TP_printk() calls below display frame and scanline numbers for
38  * all possible pipes (regardless of whether they are available) and that is
39  * done with a constant format string. A better approach would be to generate
40  * that info dynamically based on available pipes, but, while we do not have
41  * that implemented yet, let's assert that the constant format string indeed
42  * covers all possible pipes.
43  */
44 static_assert(I915_MAX_PIPES - 1 == _TRACE_PIPE_D);
45 
46 #define _PIPES_FRAME_AND_SCANLINE_FMT		\
47 	"pipe A: frame=%u, scanline=%u"		\
48 	", pipe B: frame=%u, scanline=%u"	\
49 	", pipe C: frame=%u, scanline=%u"	\
50 	", pipe D: frame=%u, scanline=%u"
51 
52 #define _PIPES_FRAME_AND_SCANLINE_VALUES					\
53 	__entry->frame[_TRACE_PIPE_A], __entry->scanline[_TRACE_PIPE_A]		\
54 	, __entry->frame[_TRACE_PIPE_B], __entry->scanline[_TRACE_PIPE_B]	\
55 	, __entry->frame[_TRACE_PIPE_C], __entry->scanline[_TRACE_PIPE_C]	\
56 	, __entry->frame[_TRACE_PIPE_D], __entry->scanline[_TRACE_PIPE_D]
57 
58 /*
59  * Paranoid sanity check that at least the enumeration starts at the
60  * same value as _TRACE_PIPE_A.
61  */
62 static_assert(PIPE_A == _TRACE_PIPE_A);
63 
64 TRACE_EVENT(intel_pipe_enable,
65 	    TP_PROTO(struct intel_crtc *crtc),
66 	    TP_ARGS(crtc),
67 
68 	    TP_STRUCT__entry(
69 			     __string(dev, __dev_name_kms(crtc))
70 			     __array(u32, frame, I915_MAX_PIPES)
71 			     __array(u32, scanline, I915_MAX_PIPES)
72 			     __field(char, pipe_name)
73 			     ),
74 	    TP_fast_assign(
75 			   struct intel_display *display = to_intel_display(crtc);
76 			   struct intel_crtc *it__;
77 			   __assign_str(dev);
78 			   memset(__entry->frame, 0,
79 				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
80 			   memset(__entry->scanline, 0,
81 				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
82 			   for_each_intel_crtc(display->drm, it__) {
83 				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
84 				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
85 			   }
86 			   __entry->pipe_name = pipe_name(crtc->pipe);
87 			   ),
88 
89 	    TP_printk("dev %s, pipe %c enable, " _PIPES_FRAME_AND_SCANLINE_FMT,
90 		      __get_str(dev), __entry->pipe_name, _PIPES_FRAME_AND_SCANLINE_VALUES)
91 );
92 
93 TRACE_EVENT(intel_pipe_disable,
94 	    TP_PROTO(struct intel_crtc *crtc),
95 	    TP_ARGS(crtc),
96 
97 	    TP_STRUCT__entry(
98 			     __string(dev, __dev_name_kms(crtc))
99 			     __array(u32, frame, I915_MAX_PIPES)
100 			     __array(u32, scanline, I915_MAX_PIPES)
101 			     __field(char, pipe_name)
102 			     ),
103 
104 	    TP_fast_assign(
105 			   struct intel_display *display = to_intel_display(crtc);
106 			   struct intel_crtc *it__;
107 			   __assign_str(dev);
108 			   memset(__entry->frame, 0,
109 				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
110 			   memset(__entry->scanline, 0,
111 				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
112 			   for_each_intel_crtc(display->drm, it__) {
113 				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
114 				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
115 			   }
116 			   __entry->pipe_name = pipe_name(crtc->pipe);
117 			   ),
118 
119 	    TP_printk("dev %s, pipe %c disable, " _PIPES_FRAME_AND_SCANLINE_FMT,
120 		      __get_str(dev), __entry->pipe_name, _PIPES_FRAME_AND_SCANLINE_VALUES)
121 );
122 
123 TRACE_EVENT(intel_crtc_flip_done,
124 	    TP_PROTO(struct intel_crtc *crtc),
125 	    TP_ARGS(crtc),
126 
127 	    TP_STRUCT__entry(
128 			     __string(dev, __dev_name_kms(crtc))
129 			     __field(char, pipe_name)
130 			     __field(u32, frame)
131 			     __field(u32, scanline)
132 			     ),
133 
134 	    TP_fast_assign(
135 			   __assign_str(dev);
136 			   __entry->pipe_name = pipe_name(crtc->pipe);
137 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
138 			   __entry->scanline = intel_get_crtc_scanline(crtc);
139 			   ),
140 
141 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u",
142 		      __get_str(dev), __entry->pipe_name,
143 		      __entry->frame, __entry->scanline)
144 );
145 
146 TRACE_EVENT(intel_pipe_crc,
147 	    TP_PROTO(struct intel_crtc *crtc, const u32 *crcs),
148 	    TP_ARGS(crtc, crcs),
149 
150 	    TP_STRUCT__entry(
151 			     __string(dev, __dev_name_kms(crtc))
152 			     __field(char, pipe_name)
153 			     __field(u32, frame)
154 			     __field(u32, scanline)
155 			     __array(u32, crcs, 5)
156 			     ),
157 
158 	    TP_fast_assign(
159 			   __assign_str(dev);
160 			   __entry->pipe_name = pipe_name(crtc->pipe);
161 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
162 			   __entry->scanline = intel_get_crtc_scanline(crtc);
163 			   memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
164 			   ),
165 
166 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
167 		      __get_str(dev), __entry->pipe_name,
168 		      __entry->frame, __entry->scanline,
169 		      __entry->crcs[0], __entry->crcs[1],
170 		      __entry->crcs[2], __entry->crcs[3],
171 		      __entry->crcs[4])
172 );
173 
174 TRACE_EVENT(intel_cpu_fifo_underrun,
175 	    TP_PROTO(struct intel_display *display, enum pipe pipe),
176 	    TP_ARGS(display, pipe),
177 
178 	    TP_STRUCT__entry(
179 			     __string(dev, __dev_name_display(display))
180 			     __field(char, pipe_name)
181 			     __field(u32, frame)
182 			     __field(u32, scanline)
183 			     ),
184 
185 	    TP_fast_assign(
186 			   struct intel_crtc *crtc = intel_crtc_for_pipe(display, pipe);
187 			   __assign_str(dev);
188 			   __entry->pipe_name = pipe_name(pipe);
189 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
190 			   __entry->scanline = intel_get_crtc_scanline(crtc);
191 			   ),
192 
193 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u",
194 		      __get_str(dev), __entry->pipe_name,
195 		      __entry->frame, __entry->scanline)
196 );
197 
198 TRACE_EVENT(intel_pch_fifo_underrun,
199 	    TP_PROTO(struct intel_display *display, enum pipe pch_transcoder),
200 	    TP_ARGS(display, pch_transcoder),
201 
202 	    TP_STRUCT__entry(
203 			     __string(dev, __dev_name_display(display))
204 			     __field(char, pipe_name)
205 			     __field(u32, frame)
206 			     __field(u32, scanline)
207 			     ),
208 
209 	    TP_fast_assign(
210 			   enum pipe pipe = pch_transcoder;
211 			   struct intel_crtc *crtc = intel_crtc_for_pipe(display, pipe);
212 			   __assign_str(dev);
213 			   __entry->pipe_name = pipe_name(pipe);
214 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
215 			   __entry->scanline = intel_get_crtc_scanline(crtc);
216 			   ),
217 
218 	    TP_printk("dev %s, pch transcoder %c, frame=%u, scanline=%u",
219 		      __get_str(dev), __entry->pipe_name,
220 		      __entry->frame, __entry->scanline)
221 );
222 
223 TRACE_EVENT(intel_memory_cxsr,
224 	    TP_PROTO(struct intel_display *display, bool old, bool new),
225 	    TP_ARGS(display, old, new),
226 
227 	    TP_STRUCT__entry(
228 			     __string(dev, __dev_name_display(display))
229 			     __array(u32, frame, I915_MAX_PIPES)
230 			     __array(u32, scanline, I915_MAX_PIPES)
231 			     __field(bool, old)
232 			     __field(bool, new)
233 			     ),
234 
235 	    TP_fast_assign(
236 			   struct intel_crtc *crtc;
237 			   __assign_str(dev);
238 			   memset(__entry->frame, 0,
239 				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
240 			   memset(__entry->scanline, 0,
241 				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
242 			   for_each_intel_crtc(display->drm, crtc) {
243 				   __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
244 				   __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
245 			   }
246 			   __entry->old = old;
247 			   __entry->new = new;
248 			   ),
249 
250 	    TP_printk("dev %s, cxsr %s->%s, " _PIPES_FRAME_AND_SCANLINE_FMT,
251 		      __get_str(dev), str_on_off(__entry->old), str_on_off(__entry->new),
252 		      _PIPES_FRAME_AND_SCANLINE_VALUES)
253 );
254 
255 TRACE_EVENT(g4x_wm,
256 	    TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
257 	    TP_ARGS(crtc, wm),
258 
259 	    TP_STRUCT__entry(
260 			     __string(dev, __dev_name_kms(crtc))
261 			     __field(char, pipe_name)
262 			     __field(u32, frame)
263 			     __field(u32, scanline)
264 			     __field(u16, primary)
265 			     __field(u16, sprite)
266 			     __field(u16, cursor)
267 			     __field(u16, sr_plane)
268 			     __field(u16, sr_cursor)
269 			     __field(u16, sr_fbc)
270 			     __field(u16, hpll_plane)
271 			     __field(u16, hpll_cursor)
272 			     __field(u16, hpll_fbc)
273 			     __field(bool, cxsr)
274 			     __field(bool, hpll)
275 			     __field(bool, fbc)
276 			     ),
277 
278 	    TP_fast_assign(
279 			   __assign_str(dev);
280 			   __entry->pipe_name = pipe_name(crtc->pipe);
281 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
282 			   __entry->scanline = intel_get_crtc_scanline(crtc);
283 			   __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
284 			   __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
285 			   __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
286 			   __entry->sr_plane = wm->sr.plane;
287 			   __entry->sr_cursor = wm->sr.cursor;
288 			   __entry->sr_fbc = wm->sr.fbc;
289 			   __entry->hpll_plane = wm->hpll.plane;
290 			   __entry->hpll_cursor = wm->hpll.cursor;
291 			   __entry->hpll_fbc = wm->hpll.fbc;
292 			   __entry->cxsr = wm->cxsr;
293 			   __entry->hpll = wm->hpll_en;
294 			   __entry->fbc = wm->fbc_en;
295 			   ),
296 
297 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
298 		      __get_str(dev), __entry->pipe_name,
299 		      __entry->frame, __entry->scanline,
300 		      __entry->primary, __entry->sprite, __entry->cursor,
301 		      str_yes_no(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
302 		      str_yes_no(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
303 		      str_yes_no(__entry->fbc))
304 );
305 
306 TRACE_EVENT(vlv_wm,
307 	    TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
308 	    TP_ARGS(crtc, wm),
309 
310 	    TP_STRUCT__entry(
311 			     __string(dev, __dev_name_kms(crtc))
312 			     __field(char, pipe_name)
313 			     __field(u32, frame)
314 			     __field(u32, scanline)
315 			     __field(u32, level)
316 			     __field(u32, cxsr)
317 			     __field(u32, primary)
318 			     __field(u32, sprite0)
319 			     __field(u32, sprite1)
320 			     __field(u32, cursor)
321 			     __field(u32, sr_plane)
322 			     __field(u32, sr_cursor)
323 			     ),
324 
325 	    TP_fast_assign(
326 			   __assign_str(dev);
327 			   __entry->pipe_name = pipe_name(crtc->pipe);
328 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
329 			   __entry->scanline = intel_get_crtc_scanline(crtc);
330 			   __entry->level = wm->level;
331 			   __entry->cxsr = wm->cxsr;
332 			   __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
333 			   __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
334 			   __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
335 			   __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
336 			   __entry->sr_plane = wm->sr.plane;
337 			   __entry->sr_cursor = wm->sr.cursor;
338 			   ),
339 
340 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
341 		      __get_str(dev), __entry->pipe_name,
342 		      __entry->frame, __entry->scanline,
343 		      __entry->level, __entry->cxsr,
344 		      __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
345 		      __entry->sr_plane, __entry->sr_cursor)
346 );
347 
348 TRACE_EVENT(vlv_fifo_size,
349 	    TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
350 	    TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
351 
352 	    TP_STRUCT__entry(
353 			     __string(dev, __dev_name_kms(crtc))
354 			     __field(char, pipe_name)
355 			     __field(u32, frame)
356 			     __field(u32, scanline)
357 			     __field(u32, sprite0_start)
358 			     __field(u32, sprite1_start)
359 			     __field(u32, fifo_size)
360 			     ),
361 
362 	    TP_fast_assign(
363 			   __assign_str(dev);
364 			   __entry->pipe_name = pipe_name(crtc->pipe);
365 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
366 			   __entry->scanline = intel_get_crtc_scanline(crtc);
367 			   __entry->sprite0_start = sprite0_start;
368 			   __entry->sprite1_start = sprite1_start;
369 			   __entry->fifo_size = fifo_size;
370 			   ),
371 
372 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, %d/%d/%d",
373 		      __get_str(dev), __entry->pipe_name,
374 		      __entry->frame, __entry->scanline,
375 		      __entry->sprite0_start, __entry->sprite1_start, __entry->fifo_size)
376 );
377 
378 TRACE_EVENT(intel_plane_async_flip,
379 	    TP_PROTO(struct intel_plane *plane, struct intel_crtc *crtc, bool async_flip),
380 	    TP_ARGS(plane, crtc, async_flip),
381 
382 	    TP_STRUCT__entry(
383 			     __string(dev, __dev_name_kms(plane))
384 			     __field(char, pipe_name)
385 			     __field(u32, frame)
386 			     __field(u32, scanline)
387 			     __field(bool, async_flip)
388 			     __string(name, plane->base.name)
389 			     ),
390 
391 	    TP_fast_assign(
392 			   __assign_str(dev);
393 			   __assign_str(name);
394 			   __entry->pipe_name = pipe_name(crtc->pipe);
395 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
396 			   __entry->scanline = intel_get_crtc_scanline(crtc);
397 			   __entry->async_flip = async_flip;
398 			   ),
399 
400 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u, async_flip=%s",
401 		      __get_str(dev), __entry->pipe_name, __get_str(name),
402 		      __entry->frame, __entry->scanline, str_yes_no(__entry->async_flip))
403 );
404 
405 TRACE_EVENT(intel_plane_update_noarm,
406 	    TP_PROTO(struct intel_plane *plane, struct intel_crtc *crtc),
407 	    TP_ARGS(plane, crtc),
408 
409 	    TP_STRUCT__entry(
410 			     __string(dev, __dev_name_kms(plane))
411 			     __field(char, pipe_name)
412 			     __field(u32, frame)
413 			     __field(u32, scanline)
414 			     __array(int, src, 4)
415 			     __array(int, dst, 4)
416 			     __string(name, plane->base.name)
417 			     ),
418 
419 	    TP_fast_assign(
420 			   __assign_str(dev);
421 			   __assign_str(name);
422 			   __entry->pipe_name = pipe_name(crtc->pipe);
423 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
424 			   __entry->scanline = intel_get_crtc_scanline(crtc);
425 			   memcpy(__entry->src, &plane->base.state->src, sizeof(__entry->src));
426 			   memcpy(__entry->dst, &plane->base.state->dst, sizeof(__entry->dst));
427 			   ),
428 
429 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
430 		      __get_str(dev), __entry->pipe_name, __get_str(name),
431 		      __entry->frame, __entry->scanline,
432 		      DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
433 		      DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
434 );
435 
436 TRACE_EVENT(intel_plane_update_arm,
437 	    TP_PROTO(struct intel_plane *plane, struct intel_crtc *crtc),
438 	    TP_ARGS(plane, crtc),
439 
440 	    TP_STRUCT__entry(
441 			     __string(dev, __dev_name_kms(plane))
442 			     __field(char, pipe_name)
443 			     __field(u32, frame)
444 			     __field(u32, scanline)
445 			     __array(int, src, 4)
446 			     __array(int, dst, 4)
447 			     __string(name, plane->base.name)
448 			     ),
449 
450 	    TP_fast_assign(
451 			   __assign_str(dev);
452 			   __assign_str(name);
453 			   __entry->pipe_name = pipe_name(crtc->pipe);
454 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
455 			   __entry->scanline = intel_get_crtc_scanline(crtc);
456 			   memcpy(__entry->src, &plane->base.state->src, sizeof(__entry->src));
457 			   memcpy(__entry->dst, &plane->base.state->dst, sizeof(__entry->dst));
458 			   ),
459 
460 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
461 		      __get_str(dev), __entry->pipe_name, __get_str(name),
462 		      __entry->frame, __entry->scanline,
463 		      DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
464 		      DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
465 );
466 
467 TRACE_EVENT(intel_plane_disable_arm,
468 	    TP_PROTO(struct intel_plane *plane, struct intel_crtc *crtc),
469 	    TP_ARGS(plane, crtc),
470 
471 	    TP_STRUCT__entry(
472 			     __string(dev, __dev_name_kms(plane))
473 			     __field(char, pipe_name)
474 			     __field(u32, frame)
475 			     __field(u32, scanline)
476 			     __string(name, plane->base.name)
477 			     ),
478 
479 	    TP_fast_assign(
480 			   __assign_str(dev);
481 			   __assign_str(name);
482 			   __entry->pipe_name = pipe_name(crtc->pipe);
483 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
484 			   __entry->scanline = intel_get_crtc_scanline(crtc);
485 			   ),
486 
487 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u",
488 		      __get_str(dev), __entry->pipe_name, __get_str(name),
489 		      __entry->frame, __entry->scanline)
490 );
491 
492 TRACE_EVENT(intel_fbc_activate,
493 	    TP_PROTO(struct intel_plane *plane),
494 	    TP_ARGS(plane),
495 
496 	    TP_STRUCT__entry(
497 			     __string(dev, __dev_name_kms(plane))
498 			     __string(name, plane->base.name)
499 			     __field(char, pipe_name)
500 			     __field(u32, frame)
501 			     __field(u32, scanline)
502 			     ),
503 
504 	    TP_fast_assign(
505 			   struct intel_display *display = to_intel_display(plane->base.dev);
506 			   struct intel_crtc *crtc = intel_crtc_for_pipe(display,
507 									 plane->pipe);
508 			   __assign_str(dev);
509 			   __assign_str(name);
510 			   __entry->pipe_name = pipe_name(crtc->pipe);
511 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
512 			   __entry->scanline = intel_get_crtc_scanline(crtc);
513 			   ),
514 
515 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u",
516 		      __get_str(dev), __entry->pipe_name, __get_str(name),
517 		      __entry->frame, __entry->scanline)
518 );
519 
520 TRACE_EVENT(intel_fbc_deactivate,
521 	    TP_PROTO(struct intel_plane *plane),
522 	    TP_ARGS(plane),
523 
524 	    TP_STRUCT__entry(
525 			     __string(dev, __dev_name_kms(plane))
526 			     __string(name, plane->base.name)
527 			     __field(char, pipe_name)
528 			     __field(u32, frame)
529 			     __field(u32, scanline)
530 			     ),
531 
532 	    TP_fast_assign(
533 			   struct intel_display *display = to_intel_display(plane->base.dev);
534 			   struct intel_crtc *crtc = intel_crtc_for_pipe(display,
535 									 plane->pipe);
536 			   __assign_str(dev);
537 			   __assign_str(name);
538 			   __entry->pipe_name = pipe_name(crtc->pipe);
539 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
540 			   __entry->scanline = intel_get_crtc_scanline(crtc);
541 			   ),
542 
543 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u",
544 		      __get_str(dev), __entry->pipe_name, __get_str(name),
545 		      __entry->frame, __entry->scanline)
546 );
547 
548 TRACE_EVENT(intel_fbc_nuke,
549 	    TP_PROTO(struct intel_plane *plane),
550 	    TP_ARGS(plane),
551 
552 	    TP_STRUCT__entry(
553 			     __string(dev, __dev_name_kms(plane))
554 			     __string(name, plane->base.name)
555 			     __field(char, pipe_name)
556 			     __field(u32, frame)
557 			     __field(u32, scanline)
558 			     ),
559 
560 	    TP_fast_assign(
561 			   struct intel_display *display = to_intel_display(plane->base.dev);
562 			   struct intel_crtc *crtc = intel_crtc_for_pipe(display,
563 									 plane->pipe);
564 			   __assign_str(dev);
565 			   __assign_str(name);
566 			   __entry->pipe_name = pipe_name(crtc->pipe);
567 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
568 			   __entry->scanline = intel_get_crtc_scanline(crtc);
569 			   ),
570 
571 	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u",
572 		      __get_str(dev), __entry->pipe_name, __get_str(name),
573 		      __entry->frame, __entry->scanline)
574 );
575 
576 TRACE_EVENT(intel_crtc_vblank_work_start,
577 	    TP_PROTO(struct intel_crtc *crtc),
578 	    TP_ARGS(crtc),
579 
580 	    TP_STRUCT__entry(
581 			     __string(dev, __dev_name_kms(crtc))
582 			     __field(char, pipe_name)
583 			     __field(u32, frame)
584 			     __field(u32, scanline)
585 			     ),
586 
587 	    TP_fast_assign(
588 			   __assign_str(dev);
589 			   __entry->pipe_name = pipe_name(crtc->pipe);
590 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
591 			   __entry->scanline = intel_get_crtc_scanline(crtc);
592 			   ),
593 
594 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u",
595 		      __get_str(dev), __entry->pipe_name,
596 		      __entry->frame, __entry->scanline)
597 );
598 
599 TRACE_EVENT(intel_crtc_vblank_work_end,
600 	    TP_PROTO(struct intel_crtc *crtc),
601 	    TP_ARGS(crtc),
602 
603 	    TP_STRUCT__entry(
604 			     __string(dev, __dev_name_kms(crtc))
605 			     __field(char, pipe_name)
606 			     __field(u32, frame)
607 			     __field(u32, scanline)
608 			     ),
609 
610 	    TP_fast_assign(
611 			   __assign_str(dev);
612 			   __entry->pipe_name = pipe_name(crtc->pipe);
613 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
614 			   __entry->scanline = intel_get_crtc_scanline(crtc);
615 			   ),
616 
617 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u",
618 		      __get_str(dev), __entry->pipe_name,
619 		      __entry->frame, __entry->scanline)
620 );
621 
622 TRACE_EVENT(intel_pipe_update_start,
623 	    TP_PROTO(struct intel_crtc *crtc),
624 	    TP_ARGS(crtc),
625 
626 	    TP_STRUCT__entry(
627 			     __string(dev, __dev_name_kms(crtc))
628 			     __field(char, pipe_name)
629 			     __field(u32, frame)
630 			     __field(u32, scanline)
631 			     __field(u32, min)
632 			     __field(u32, max)
633 			     ),
634 
635 	    TP_fast_assign(
636 			   __assign_str(dev);
637 			   __entry->pipe_name = pipe_name(crtc->pipe);
638 			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
639 			   __entry->scanline = intel_get_crtc_scanline(crtc);
640 			   __entry->min = crtc->debug.min_vbl;
641 			   __entry->max = crtc->debug.max_vbl;
642 			   ),
643 
644 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
645 		      __get_str(dev), __entry->pipe_name,
646 		      __entry->frame, __entry->scanline,
647 		      __entry->min, __entry->max)
648 );
649 
650 TRACE_EVENT(intel_pipe_update_vblank_evaded,
651 	    TP_PROTO(struct intel_crtc *crtc),
652 	    TP_ARGS(crtc),
653 
654 	    TP_STRUCT__entry(
655 			     __string(dev, __dev_name_kms(crtc))
656 			     __field(char, pipe_name)
657 			     __field(u32, frame)
658 			     __field(u32, scanline)
659 			     __field(u32, min)
660 			     __field(u32, max)
661 			     ),
662 
663 	    TP_fast_assign(
664 			   __assign_str(dev);
665 			   __entry->pipe_name = pipe_name(crtc->pipe);
666 			   __entry->frame = crtc->debug.start_vbl_count;
667 			   __entry->scanline = crtc->debug.scanline_start;
668 			   __entry->min = crtc->debug.min_vbl;
669 			   __entry->max = crtc->debug.max_vbl;
670 			   ),
671 
672 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
673 		      __get_str(dev), __entry->pipe_name,
674 		      __entry->frame, __entry->scanline,
675 		      __entry->min, __entry->max)
676 );
677 
678 TRACE_EVENT(intel_pipe_update_end,
679 	    TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
680 	    TP_ARGS(crtc, frame, scanline_end),
681 
682 	    TP_STRUCT__entry(
683 			     __string(dev, __dev_name_kms(crtc))
684 			     __field(char, pipe_name)
685 			     __field(u32, frame)
686 			     __field(u32, scanline)
687 			     ),
688 
689 	    TP_fast_assign(
690 			   __assign_str(dev);
691 			   __entry->pipe_name = pipe_name(crtc->pipe);
692 			   __entry->frame = frame;
693 			   __entry->scanline = scanline_end;
694 			   ),
695 
696 	    TP_printk("dev %s, pipe %c, frame=%u, scanline=%u",
697 		      __get_str(dev), __entry->pipe_name,
698 		      __entry->frame, __entry->scanline)
699 );
700 
701 TRACE_EVENT(intel_frontbuffer_invalidate,
702 	    TP_PROTO(struct intel_display *display,
703 		     unsigned int frontbuffer_bits, unsigned int origin),
704 	    TP_ARGS(display, frontbuffer_bits, origin),
705 
706 	    TP_STRUCT__entry(
707 			     __string(dev, __dev_name_display(display))
708 			     __field(unsigned int, frontbuffer_bits)
709 			     __field(unsigned int, origin)
710 			     ),
711 
712 	    TP_fast_assign(
713 			   __assign_str(dev);
714 			   __entry->frontbuffer_bits = frontbuffer_bits;
715 			   __entry->origin = origin;
716 			   ),
717 
718 	    TP_printk("dev %s, frontbuffer_bits=0x%08x, origin=%u",
719 		      __get_str(dev), __entry->frontbuffer_bits, __entry->origin)
720 );
721 
722 TRACE_EVENT(intel_frontbuffer_flush,
723 	    TP_PROTO(struct intel_display *display,
724 		     unsigned int frontbuffer_bits, unsigned int origin),
725 	    TP_ARGS(display, frontbuffer_bits, origin),
726 
727 	    TP_STRUCT__entry(
728 			     __string(dev, __dev_name_display(display))
729 			     __field(unsigned int, frontbuffer_bits)
730 			     __field(unsigned int, origin)
731 			     ),
732 
733 	    TP_fast_assign(
734 			   __assign_str(dev);
735 			   __entry->frontbuffer_bits = frontbuffer_bits;
736 			   __entry->origin = origin;
737 			   ),
738 
739 	    TP_printk("dev %s, frontbuffer_bits=0x%08x, origin=%u",
740 		      __get_str(dev), __entry->frontbuffer_bits, __entry->origin)
741 );
742 
743 #endif /* __INTEL_DISPLAY_TRACE_H__ */
744 
745 /* This part must be outside protection */
746 #undef TRACE_INCLUDE_PATH
747 #undef TRACE_INCLUDE_FILE
748 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915/display
749 #define TRACE_INCLUDE_FILE intel_display_trace
750 #include <trace/define_trace.h>
751