1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
5 #include <linux/stringify.h>
6 #include <linux/types.h>
7 #include <linux/tracepoint.h>
9 #include <drm/drm_drv.h>
11 #include "display/intel_display_types.h"
12 #include "gt/intel_engine.h"
18 #define TRACE_SYSTEM i915
19 #define TRACE_INCLUDE_FILE i915_trace
21 /* watermark/fifo updates */
23 TRACE_EVENT(intel_pipe_enable
,
24 TP_PROTO(struct intel_crtc
*crtc
),
28 __array(u32
, frame
, 3)
29 __array(u32
, scanline
, 3)
30 __field(enum pipe
, pipe
)
33 struct drm_i915_private
*dev_priv
= to_i915(crtc
->base
.dev
);
34 struct intel_crtc
*it__
;
35 for_each_intel_crtc(&dev_priv
->drm
, it__
) {
36 __entry
->frame
[it__
->pipe
] = intel_crtc_get_vblank_counter(it__
);
37 __entry
->scanline
[it__
->pipe
] = intel_get_crtc_scanline(it__
);
39 __entry
->pipe
= crtc
->pipe
;
42 TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
43 pipe_name(__entry
->pipe
),
44 __entry
->frame
[PIPE_A
], __entry
->scanline
[PIPE_A
],
45 __entry
->frame
[PIPE_B
], __entry
->scanline
[PIPE_B
],
46 __entry
->frame
[PIPE_C
], __entry
->scanline
[PIPE_C
])
49 TRACE_EVENT(intel_pipe_disable
,
50 TP_PROTO(struct intel_crtc
*crtc
),
54 __array(u32
, frame
, 3)
55 __array(u32
, scanline
, 3)
56 __field(enum pipe
, pipe
)
60 struct drm_i915_private
*dev_priv
= to_i915(crtc
->base
.dev
);
61 struct intel_crtc
*it__
;
62 for_each_intel_crtc(&dev_priv
->drm
, it__
) {
63 __entry
->frame
[it__
->pipe
] = intel_crtc_get_vblank_counter(it__
);
64 __entry
->scanline
[it__
->pipe
] = intel_get_crtc_scanline(it__
);
66 __entry
->pipe
= crtc
->pipe
;
69 TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
70 pipe_name(__entry
->pipe
),
71 __entry
->frame
[PIPE_A
], __entry
->scanline
[PIPE_A
],
72 __entry
->frame
[PIPE_B
], __entry
->scanline
[PIPE_B
],
73 __entry
->frame
[PIPE_C
], __entry
->scanline
[PIPE_C
])
76 TRACE_EVENT(intel_pipe_crc
,
77 TP_PROTO(struct intel_crtc
*crtc
, const u32
*crcs
),
81 __field(enum pipe
, pipe
)
83 __field(u32
, scanline
)
88 __entry
->pipe
= crtc
->pipe
;
89 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
90 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
91 memcpy(__entry
->crcs
, crcs
, sizeof(__entry
->crcs
));
94 TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
95 pipe_name(__entry
->pipe
), __entry
->frame
, __entry
->scanline
,
96 __entry
->crcs
[0], __entry
->crcs
[1], __entry
->crcs
[2],
97 __entry
->crcs
[3], __entry
->crcs
[4])
100 TRACE_EVENT(intel_cpu_fifo_underrun
,
101 TP_PROTO(struct drm_i915_private
*dev_priv
, enum pipe pipe
),
102 TP_ARGS(dev_priv
, pipe
),
105 __field(enum pipe
, pipe
)
107 __field(u32
, scanline
)
111 struct intel_crtc
*crtc
= intel_get_crtc_for_pipe(dev_priv
, pipe
);
112 __entry
->pipe
= pipe
;
113 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
114 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
117 TP_printk("pipe %c, frame=%u, scanline=%u",
118 pipe_name(__entry
->pipe
),
119 __entry
->frame
, __entry
->scanline
)
122 TRACE_EVENT(intel_pch_fifo_underrun
,
123 TP_PROTO(struct drm_i915_private
*dev_priv
, enum pipe pch_transcoder
),
124 TP_ARGS(dev_priv
, pch_transcoder
),
127 __field(enum pipe
, pipe
)
129 __field(u32
, scanline
)
133 enum pipe pipe
= pch_transcoder
;
134 struct intel_crtc
*crtc
= intel_get_crtc_for_pipe(dev_priv
, pipe
);
135 __entry
->pipe
= pipe
;
136 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
137 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
140 TP_printk("pch transcoder %c, frame=%u, scanline=%u",
141 pipe_name(__entry
->pipe
),
142 __entry
->frame
, __entry
->scanline
)
145 TRACE_EVENT(intel_memory_cxsr
,
146 TP_PROTO(struct drm_i915_private
*dev_priv
, bool old
, bool new),
147 TP_ARGS(dev_priv
, old
, new),
150 __array(u32
, frame
, 3)
151 __array(u32
, scanline
, 3)
157 struct intel_crtc
*crtc
;
158 for_each_intel_crtc(&dev_priv
->drm
, crtc
) {
159 __entry
->frame
[crtc
->pipe
] = intel_crtc_get_vblank_counter(crtc
);
160 __entry
->scanline
[crtc
->pipe
] = intel_get_crtc_scanline(crtc
);
166 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
167 onoff(__entry
->old
), onoff(__entry
->new),
168 __entry
->frame
[PIPE_A
], __entry
->scanline
[PIPE_A
],
169 __entry
->frame
[PIPE_B
], __entry
->scanline
[PIPE_B
],
170 __entry
->frame
[PIPE_C
], __entry
->scanline
[PIPE_C
])
174 TP_PROTO(struct intel_crtc
*crtc
, const struct g4x_wm_values
*wm
),
178 __field(enum pipe
, pipe
)
180 __field(u32
, scanline
)
181 __field(u16
, primary
)
184 __field(u16
, sr_plane
)
185 __field(u16
, sr_cursor
)
187 __field(u16
, hpll_plane
)
188 __field(u16
, hpll_cursor
)
189 __field(u16
, hpll_fbc
)
196 __entry
->pipe
= crtc
->pipe
;
197 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
198 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
199 __entry
->primary
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_PRIMARY
];
200 __entry
->sprite
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_SPRITE0
];
201 __entry
->cursor
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_CURSOR
];
202 __entry
->sr_plane
= wm
->sr
.plane
;
203 __entry
->sr_cursor
= wm
->sr
.cursor
;
204 __entry
->sr_fbc
= wm
->sr
.fbc
;
205 __entry
->hpll_plane
= wm
->hpll
.plane
;
206 __entry
->hpll_cursor
= wm
->hpll
.cursor
;
207 __entry
->hpll_fbc
= wm
->hpll
.fbc
;
208 __entry
->cxsr
= wm
->cxsr
;
209 __entry
->hpll
= wm
->hpll_en
;
210 __entry
->fbc
= wm
->fbc_en
;
213 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
214 pipe_name(__entry
->pipe
), __entry
->frame
, __entry
->scanline
,
215 __entry
->primary
, __entry
->sprite
, __entry
->cursor
,
216 yesno(__entry
->cxsr
), __entry
->sr_plane
, __entry
->sr_cursor
, __entry
->sr_fbc
,
217 yesno(__entry
->hpll
), __entry
->hpll_plane
, __entry
->hpll_cursor
, __entry
->hpll_fbc
,
222 TP_PROTO(struct intel_crtc
*crtc
, const struct vlv_wm_values
*wm
),
226 __field(enum pipe
, pipe
)
228 __field(u32
, scanline
)
231 __field(u32
, primary
)
232 __field(u32
, sprite0
)
233 __field(u32
, sprite1
)
235 __field(u32
, sr_plane
)
236 __field(u32
, sr_cursor
)
240 __entry
->pipe
= crtc
->pipe
;
241 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
242 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
243 __entry
->level
= wm
->level
;
244 __entry
->cxsr
= wm
->cxsr
;
245 __entry
->primary
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_PRIMARY
];
246 __entry
->sprite0
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_SPRITE0
];
247 __entry
->sprite1
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_SPRITE1
];
248 __entry
->cursor
= wm
->pipe
[crtc
->pipe
].plane
[PLANE_CURSOR
];
249 __entry
->sr_plane
= wm
->sr
.plane
;
250 __entry
->sr_cursor
= wm
->sr
.cursor
;
253 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
254 pipe_name(__entry
->pipe
), __entry
->frame
,
255 __entry
->scanline
, __entry
->level
, __entry
->cxsr
,
256 __entry
->primary
, __entry
->sprite0
, __entry
->sprite1
, __entry
->cursor
,
257 __entry
->sr_plane
, __entry
->sr_cursor
)
260 TRACE_EVENT(vlv_fifo_size
,
261 TP_PROTO(struct intel_crtc
*crtc
, u32 sprite0_start
, u32 sprite1_start
, u32 fifo_size
),
262 TP_ARGS(crtc
, sprite0_start
, sprite1_start
, fifo_size
),
265 __field(enum pipe
, pipe
)
267 __field(u32
, scanline
)
268 __field(u32
, sprite0_start
)
269 __field(u32
, sprite1_start
)
270 __field(u32
, fifo_size
)
274 __entry
->pipe
= crtc
->pipe
;
275 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
276 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
277 __entry
->sprite0_start
= sprite0_start
;
278 __entry
->sprite1_start
= sprite1_start
;
279 __entry
->fifo_size
= fifo_size
;
282 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
283 pipe_name(__entry
->pipe
), __entry
->frame
,
284 __entry
->scanline
, __entry
->sprite0_start
,
285 __entry
->sprite1_start
, __entry
->fifo_size
)
290 TRACE_EVENT(intel_update_plane
,
291 TP_PROTO(struct drm_plane
*plane
, struct intel_crtc
*crtc
),
292 TP_ARGS(plane
, crtc
),
295 __field(enum pipe
, pipe
)
297 __field(u32
, scanline
)
300 __string(name
, plane
->name
)
304 __assign_str(name
, plane
->name
);
305 __entry
->pipe
= crtc
->pipe
;
306 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
307 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
308 memcpy(__entry
->src
, &plane
->state
->src
, sizeof(__entry
->src
));
309 memcpy(__entry
->dst
, &plane
->state
->dst
, sizeof(__entry
->dst
));
312 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT
" -> " DRM_RECT_FMT
,
313 pipe_name(__entry
->pipe
), __get_str(name
),
314 __entry
->frame
, __entry
->scanline
,
315 DRM_RECT_FP_ARG((const struct drm_rect
*)__entry
->src
),
316 DRM_RECT_ARG((const struct drm_rect
*)__entry
->dst
))
319 TRACE_EVENT(intel_disable_plane
,
320 TP_PROTO(struct drm_plane
*plane
, struct intel_crtc
*crtc
),
321 TP_ARGS(plane
, crtc
),
324 __field(enum pipe
, pipe
)
326 __field(u32
, scanline
)
327 __string(name
, plane
->name
)
331 __assign_str(name
, plane
->name
);
332 __entry
->pipe
= crtc
->pipe
;
333 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
334 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
337 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
338 pipe_name(__entry
->pipe
), __get_str(name
),
339 __entry
->frame
, __entry
->scanline
)
344 TRACE_EVENT(intel_pipe_update_start
,
345 TP_PROTO(struct intel_crtc
*crtc
),
349 __field(enum pipe
, pipe
)
351 __field(u32
, scanline
)
357 __entry
->pipe
= crtc
->pipe
;
358 __entry
->frame
= intel_crtc_get_vblank_counter(crtc
);
359 __entry
->scanline
= intel_get_crtc_scanline(crtc
);
360 __entry
->min
= crtc
->debug
.min_vbl
;
361 __entry
->max
= crtc
->debug
.max_vbl
;
364 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
365 pipe_name(__entry
->pipe
), __entry
->frame
,
366 __entry
->scanline
, __entry
->min
, __entry
->max
)
369 TRACE_EVENT(intel_pipe_update_vblank_evaded
,
370 TP_PROTO(struct intel_crtc
*crtc
),
374 __field(enum pipe
, pipe
)
376 __field(u32
, scanline
)
382 __entry
->pipe
= crtc
->pipe
;
383 __entry
->frame
= crtc
->debug
.start_vbl_count
;
384 __entry
->scanline
= crtc
->debug
.scanline_start
;
385 __entry
->min
= crtc
->debug
.min_vbl
;
386 __entry
->max
= crtc
->debug
.max_vbl
;
389 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
390 pipe_name(__entry
->pipe
), __entry
->frame
,
391 __entry
->scanline
, __entry
->min
, __entry
->max
)
394 TRACE_EVENT(intel_pipe_update_end
,
395 TP_PROTO(struct intel_crtc
*crtc
, u32 frame
, int scanline_end
),
396 TP_ARGS(crtc
, frame
, scanline_end
),
399 __field(enum pipe
, pipe
)
401 __field(u32
, scanline
)
405 __entry
->pipe
= crtc
->pipe
;
406 __entry
->frame
= frame
;
407 __entry
->scanline
= scanline_end
;
410 TP_printk("pipe %c, frame=%u, scanline=%u",
411 pipe_name(__entry
->pipe
), __entry
->frame
,
415 /* object tracking */
417 TRACE_EVENT(i915_gem_object_create
,
418 TP_PROTO(struct drm_i915_gem_object
*obj
),
422 __field(struct drm_i915_gem_object
*, obj
)
428 __entry
->size
= obj
->base
.size
;
431 TP_printk("obj=%p, size=0x%llx", __entry
->obj
, __entry
->size
)
434 TRACE_EVENT(i915_gem_shrink
,
435 TP_PROTO(struct drm_i915_private
*i915
, unsigned long target
, unsigned flags
),
436 TP_ARGS(i915
, target
, flags
),
440 __field(unsigned long, target
)
441 __field(unsigned, flags
)
445 __entry
->dev
= i915
->drm
.primary
->index
;
446 __entry
->target
= target
;
447 __entry
->flags
= flags
;
450 TP_printk("dev=%d, target=%lu, flags=%x",
451 __entry
->dev
, __entry
->target
, __entry
->flags
)
454 TRACE_EVENT(i915_vma_bind
,
455 TP_PROTO(struct i915_vma
*vma
, unsigned flags
),
459 __field(struct drm_i915_gem_object
*, obj
)
460 __field(struct i915_address_space
*, vm
)
463 __field(unsigned, flags
)
467 __entry
->obj
= vma
->obj
;
468 __entry
->vm
= vma
->vm
;
469 __entry
->offset
= vma
->node
.start
;
470 __entry
->size
= vma
->node
.size
;
471 __entry
->flags
= flags
;
474 TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
475 __entry
->obj
, __entry
->offset
, __entry
->size
,
476 __entry
->flags
& PIN_MAPPABLE
? ", mappable" : "",
480 TRACE_EVENT(i915_vma_unbind
,
481 TP_PROTO(struct i915_vma
*vma
),
485 __field(struct drm_i915_gem_object
*, obj
)
486 __field(struct i915_address_space
*, vm
)
492 __entry
->obj
= vma
->obj
;
493 __entry
->vm
= vma
->vm
;
494 __entry
->offset
= vma
->node
.start
;
495 __entry
->size
= vma
->node
.size
;
498 TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
499 __entry
->obj
, __entry
->offset
, __entry
->size
, __entry
->vm
)
502 TRACE_EVENT(i915_gem_object_pwrite
,
503 TP_PROTO(struct drm_i915_gem_object
*obj
, u64 offset
, u64 len
),
504 TP_ARGS(obj
, offset
, len
),
507 __field(struct drm_i915_gem_object
*, obj
)
514 __entry
->offset
= offset
;
518 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
519 __entry
->obj
, __entry
->offset
, __entry
->len
)
522 TRACE_EVENT(i915_gem_object_pread
,
523 TP_PROTO(struct drm_i915_gem_object
*obj
, u64 offset
, u64 len
),
524 TP_ARGS(obj
, offset
, len
),
527 __field(struct drm_i915_gem_object
*, obj
)
534 __entry
->offset
= offset
;
538 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
539 __entry
->obj
, __entry
->offset
, __entry
->len
)
542 TRACE_EVENT(i915_gem_object_fault
,
543 TP_PROTO(struct drm_i915_gem_object
*obj
, u64 index
, bool gtt
, bool write
),
544 TP_ARGS(obj
, index
, gtt
, write
),
547 __field(struct drm_i915_gem_object
*, obj
)
555 __entry
->index
= index
;
557 __entry
->write
= write
;
560 TP_printk("obj=%p, %s index=%llu %s",
562 __entry
->gtt
? "GTT" : "CPU",
564 __entry
->write
? ", writable" : "")
567 DECLARE_EVENT_CLASS(i915_gem_object
,
568 TP_PROTO(struct drm_i915_gem_object
*obj
),
572 __field(struct drm_i915_gem_object
*, obj
)
579 TP_printk("obj=%p", __entry
->obj
)
582 DEFINE_EVENT(i915_gem_object
, i915_gem_object_clflush
,
583 TP_PROTO(struct drm_i915_gem_object
*obj
),
587 DEFINE_EVENT(i915_gem_object
, i915_gem_object_destroy
,
588 TP_PROTO(struct drm_i915_gem_object
*obj
),
592 TRACE_EVENT(i915_gem_evict
,
593 TP_PROTO(struct i915_address_space
*vm
, u64 size
, u64 align
, unsigned int flags
),
594 TP_ARGS(vm
, size
, align
, flags
),
598 __field(struct i915_address_space
*, vm
)
601 __field(unsigned int, flags
)
605 __entry
->dev
= vm
->i915
->drm
.primary
->index
;
607 __entry
->size
= size
;
608 __entry
->align
= align
;
609 __entry
->flags
= flags
;
612 TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
613 __entry
->dev
, __entry
->vm
, __entry
->size
, __entry
->align
,
614 __entry
->flags
& PIN_MAPPABLE
? ", mappable" : "")
617 TRACE_EVENT(i915_gem_evict_node
,
618 TP_PROTO(struct i915_address_space
*vm
, struct drm_mm_node
*node
, unsigned int flags
),
619 TP_ARGS(vm
, node
, flags
),
623 __field(struct i915_address_space
*, vm
)
626 __field(unsigned long, color
)
627 __field(unsigned int, flags
)
631 __entry
->dev
= vm
->i915
->drm
.primary
->index
;
633 __entry
->start
= node
->start
;
634 __entry
->size
= node
->size
;
635 __entry
->color
= node
->color
;
636 __entry
->flags
= flags
;
639 TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
640 __entry
->dev
, __entry
->vm
,
641 __entry
->start
, __entry
->size
,
642 __entry
->color
, __entry
->flags
)
645 TRACE_EVENT(i915_gem_evict_vm
,
646 TP_PROTO(struct i915_address_space
*vm
),
651 __field(struct i915_address_space
*, vm
)
655 __entry
->dev
= vm
->i915
->drm
.primary
->index
;
659 TP_printk("dev=%d, vm=%p", __entry
->dev
, __entry
->vm
)
662 TRACE_EVENT(i915_request_queue
,
663 TP_PROTO(struct i915_request
*rq
, u32 flags
),
670 __field(u16
, instance
)
676 __entry
->dev
= rq
->i915
->drm
.primary
->index
;
677 __entry
->class = rq
->engine
->uabi_class
;
678 __entry
->instance
= rq
->engine
->uabi_instance
;
679 __entry
->ctx
= rq
->fence
.context
;
680 __entry
->seqno
= rq
->fence
.seqno
;
681 __entry
->flags
= flags
;
684 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x",
685 __entry
->dev
, __entry
->class, __entry
->instance
,
686 __entry
->ctx
, __entry
->seqno
, __entry
->flags
)
689 DECLARE_EVENT_CLASS(i915_request
,
690 TP_PROTO(struct i915_request
*rq
),
697 __field(u16
, instance
)
702 __entry
->dev
= rq
->i915
->drm
.primary
->index
;
703 __entry
->class = rq
->engine
->uabi_class
;
704 __entry
->instance
= rq
->engine
->uabi_instance
;
705 __entry
->ctx
= rq
->fence
.context
;
706 __entry
->seqno
= rq
->fence
.seqno
;
709 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u",
710 __entry
->dev
, __entry
->class, __entry
->instance
,
711 __entry
->ctx
, __entry
->seqno
)
714 DEFINE_EVENT(i915_request
, i915_request_add
,
715 TP_PROTO(struct i915_request
*rq
),
719 #if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
720 DEFINE_EVENT(i915_request
, i915_request_submit
,
721 TP_PROTO(struct i915_request
*rq
),
725 DEFINE_EVENT(i915_request
, i915_request_execute
,
726 TP_PROTO(struct i915_request
*rq
),
730 TRACE_EVENT(i915_request_in
,
731 TP_PROTO(struct i915_request
*rq
, unsigned int port
),
738 __field(u16
, instance
)
745 __entry
->dev
= rq
->i915
->drm
.primary
->index
;
746 __entry
->class = rq
->engine
->uabi_class
;
747 __entry
->instance
= rq
->engine
->uabi_instance
;
748 __entry
->ctx
= rq
->fence
.context
;
749 __entry
->seqno
= rq
->fence
.seqno
;
750 __entry
->prio
= rq
->sched
.attr
.priority
;
751 __entry
->port
= port
;
754 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, prio=%u, port=%u",
755 __entry
->dev
, __entry
->class, __entry
->instance
,
756 __entry
->ctx
, __entry
->seqno
,
757 __entry
->prio
, __entry
->port
)
760 TRACE_EVENT(i915_request_out
,
761 TP_PROTO(struct i915_request
*rq
),
768 __field(u16
, instance
)
770 __field(u32
, completed
)
774 __entry
->dev
= rq
->i915
->drm
.primary
->index
;
775 __entry
->class = rq
->engine
->uabi_class
;
776 __entry
->instance
= rq
->engine
->uabi_instance
;
777 __entry
->ctx
= rq
->fence
.context
;
778 __entry
->seqno
= rq
->fence
.seqno
;
779 __entry
->completed
= i915_request_completed(rq
);
782 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, completed?=%u",
783 __entry
->dev
, __entry
->class, __entry
->instance
,
784 __entry
->ctx
, __entry
->seqno
, __entry
->completed
)
788 #if !defined(TRACE_HEADER_MULTI_READ)
790 trace_i915_request_submit(struct i915_request
*rq
)
795 trace_i915_request_execute(struct i915_request
*rq
)
800 trace_i915_request_in(struct i915_request
*rq
, unsigned int port
)
805 trace_i915_request_out(struct i915_request
*rq
)
811 DEFINE_EVENT(i915_request
, i915_request_retire
,
812 TP_PROTO(struct i915_request
*rq
),
816 TRACE_EVENT(i915_request_wait_begin
,
817 TP_PROTO(struct i915_request
*rq
, unsigned int flags
),
824 __field(u16
, instance
)
826 __field(unsigned int, flags
)
829 /* NB: the blocking information is racy since mutex_is_locked
830 * doesn't check that the current thread holds the lock. The only
831 * other option would be to pass the boolean information of whether
832 * or not the class was blocking down through the stack which is
836 __entry
->dev
= rq
->i915
->drm
.primary
->index
;
837 __entry
->class = rq
->engine
->uabi_class
;
838 __entry
->instance
= rq
->engine
->uabi_instance
;
839 __entry
->ctx
= rq
->fence
.context
;
840 __entry
->seqno
= rq
->fence
.seqno
;
841 __entry
->flags
= flags
;
844 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x",
845 __entry
->dev
, __entry
->class, __entry
->instance
,
846 __entry
->ctx
, __entry
->seqno
,
850 DEFINE_EVENT(i915_request
, i915_request_wait_end
,
851 TP_PROTO(struct i915_request
*rq
),
855 TRACE_EVENT_CONDITION(i915_reg_rw
,
856 TP_PROTO(bool write
, i915_reg_t reg
, u64 val
, int len
, bool trace
),
858 TP_ARGS(write
, reg
, val
, len
, trace
),
870 __entry
->val
= (u64
)val
;
871 __entry
->reg
= i915_mmio_reg_offset(reg
);
872 __entry
->write
= write
;
876 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
877 __entry
->write
? "write" : "read",
878 __entry
->reg
, __entry
->len
,
879 (u32
)(__entry
->val
& 0xffffffff),
880 (u32
)(__entry
->val
>> 32))
883 TRACE_EVENT(intel_gpu_freq_change
,
892 __entry
->freq
= freq
;
895 TP_printk("new_freq=%u", __entry
->freq
)
899 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
901 * With full ppgtt enabled each process using drm will allocate at least one
902 * translation table. With these traces it is possible to keep track of the
903 * allocation and of the lifetime of the tables; this can be used during
904 * testing/debug to verify that we are not leaking ppgtts.
905 * These traces identify the ppgtt through the vm pointer, which is also printed
906 * by the i915_vma_bind and i915_vma_unbind tracepoints.
908 DECLARE_EVENT_CLASS(i915_ppgtt
,
909 TP_PROTO(struct i915_address_space
*vm
),
913 __field(struct i915_address_space
*, vm
)
919 __entry
->dev
= vm
->i915
->drm
.primary
->index
;
922 TP_printk("dev=%u, vm=%p", __entry
->dev
, __entry
->vm
)
925 DEFINE_EVENT(i915_ppgtt
, i915_ppgtt_create
,
926 TP_PROTO(struct i915_address_space
*vm
),
930 DEFINE_EVENT(i915_ppgtt
, i915_ppgtt_release
,
931 TP_PROTO(struct i915_address_space
*vm
),
936 * DOC: i915_context_create and i915_context_free tracepoints
938 * These tracepoints are used to track creation and deletion of contexts.
939 * If full ppgtt is enabled, they also print the address of the vm assigned to
942 DECLARE_EVENT_CLASS(i915_context
,
943 TP_PROTO(struct i915_gem_context
*ctx
),
948 __field(struct i915_gem_context
*, ctx
)
949 __field(struct i915_address_space
*, vm
)
953 __entry
->dev
= ctx
->i915
->drm
.primary
->index
;
955 __entry
->vm
= rcu_access_pointer(ctx
->vm
);
958 TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
959 __entry
->dev
, __entry
->ctx
, __entry
->vm
)
962 DEFINE_EVENT(i915_context
, i915_context_create
,
963 TP_PROTO(struct i915_gem_context
*ctx
),
967 DEFINE_EVENT(i915_context
, i915_context_free
,
968 TP_PROTO(struct i915_gem_context
*ctx
),
972 #endif /* _I915_TRACE_H_ */
974 /* This part must be outside protection */
975 #undef TRACE_INCLUDE_PATH
976 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
977 #include <trace/define_trace.h>