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_crtc.h"
12 #include "display/intel_display_types.h"
13 #include "gt/intel_engine.h"
19 #define TRACE_SYSTEM i915
20 #define TRACE_INCLUDE_FILE i915_trace
22 /* watermark/fifo updates */
24 TRACE_EVENT(intel_pipe_enable,
25 TP_PROTO(struct intel_crtc *crtc),
29 __array(u32, frame, 3)
30 __array(u32, scanline, 3)
31 __field(enum pipe, pipe)
34 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
35 struct intel_crtc *it__;
36 for_each_intel_crtc(&dev_priv->drm, it__) {
37 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
38 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
40 __entry->pipe = crtc->pipe;
43 TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
44 pipe_name(__entry->pipe),
45 __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
46 __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
47 __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
50 TRACE_EVENT(intel_pipe_disable,
51 TP_PROTO(struct intel_crtc *crtc),
55 __array(u32, frame, 3)
56 __array(u32, scanline, 3)
57 __field(enum pipe, pipe)
61 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
62 struct intel_crtc *it__;
63 for_each_intel_crtc(&dev_priv->drm, it__) {
64 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
65 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
67 __entry->pipe = crtc->pipe;
70 TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
71 pipe_name(__entry->pipe),
72 __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
73 __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
74 __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
77 TRACE_EVENT(intel_pipe_crc,
78 TP_PROTO(struct intel_crtc *crtc, const u32 *crcs),
82 __field(enum pipe, pipe)
84 __field(u32, scanline)
89 __entry->pipe = crtc->pipe;
90 __entry->frame = intel_crtc_get_vblank_counter(crtc);
91 __entry->scanline = intel_get_crtc_scanline(crtc);
92 memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
95 TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
96 pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
97 __entry->crcs[0], __entry->crcs[1], __entry->crcs[2],
98 __entry->crcs[3], __entry->crcs[4])
101 TRACE_EVENT(intel_cpu_fifo_underrun,
102 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
103 TP_ARGS(dev_priv, pipe),
106 __field(enum pipe, pipe)
108 __field(u32, scanline)
112 struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
113 __entry->pipe = pipe;
114 __entry->frame = intel_crtc_get_vblank_counter(crtc);
115 __entry->scanline = intel_get_crtc_scanline(crtc);
118 TP_printk("pipe %c, frame=%u, scanline=%u",
119 pipe_name(__entry->pipe),
120 __entry->frame, __entry->scanline)
123 TRACE_EVENT(intel_pch_fifo_underrun,
124 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder),
125 TP_ARGS(dev_priv, pch_transcoder),
128 __field(enum pipe, pipe)
130 __field(u32, scanline)
134 enum pipe pipe = pch_transcoder;
135 struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
136 __entry->pipe = pipe;
137 __entry->frame = intel_crtc_get_vblank_counter(crtc);
138 __entry->scanline = intel_get_crtc_scanline(crtc);
141 TP_printk("pch transcoder %c, frame=%u, scanline=%u",
142 pipe_name(__entry->pipe),
143 __entry->frame, __entry->scanline)
146 TRACE_EVENT(intel_memory_cxsr,
147 TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new),
148 TP_ARGS(dev_priv, old, new),
151 __array(u32, frame, 3)
152 __array(u32, scanline, 3)
158 struct intel_crtc *crtc;
159 for_each_intel_crtc(&dev_priv->drm, crtc) {
160 __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
161 __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
167 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
168 onoff(__entry->old), onoff(__entry->new),
169 __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
170 __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
171 __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
175 TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
179 __field(enum pipe, pipe)
181 __field(u32, scanline)
182 __field(u16, primary)
185 __field(u16, sr_plane)
186 __field(u16, sr_cursor)
188 __field(u16, hpll_plane)
189 __field(u16, hpll_cursor)
190 __field(u16, hpll_fbc)
197 __entry->pipe = crtc->pipe;
198 __entry->frame = intel_crtc_get_vblank_counter(crtc);
199 __entry->scanline = intel_get_crtc_scanline(crtc);
200 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
201 __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
202 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
203 __entry->sr_plane = wm->sr.plane;
204 __entry->sr_cursor = wm->sr.cursor;
205 __entry->sr_fbc = wm->sr.fbc;
206 __entry->hpll_plane = wm->hpll.plane;
207 __entry->hpll_cursor = wm->hpll.cursor;
208 __entry->hpll_fbc = wm->hpll.fbc;
209 __entry->cxsr = wm->cxsr;
210 __entry->hpll = wm->hpll_en;
211 __entry->fbc = wm->fbc_en;
214 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
215 pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
216 __entry->primary, __entry->sprite, __entry->cursor,
217 yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
218 yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
223 TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
227 __field(enum pipe, pipe)
229 __field(u32, scanline)
232 __field(u32, primary)
233 __field(u32, sprite0)
234 __field(u32, sprite1)
236 __field(u32, sr_plane)
237 __field(u32, sr_cursor)
241 __entry->pipe = crtc->pipe;
242 __entry->frame = intel_crtc_get_vblank_counter(crtc);
243 __entry->scanline = intel_get_crtc_scanline(crtc);
244 __entry->level = wm->level;
245 __entry->cxsr = wm->cxsr;
246 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
247 __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
248 __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
249 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
250 __entry->sr_plane = wm->sr.plane;
251 __entry->sr_cursor = wm->sr.cursor;
254 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
255 pipe_name(__entry->pipe), __entry->frame,
256 __entry->scanline, __entry->level, __entry->cxsr,
257 __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
258 __entry->sr_plane, __entry->sr_cursor)
261 TRACE_EVENT(vlv_fifo_size,
262 TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
263 TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
266 __field(enum pipe, pipe)
268 __field(u32, scanline)
269 __field(u32, sprite0_start)
270 __field(u32, sprite1_start)
271 __field(u32, fifo_size)
275 __entry->pipe = crtc->pipe;
276 __entry->frame = intel_crtc_get_vblank_counter(crtc);
277 __entry->scanline = intel_get_crtc_scanline(crtc);
278 __entry->sprite0_start = sprite0_start;
279 __entry->sprite1_start = sprite1_start;
280 __entry->fifo_size = fifo_size;
283 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
284 pipe_name(__entry->pipe), __entry->frame,
285 __entry->scanline, __entry->sprite0_start,
286 __entry->sprite1_start, __entry->fifo_size)
291 TRACE_EVENT(intel_update_plane,
292 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
293 TP_ARGS(plane, crtc),
296 __field(enum pipe, pipe)
298 __field(u32, scanline)
301 __string(name, plane->name)
305 __assign_str(name, plane->name);
306 __entry->pipe = crtc->pipe;
307 __entry->frame = intel_crtc_get_vblank_counter(crtc);
308 __entry->scanline = intel_get_crtc_scanline(crtc);
309 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
310 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
313 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
314 pipe_name(__entry->pipe), __get_str(name),
315 __entry->frame, __entry->scanline,
316 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
317 DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
320 TRACE_EVENT(intel_disable_plane,
321 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
322 TP_ARGS(plane, crtc),
325 __field(enum pipe, pipe)
327 __field(u32, scanline)
328 __string(name, plane->name)
332 __assign_str(name, plane->name);
333 __entry->pipe = crtc->pipe;
334 __entry->frame = intel_crtc_get_vblank_counter(crtc);
335 __entry->scanline = intel_get_crtc_scanline(crtc);
338 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
339 pipe_name(__entry->pipe), __get_str(name),
340 __entry->frame, __entry->scanline)
345 TRACE_EVENT(intel_fbc_activate,
346 TP_PROTO(struct intel_crtc *crtc),
350 __field(enum pipe, pipe)
352 __field(u32, scanline)
356 __entry->pipe = crtc->pipe;
357 __entry->frame = intel_crtc_get_vblank_counter(crtc);
358 __entry->scanline = intel_get_crtc_scanline(crtc);
361 TP_printk("pipe %c, frame=%u, scanline=%u",
362 pipe_name(__entry->pipe), __entry->frame, __entry->scanline)
365 TRACE_EVENT(intel_fbc_deactivate,
366 TP_PROTO(struct intel_crtc *crtc),
370 __field(enum pipe, pipe)
372 __field(u32, scanline)
376 __entry->pipe = crtc->pipe;
377 __entry->frame = intel_crtc_get_vblank_counter(crtc);
378 __entry->scanline = intel_get_crtc_scanline(crtc);
381 TP_printk("pipe %c, frame=%u, scanline=%u",
382 pipe_name(__entry->pipe), __entry->frame, __entry->scanline)
385 TRACE_EVENT(intel_fbc_nuke,
386 TP_PROTO(struct intel_crtc *crtc),
390 __field(enum pipe, pipe)
392 __field(u32, scanline)
396 __entry->pipe = crtc->pipe;
397 __entry->frame = intel_crtc_get_vblank_counter(crtc);
398 __entry->scanline = intel_get_crtc_scanline(crtc);
401 TP_printk("pipe %c, frame=%u, scanline=%u",
402 pipe_name(__entry->pipe), __entry->frame, __entry->scanline)
407 TRACE_EVENT(intel_pipe_update_start,
408 TP_PROTO(struct intel_crtc *crtc),
412 __field(enum pipe, pipe)
414 __field(u32, scanline)
420 __entry->pipe = crtc->pipe;
421 __entry->frame = intel_crtc_get_vblank_counter(crtc);
422 __entry->scanline = intel_get_crtc_scanline(crtc);
423 __entry->min = crtc->debug.min_vbl;
424 __entry->max = crtc->debug.max_vbl;
427 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
428 pipe_name(__entry->pipe), __entry->frame,
429 __entry->scanline, __entry->min, __entry->max)
432 TRACE_EVENT(intel_pipe_update_vblank_evaded,
433 TP_PROTO(struct intel_crtc *crtc),
437 __field(enum pipe, pipe)
439 __field(u32, scanline)
445 __entry->pipe = crtc->pipe;
446 __entry->frame = crtc->debug.start_vbl_count;
447 __entry->scanline = crtc->debug.scanline_start;
448 __entry->min = crtc->debug.min_vbl;
449 __entry->max = crtc->debug.max_vbl;
452 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
453 pipe_name(__entry->pipe), __entry->frame,
454 __entry->scanline, __entry->min, __entry->max)
457 TRACE_EVENT(intel_pipe_update_end,
458 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
459 TP_ARGS(crtc, frame, scanline_end),
462 __field(enum pipe, pipe)
464 __field(u32, scanline)
468 __entry->pipe = crtc->pipe;
469 __entry->frame = frame;
470 __entry->scanline = scanline_end;
473 TP_printk("pipe %c, frame=%u, scanline=%u",
474 pipe_name(__entry->pipe), __entry->frame,
478 /* frontbuffer tracking */
480 TRACE_EVENT(intel_frontbuffer_invalidate,
481 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin),
482 TP_ARGS(frontbuffer_bits, origin),
485 __field(unsigned int, frontbuffer_bits)
486 __field(unsigned int, origin)
490 __entry->frontbuffer_bits = frontbuffer_bits;
491 __entry->origin = origin;
494 TP_printk("frontbuffer_bits=0x%08x, origin=%u",
495 __entry->frontbuffer_bits, __entry->origin)
498 TRACE_EVENT(intel_frontbuffer_flush,
499 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin),
500 TP_ARGS(frontbuffer_bits, origin),
503 __field(unsigned int, frontbuffer_bits)
504 __field(unsigned int, origin)
508 __entry->frontbuffer_bits = frontbuffer_bits;
509 __entry->origin = origin;
512 TP_printk("frontbuffer_bits=0x%08x, origin=%u",
513 __entry->frontbuffer_bits, __entry->origin)
516 /* object tracking */
518 TRACE_EVENT(i915_gem_object_create,
519 TP_PROTO(struct drm_i915_gem_object *obj),
523 __field(struct drm_i915_gem_object *, obj)
529 __entry->size = obj->base.size;
532 TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size)
535 TRACE_EVENT(i915_gem_shrink,
536 TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
537 TP_ARGS(i915, target, flags),
541 __field(unsigned long, target)
542 __field(unsigned, flags)
546 __entry->dev = i915->drm.primary->index;
547 __entry->target = target;
548 __entry->flags = flags;
551 TP_printk("dev=%d, target=%lu, flags=%x",
552 __entry->dev, __entry->target, __entry->flags)
555 TRACE_EVENT(i915_vma_bind,
556 TP_PROTO(struct i915_vma *vma, unsigned flags),
560 __field(struct drm_i915_gem_object *, obj)
561 __field(struct i915_address_space *, vm)
564 __field(unsigned, flags)
568 __entry->obj = vma->obj;
569 __entry->vm = vma->vm;
570 __entry->offset = vma->node.start;
571 __entry->size = vma->node.size;
572 __entry->flags = flags;
575 TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
576 __entry->obj, __entry->offset, __entry->size,
577 __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
581 TRACE_EVENT(i915_vma_unbind,
582 TP_PROTO(struct i915_vma *vma),
586 __field(struct drm_i915_gem_object *, obj)
587 __field(struct i915_address_space *, vm)
593 __entry->obj = vma->obj;
594 __entry->vm = vma->vm;
595 __entry->offset = vma->node.start;
596 __entry->size = vma->node.size;
599 TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
600 __entry->obj, __entry->offset, __entry->size, __entry->vm)
603 TRACE_EVENT(i915_gem_object_pwrite,
604 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
605 TP_ARGS(obj, offset, len),
608 __field(struct drm_i915_gem_object *, obj)
615 __entry->offset = offset;
619 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
620 __entry->obj, __entry->offset, __entry->len)
623 TRACE_EVENT(i915_gem_object_pread,
624 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
625 TP_ARGS(obj, offset, len),
628 __field(struct drm_i915_gem_object *, obj)
635 __entry->offset = offset;
639 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
640 __entry->obj, __entry->offset, __entry->len)
643 TRACE_EVENT(i915_gem_object_fault,
644 TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write),
645 TP_ARGS(obj, index, gtt, write),
648 __field(struct drm_i915_gem_object *, obj)
656 __entry->index = index;
658 __entry->write = write;
661 TP_printk("obj=%p, %s index=%llu %s",
663 __entry->gtt ? "GTT" : "CPU",
665 __entry->write ? ", writable" : "")
668 DECLARE_EVENT_CLASS(i915_gem_object,
669 TP_PROTO(struct drm_i915_gem_object *obj),
673 __field(struct drm_i915_gem_object *, obj)
680 TP_printk("obj=%p", __entry->obj)
683 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
684 TP_PROTO(struct drm_i915_gem_object *obj),
688 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
689 TP_PROTO(struct drm_i915_gem_object *obj),
693 TRACE_EVENT(i915_gem_evict,
694 TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags),
695 TP_ARGS(vm, size, align, flags),
699 __field(struct i915_address_space *, vm)
702 __field(unsigned int, flags)
706 __entry->dev = vm->i915->drm.primary->index;
708 __entry->size = size;
709 __entry->align = align;
710 __entry->flags = flags;
713 TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
714 __entry->dev, __entry->vm, __entry->size, __entry->align,
715 __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
718 TRACE_EVENT(i915_gem_evict_node,
719 TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags),
720 TP_ARGS(vm, node, flags),
724 __field(struct i915_address_space *, vm)
727 __field(unsigned long, color)
728 __field(unsigned int, flags)
732 __entry->dev = vm->i915->drm.primary->index;
734 __entry->start = node->start;
735 __entry->size = node->size;
736 __entry->color = node->color;
737 __entry->flags = flags;
740 TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
741 __entry->dev, __entry->vm,
742 __entry->start, __entry->size,
743 __entry->color, __entry->flags)
746 TRACE_EVENT(i915_gem_evict_vm,
747 TP_PROTO(struct i915_address_space *vm),
752 __field(struct i915_address_space *, vm)
756 __entry->dev = vm->i915->drm.primary->index;
760 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
763 TRACE_EVENT(i915_request_queue,
764 TP_PROTO(struct i915_request *rq, u32 flags),
771 __field(u16, instance)
777 __entry->dev = rq->engine->i915->drm.primary->index;
778 __entry->class = rq->engine->uabi_class;
779 __entry->instance = rq->engine->uabi_instance;
780 __entry->ctx = rq->fence.context;
781 __entry->seqno = rq->fence.seqno;
782 __entry->flags = flags;
785 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x",
786 __entry->dev, __entry->class, __entry->instance,
787 __entry->ctx, __entry->seqno, __entry->flags)
790 DECLARE_EVENT_CLASS(i915_request,
791 TP_PROTO(struct i915_request *rq),
799 __field(u16, instance)
805 __entry->dev = rq->engine->i915->drm.primary->index;
806 __entry->class = rq->engine->uabi_class;
807 __entry->instance = rq->engine->uabi_instance;
808 __entry->guc_id = rq->context->guc_id.id;
809 __entry->ctx = rq->fence.context;
810 __entry->seqno = rq->fence.seqno;
811 __entry->tail = rq->tail;
814 TP_printk("dev=%u, engine=%u:%u, guc_id=%u, ctx=%llu, seqno=%u, tail=%u",
815 __entry->dev, __entry->class, __entry->instance,
816 __entry->guc_id, __entry->ctx, __entry->seqno,
820 DEFINE_EVENT(i915_request, i915_request_add,
821 TP_PROTO(struct i915_request *rq),
825 #if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
826 DEFINE_EVENT(i915_request, i915_request_guc_submit,
827 TP_PROTO(struct i915_request *rq),
831 DEFINE_EVENT(i915_request, i915_request_submit,
832 TP_PROTO(struct i915_request *rq),
836 DEFINE_EVENT(i915_request, i915_request_execute,
837 TP_PROTO(struct i915_request *rq),
841 TRACE_EVENT(i915_request_in,
842 TP_PROTO(struct i915_request *rq, unsigned int port),
849 __field(u16, instance)
856 __entry->dev = rq->engine->i915->drm.primary->index;
857 __entry->class = rq->engine->uabi_class;
858 __entry->instance = rq->engine->uabi_instance;
859 __entry->ctx = rq->fence.context;
860 __entry->seqno = rq->fence.seqno;
861 __entry->prio = rq->sched.attr.priority;
862 __entry->port = port;
865 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, prio=%d, port=%u",
866 __entry->dev, __entry->class, __entry->instance,
867 __entry->ctx, __entry->seqno,
868 __entry->prio, __entry->port)
871 TRACE_EVENT(i915_request_out,
872 TP_PROTO(struct i915_request *rq),
879 __field(u16, instance)
881 __field(u32, completed)
885 __entry->dev = rq->engine->i915->drm.primary->index;
886 __entry->class = rq->engine->uabi_class;
887 __entry->instance = rq->engine->uabi_instance;
888 __entry->ctx = rq->fence.context;
889 __entry->seqno = rq->fence.seqno;
890 __entry->completed = i915_request_completed(rq);
893 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, completed?=%u",
894 __entry->dev, __entry->class, __entry->instance,
895 __entry->ctx, __entry->seqno, __entry->completed)
898 DECLARE_EVENT_CLASS(intel_context,
899 TP_PROTO(struct intel_context *ce),
904 __field(int, pin_count)
905 __field(u32, sched_state)
906 __field(u8, guc_prio)
910 __entry->guc_id = ce->guc_id.id;
911 __entry->pin_count = atomic_read(&ce->pin_count);
912 __entry->sched_state = ce->guc_state.sched_state;
913 __entry->guc_prio = ce->guc_state.prio;
916 TP_printk("guc_id=%d, pin_count=%d sched_state=0x%x, guc_prio=%u",
917 __entry->guc_id, __entry->pin_count,
918 __entry->sched_state,
922 DEFINE_EVENT(intel_context, intel_context_set_prio,
923 TP_PROTO(struct intel_context *ce),
927 DEFINE_EVENT(intel_context, intel_context_reset,
928 TP_PROTO(struct intel_context *ce),
932 DEFINE_EVENT(intel_context, intel_context_ban,
933 TP_PROTO(struct intel_context *ce),
937 DEFINE_EVENT(intel_context, intel_context_register,
938 TP_PROTO(struct intel_context *ce),
942 DEFINE_EVENT(intel_context, intel_context_deregister,
943 TP_PROTO(struct intel_context *ce),
947 DEFINE_EVENT(intel_context, intel_context_deregister_done,
948 TP_PROTO(struct intel_context *ce),
952 DEFINE_EVENT(intel_context, intel_context_sched_enable,
953 TP_PROTO(struct intel_context *ce),
957 DEFINE_EVENT(intel_context, intel_context_sched_disable,
958 TP_PROTO(struct intel_context *ce),
962 DEFINE_EVENT(intel_context, intel_context_sched_done,
963 TP_PROTO(struct intel_context *ce),
967 DEFINE_EVENT(intel_context, intel_context_create,
968 TP_PROTO(struct intel_context *ce),
972 DEFINE_EVENT(intel_context, intel_context_fence_release,
973 TP_PROTO(struct intel_context *ce),
977 DEFINE_EVENT(intel_context, intel_context_free,
978 TP_PROTO(struct intel_context *ce),
982 DEFINE_EVENT(intel_context, intel_context_steal_guc_id,
983 TP_PROTO(struct intel_context *ce),
987 DEFINE_EVENT(intel_context, intel_context_do_pin,
988 TP_PROTO(struct intel_context *ce),
992 DEFINE_EVENT(intel_context, intel_context_do_unpin,
993 TP_PROTO(struct intel_context *ce),
998 #if !defined(TRACE_HEADER_MULTI_READ)
1000 trace_i915_request_guc_submit(struct i915_request *rq)
1005 trace_i915_request_submit(struct i915_request *rq)
1010 trace_i915_request_execute(struct i915_request *rq)
1015 trace_i915_request_in(struct i915_request *rq, unsigned int port)
1020 trace_i915_request_out(struct i915_request *rq)
1025 trace_intel_context_set_prio(struct intel_context *ce)
1030 trace_intel_context_reset(struct intel_context *ce)
1035 trace_intel_context_ban(struct intel_context *ce)
1040 trace_intel_context_register(struct intel_context *ce)
1045 trace_intel_context_deregister(struct intel_context *ce)
1050 trace_intel_context_deregister_done(struct intel_context *ce)
1055 trace_intel_context_sched_enable(struct intel_context *ce)
1060 trace_intel_context_sched_disable(struct intel_context *ce)
1065 trace_intel_context_sched_done(struct intel_context *ce)
1070 trace_intel_context_create(struct intel_context *ce)
1075 trace_intel_context_fence_release(struct intel_context *ce)
1080 trace_intel_context_free(struct intel_context *ce)
1085 trace_intel_context_steal_guc_id(struct intel_context *ce)
1090 trace_intel_context_do_pin(struct intel_context *ce)
1095 trace_intel_context_do_unpin(struct intel_context *ce)
1101 DEFINE_EVENT(i915_request, i915_request_retire,
1102 TP_PROTO(struct i915_request *rq),
1106 TRACE_EVENT(i915_request_wait_begin,
1107 TP_PROTO(struct i915_request *rq, unsigned int flags),
1114 __field(u16, instance)
1116 __field(unsigned int, flags)
1119 /* NB: the blocking information is racy since mutex_is_locked
1120 * doesn't check that the current thread holds the lock. The only
1121 * other option would be to pass the boolean information of whether
1122 * or not the class was blocking down through the stack which is
1126 __entry->dev = rq->engine->i915->drm.primary->index;
1127 __entry->class = rq->engine->uabi_class;
1128 __entry->instance = rq->engine->uabi_instance;
1129 __entry->ctx = rq->fence.context;
1130 __entry->seqno = rq->fence.seqno;
1131 __entry->flags = flags;
1134 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x",
1135 __entry->dev, __entry->class, __entry->instance,
1136 __entry->ctx, __entry->seqno,
1140 DEFINE_EVENT(i915_request, i915_request_wait_end,
1141 TP_PROTO(struct i915_request *rq),
1145 TRACE_EVENT_CONDITION(i915_reg_rw,
1146 TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
1148 TP_ARGS(write, reg, val, len, trace),
1150 TP_CONDITION(trace),
1160 __entry->val = (u64)val;
1161 __entry->reg = i915_mmio_reg_offset(reg);
1162 __entry->write = write;
1166 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
1167 __entry->write ? "write" : "read",
1168 __entry->reg, __entry->len,
1169 (u32)(__entry->val & 0xffffffff),
1170 (u32)(__entry->val >> 32))
1173 TRACE_EVENT(intel_gpu_freq_change,
1182 __entry->freq = freq;
1185 TP_printk("new_freq=%u", __entry->freq)
1189 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
1191 * With full ppgtt enabled each process using drm will allocate at least one
1192 * translation table. With these traces it is possible to keep track of the
1193 * allocation and of the lifetime of the tables; this can be used during
1194 * testing/debug to verify that we are not leaking ppgtts.
1195 * These traces identify the ppgtt through the vm pointer, which is also printed
1196 * by the i915_vma_bind and i915_vma_unbind tracepoints.
1198 DECLARE_EVENT_CLASS(i915_ppgtt,
1199 TP_PROTO(struct i915_address_space *vm),
1203 __field(struct i915_address_space *, vm)
1209 __entry->dev = vm->i915->drm.primary->index;
1212 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
1215 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
1216 TP_PROTO(struct i915_address_space *vm),
1220 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
1221 TP_PROTO(struct i915_address_space *vm),
1226 * DOC: i915_context_create and i915_context_free tracepoints
1228 * These tracepoints are used to track creation and deletion of contexts.
1229 * If full ppgtt is enabled, they also print the address of the vm assigned to
1232 DECLARE_EVENT_CLASS(i915_context,
1233 TP_PROTO(struct i915_gem_context *ctx),
1238 __field(struct i915_gem_context *, ctx)
1239 __field(struct i915_address_space *, vm)
1243 __entry->dev = ctx->i915->drm.primary->index;
1245 __entry->vm = ctx->vm;
1248 TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
1249 __entry->dev, __entry->ctx, __entry->vm)
1252 DEFINE_EVENT(i915_context, i915_context_create,
1253 TP_PROTO(struct i915_gem_context *ctx),
1257 DEFINE_EVENT(i915_context, i915_context_free,
1258 TP_PROTO(struct i915_gem_context *ctx),
1262 #endif /* _I915_TRACE_H_ */
1264 /* This part must be outside protection */
1265 #undef TRACE_INCLUDE_PATH
1266 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
1267 #include <trace/define_trace.h>