]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - drivers/gpu/drm/i915/i915_trace.h
Merge branch 'drm-next-5.1' of git://people.freedesktop.org/~agd5f/linux into drm...
[thirdparty/kernel/stable.git] / drivers / gpu / drm / i915 / i915_trace.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1c5d22f7
CW
2#if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
3#define _I915_TRACE_H_
4
5#include <linux/stringify.h>
6#include <linux/types.h>
7#include <linux/tracepoint.h>
8
fcd70cd3
SV
9#include <drm/drm_drv.h>
10
05394f39 11#include "i915_drv.h"
25ef284a 12#include "intel_drv.h"
db53a302 13#include "intel_ringbuffer.h"
1c5d22f7
CW
14
15#undef TRACE_SYSTEM
16#define TRACE_SYSTEM i915
1c5d22f7
CW
17#define TRACE_INCLUDE_FILE i915_trace
18
c137d660
VS
19/* watermark/fifo updates */
20
53a7915c
VS
21TRACE_EVENT(intel_cpu_fifo_underrun,
22 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
23 TP_ARGS(dev_priv, pipe),
24
25 TP_STRUCT__entry(
26 __field(enum pipe, pipe)
27 __field(u32, frame)
28 __field(u32, scanline)
29 ),
30
31 TP_fast_assign(
32 __entry->pipe = pipe;
33 __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
34 __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
35 ),
36
37 TP_printk("pipe %c, frame=%u, scanline=%u",
38 pipe_name(__entry->pipe),
39 __entry->frame, __entry->scanline)
40);
41
42TRACE_EVENT(intel_pch_fifo_underrun,
034263a3 43 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder),
53a7915c
VS
44 TP_ARGS(dev_priv, pch_transcoder),
45
46 TP_STRUCT__entry(
47 __field(enum pipe, pipe)
48 __field(u32, frame)
49 __field(u32, scanline)
50 ),
51
52 TP_fast_assign(
034263a3 53 enum pipe pipe = pch_transcoder;
53a7915c
VS
54 __entry->pipe = pipe;
55 __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
56 __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
57 ),
58
59 TP_printk("pch transcoder %c, frame=%u, scanline=%u",
60 pipe_name(__entry->pipe),
61 __entry->frame, __entry->scanline)
62);
63
1489bba8
VS
64TRACE_EVENT(intel_memory_cxsr,
65 TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new),
66 TP_ARGS(dev_priv, old, new),
67
68 TP_STRUCT__entry(
69 __array(u32, frame, 3)
70 __array(u32, scanline, 3)
71 __field(bool, old)
72 __field(bool, new)
73 ),
74
75 TP_fast_assign(
76 enum pipe pipe;
77 for_each_pipe(dev_priv, pipe) {
78 __entry->frame[pipe] =
79 dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
80 __entry->scanline[pipe] =
81 intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
82 }
83 __entry->old = old;
84 __entry->new = new;
85 ),
86
87 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
88 onoff(__entry->old), onoff(__entry->new),
89 __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
90 __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
91 __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
92);
93
e93329a5
VS
94TRACE_EVENT(g4x_wm,
95 TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
96 TP_ARGS(crtc, wm),
97
98 TP_STRUCT__entry(
99 __field(enum pipe, pipe)
100 __field(u32, frame)
101 __field(u32, scanline)
102 __field(u16, primary)
103 __field(u16, sprite)
104 __field(u16, cursor)
105 __field(u16, sr_plane)
106 __field(u16, sr_cursor)
107 __field(u16, sr_fbc)
108 __field(u16, hpll_plane)
109 __field(u16, hpll_cursor)
110 __field(u16, hpll_fbc)
111 __field(bool, cxsr)
112 __field(bool, hpll)
113 __field(bool, fbc)
114 ),
115
116 TP_fast_assign(
117 __entry->pipe = crtc->pipe;
118 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
119 crtc->pipe);
120 __entry->scanline = intel_get_crtc_scanline(crtc);
121 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
122 __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
123 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
124 __entry->sr_plane = wm->sr.plane;
125 __entry->sr_cursor = wm->sr.cursor;
126 __entry->sr_fbc = wm->sr.fbc;
127 __entry->hpll_plane = wm->hpll.plane;
128 __entry->hpll_cursor = wm->hpll.cursor;
129 __entry->hpll_fbc = wm->hpll.fbc;
130 __entry->cxsr = wm->cxsr;
131 __entry->hpll = wm->hpll_en;
132 __entry->fbc = wm->fbc_en;
133 ),
134
135 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
136 pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
137 __entry->primary, __entry->sprite, __entry->cursor,
138 yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
139 yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
140 yesno(__entry->fbc))
141);
142
c137d660
VS
143TRACE_EVENT(vlv_wm,
144 TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
145 TP_ARGS(crtc, wm),
146
147 TP_STRUCT__entry(
148 __field(enum pipe, pipe)
149 __field(u32, frame)
150 __field(u32, scanline)
151 __field(u32, level)
152 __field(u32, cxsr)
153 __field(u32, primary)
154 __field(u32, sprite0)
155 __field(u32, sprite1)
156 __field(u32, cursor)
157 __field(u32, sr_plane)
158 __field(u32, sr_cursor)
159 ),
160
161 TP_fast_assign(
162 __entry->pipe = crtc->pipe;
163 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
164 crtc->pipe);
165 __entry->scanline = intel_get_crtc_scanline(crtc);
166 __entry->level = wm->level;
167 __entry->cxsr = wm->cxsr;
168 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
169 __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
170 __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
171 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
172 __entry->sr_plane = wm->sr.plane;
173 __entry->sr_cursor = wm->sr.cursor;
174 ),
175
176 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
177 pipe_name(__entry->pipe), __entry->frame,
178 __entry->scanline, __entry->level, __entry->cxsr,
179 __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
180 __entry->sr_plane, __entry->sr_cursor)
181);
182
183TRACE_EVENT(vlv_fifo_size,
184 TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
185 TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
186
187 TP_STRUCT__entry(
188 __field(enum pipe, pipe)
189 __field(u32, frame)
190 __field(u32, scanline)
191 __field(u32, sprite0_start)
192 __field(u32, sprite1_start)
193 __field(u32, fifo_size)
194 ),
195
196 TP_fast_assign(
197 __entry->pipe = crtc->pipe;
198 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
199 crtc->pipe);
200 __entry->scanline = intel_get_crtc_scanline(crtc);
201 __entry->sprite0_start = sprite0_start;
202 __entry->sprite1_start = sprite1_start;
203 __entry->fifo_size = fifo_size;
204 ),
205
206 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
207 pipe_name(__entry->pipe), __entry->frame,
208 __entry->scanline, __entry->sprite0_start,
209 __entry->sprite1_start, __entry->fifo_size)
210);
211
72259536
VS
212/* plane updates */
213
214TRACE_EVENT(intel_update_plane,
215 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
216 TP_ARGS(plane, crtc),
217
218 TP_STRUCT__entry(
219 __field(enum pipe, pipe)
220 __field(const char *, name)
221 __field(u32, frame)
222 __field(u32, scanline)
223 __array(int, src, 4)
224 __array(int, dst, 4)
225 ),
226
227 TP_fast_assign(
228 __entry->pipe = crtc->pipe;
229 __entry->name = plane->name;
230 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
231 crtc->pipe);
232 __entry->scanline = intel_get_crtc_scanline(crtc);
233 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
234 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
235 ),
236
237 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
238 pipe_name(__entry->pipe), __entry->name,
239 __entry->frame, __entry->scanline,
240 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
241 DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
242);
243
244TRACE_EVENT(intel_disable_plane,
245 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
246 TP_ARGS(plane, crtc),
247
248 TP_STRUCT__entry(
249 __field(enum pipe, pipe)
250 __field(const char *, name)
251 __field(u32, frame)
252 __field(u32, scanline)
253 ),
254
255 TP_fast_assign(
256 __entry->pipe = crtc->pipe;
257 __entry->name = plane->name;
258 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
259 crtc->pipe);
260 __entry->scanline = intel_get_crtc_scanline(crtc);
261 ),
262
263 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
264 pipe_name(__entry->pipe), __entry->name,
265 __entry->frame, __entry->scanline)
266);
267
25ef284a
VS
268/* pipe updates */
269
270TRACE_EVENT(i915_pipe_update_start,
d637ce3f
JB
271 TP_PROTO(struct intel_crtc *crtc),
272 TP_ARGS(crtc),
25ef284a
VS
273
274 TP_STRUCT__entry(
275 __field(enum pipe, pipe)
276 __field(u32, frame)
277 __field(u32, scanline)
278 __field(u32, min)
279 __field(u32, max)
280 ),
281
282 TP_fast_assign(
283 __entry->pipe = crtc->pipe;
284 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
285 crtc->pipe);
286 __entry->scanline = intel_get_crtc_scanline(crtc);
d637ce3f
JB
287 __entry->min = crtc->debug.min_vbl;
288 __entry->max = crtc->debug.max_vbl;
25ef284a
VS
289 ),
290
291 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
292 pipe_name(__entry->pipe), __entry->frame,
293 __entry->scanline, __entry->min, __entry->max)
294);
295
296TRACE_EVENT(i915_pipe_update_vblank_evaded,
d637ce3f
JB
297 TP_PROTO(struct intel_crtc *crtc),
298 TP_ARGS(crtc),
25ef284a
VS
299
300 TP_STRUCT__entry(
301 __field(enum pipe, pipe)
302 __field(u32, frame)
303 __field(u32, scanline)
304 __field(u32, min)
305 __field(u32, max)
306 ),
307
308 TP_fast_assign(
309 __entry->pipe = crtc->pipe;
d637ce3f
JB
310 __entry->frame = crtc->debug.start_vbl_count;
311 __entry->scanline = crtc->debug.scanline_start;
312 __entry->min = crtc->debug.min_vbl;
313 __entry->max = crtc->debug.max_vbl;
25ef284a
VS
314 ),
315
316 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
317 pipe_name(__entry->pipe), __entry->frame,
318 __entry->scanline, __entry->min, __entry->max)
319);
320
321TRACE_EVENT(i915_pipe_update_end,
d637ce3f
JB
322 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
323 TP_ARGS(crtc, frame, scanline_end),
25ef284a
VS
324
325 TP_STRUCT__entry(
326 __field(enum pipe, pipe)
327 __field(u32, frame)
328 __field(u32, scanline)
329 ),
330
331 TP_fast_assign(
332 __entry->pipe = crtc->pipe;
333 __entry->frame = frame;
d637ce3f 334 __entry->scanline = scanline_end;
25ef284a
VS
335 ),
336
337 TP_printk("pipe %c, frame=%u, scanline=%u",
338 pipe_name(__entry->pipe), __entry->frame,
339 __entry->scanline)
340);
341
1c5d22f7
CW
342/* object tracking */
343
344TRACE_EVENT(i915_gem_object_create,
05394f39 345 TP_PROTO(struct drm_i915_gem_object *obj),
1c5d22f7
CW
346 TP_ARGS(obj),
347
348 TP_STRUCT__entry(
05394f39 349 __field(struct drm_i915_gem_object *, obj)
6c1fa341 350 __field(u64, size)
1c5d22f7
CW
351 ),
352
353 TP_fast_assign(
354 __entry->obj = obj;
05394f39 355 __entry->size = obj->base.size;
1c5d22f7
CW
356 ),
357
6c1fa341 358 TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size)
1c5d22f7
CW
359);
360
3abafa53
CW
361TRACE_EVENT(i915_gem_shrink,
362 TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
363 TP_ARGS(i915, target, flags),
364
365 TP_STRUCT__entry(
366 __field(int, dev)
367 __field(unsigned long, target)
368 __field(unsigned, flags)
369 ),
370
371 TP_fast_assign(
91c8a326 372 __entry->dev = i915->drm.primary->index;
3abafa53
CW
373 __entry->target = target;
374 __entry->flags = flags;
375 ),
376
377 TP_printk("dev=%d, target=%lu, flags=%x",
378 __entry->dev, __entry->target, __entry->flags)
379);
380
07fe0b12 381TRACE_EVENT(i915_vma_bind,
1ec9e26d
SV
382 TP_PROTO(struct i915_vma *vma, unsigned flags),
383 TP_ARGS(vma, flags),
1c5d22f7
CW
384
385 TP_STRUCT__entry(
05394f39 386 __field(struct drm_i915_gem_object *, obj)
07fe0b12 387 __field(struct i915_address_space *, vm)
33938714 388 __field(u64, offset)
6c1fa341 389 __field(u64, size)
1ec9e26d 390 __field(unsigned, flags)
1c5d22f7
CW
391 ),
392
393 TP_fast_assign(
07fe0b12
BW
394 __entry->obj = vma->obj;
395 __entry->vm = vma->vm;
396 __entry->offset = vma->node.start;
397 __entry->size = vma->node.size;
1ec9e26d 398 __entry->flags = flags;
1c5d22f7
CW
399 ),
400
6c1fa341 401 TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
db53a302 402 __entry->obj, __entry->offset, __entry->size,
1ec9e26d 403 __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
07fe0b12 404 __entry->vm)
1c5d22f7
CW
405);
406
07fe0b12
BW
407TRACE_EVENT(i915_vma_unbind,
408 TP_PROTO(struct i915_vma *vma),
409 TP_ARGS(vma),
db53a302
CW
410
411 TP_STRUCT__entry(
412 __field(struct drm_i915_gem_object *, obj)
07fe0b12 413 __field(struct i915_address_space *, vm)
33938714 414 __field(u64, offset)
6c1fa341 415 __field(u64, size)
db53a302 416 ),
1c5d22f7 417
db53a302 418 TP_fast_assign(
07fe0b12
BW
419 __entry->obj = vma->obj;
420 __entry->vm = vma->vm;
421 __entry->offset = vma->node.start;
422 __entry->size = vma->node.size;
db53a302 423 ),
1c5d22f7 424
6c1fa341 425 TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
07fe0b12 426 __entry->obj, __entry->offset, __entry->size, __entry->vm)
db53a302
CW
427);
428
db53a302 429TRACE_EVENT(i915_gem_object_pwrite,
6c1fa341 430 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
db53a302 431 TP_ARGS(obj, offset, len),
1c5d22f7 432
db53a302
CW
433 TP_STRUCT__entry(
434 __field(struct drm_i915_gem_object *, obj)
6c1fa341
CW
435 __field(u64, offset)
436 __field(u64, len)
db53a302 437 ),
1c5d22f7 438
db53a302
CW
439 TP_fast_assign(
440 __entry->obj = obj;
441 __entry->offset = offset;
442 __entry->len = len;
443 ),
444
6c1fa341 445 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
db53a302
CW
446 __entry->obj, __entry->offset, __entry->len)
447);
448
449TRACE_EVENT(i915_gem_object_pread,
6c1fa341 450 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
db53a302 451 TP_ARGS(obj, offset, len),
1c5d22f7
CW
452
453 TP_STRUCT__entry(
05394f39 454 __field(struct drm_i915_gem_object *, obj)
6c1fa341
CW
455 __field(u64, offset)
456 __field(u64, len)
1c5d22f7
CW
457 ),
458
459 TP_fast_assign(
460 __entry->obj = obj;
db53a302
CW
461 __entry->offset = offset;
462 __entry->len = len;
1c5d22f7
CW
463 ),
464
6c1fa341 465 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
db53a302 466 __entry->obj, __entry->offset, __entry->len)
1c5d22f7
CW
467);
468
db53a302 469TRACE_EVENT(i915_gem_object_fault,
6c1fa341 470 TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write),
db53a302
CW
471 TP_ARGS(obj, index, gtt, write),
472
473 TP_STRUCT__entry(
474 __field(struct drm_i915_gem_object *, obj)
6c1fa341 475 __field(u64, index)
db53a302
CW
476 __field(bool, gtt)
477 __field(bool, write)
478 ),
479
480 TP_fast_assign(
481 __entry->obj = obj;
482 __entry->index = index;
483 __entry->gtt = gtt;
484 __entry->write = write;
485 ),
f41275e8 486
6c1fa341 487 TP_printk("obj=%p, %s index=%llu %s",
db53a302
CW
488 __entry->obj,
489 __entry->gtt ? "GTT" : "CPU",
490 __entry->index,
491 __entry->write ? ", writable" : "")
492);
493
494DECLARE_EVENT_CLASS(i915_gem_object,
05394f39 495 TP_PROTO(struct drm_i915_gem_object *obj),
db53a302 496 TP_ARGS(obj),
f41275e8 497
db53a302
CW
498 TP_STRUCT__entry(
499 __field(struct drm_i915_gem_object *, obj)
500 ),
501
502 TP_fast_assign(
503 __entry->obj = obj;
504 ),
505
506 TP_printk("obj=%p", __entry->obj)
f41275e8
LZ
507);
508
db53a302
CW
509DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
510 TP_PROTO(struct drm_i915_gem_object *obj),
511 TP_ARGS(obj)
512);
1c5d22f7 513
db53a302 514DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
05394f39 515 TP_PROTO(struct drm_i915_gem_object *obj),
903cf20c
LZ
516 TP_ARGS(obj)
517);
1c5d22f7 518
db53a302 519TRACE_EVENT(i915_gem_evict,
6c1fa341 520 TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags),
e522ac23 521 TP_ARGS(vm, size, align, flags),
1c5d22f7 522
db53a302
CW
523 TP_STRUCT__entry(
524 __field(u32, dev)
e522ac23 525 __field(struct i915_address_space *, vm)
6c1fa341
CW
526 __field(u64, size)
527 __field(u64, align)
e522ac23 528 __field(unsigned int, flags)
db53a302 529 ),
1c5d22f7 530
db53a302 531 TP_fast_assign(
c6385c94 532 __entry->dev = vm->i915->drm.primary->index;
e522ac23 533 __entry->vm = vm;
db53a302
CW
534 __entry->size = size;
535 __entry->align = align;
1ec9e26d 536 __entry->flags = flags;
db53a302
CW
537 ),
538
6c1fa341 539 TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
e522ac23 540 __entry->dev, __entry->vm, __entry->size, __entry->align,
1ec9e26d 541 __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
1c5d22f7
CW
542);
543
625d988a
CW
544TRACE_EVENT(i915_gem_evict_node,
545 TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags),
546 TP_ARGS(vm, node, flags),
172ae5b4
CW
547
548 TP_STRUCT__entry(
549 __field(u32, dev)
550 __field(struct i915_address_space *, vm)
551 __field(u64, start)
552 __field(u64, size)
553 __field(unsigned long, color)
554 __field(unsigned int, flags)
555 ),
556
557 TP_fast_assign(
625d988a
CW
558 __entry->dev = vm->i915->drm.primary->index;
559 __entry->vm = vm;
560 __entry->start = node->start;
561 __entry->size = node->size;
562 __entry->color = node->color;
172ae5b4
CW
563 __entry->flags = flags;
564 ),
565
6c1fa341 566 TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
172ae5b4
CW
567 __entry->dev, __entry->vm,
568 __entry->start, __entry->size,
569 __entry->color, __entry->flags)
570);
571
65921223
CW
572TRACE_EVENT(i915_gem_evict_vm,
573 TP_PROTO(struct i915_address_space *vm),
574 TP_ARGS(vm),
575
576 TP_STRUCT__entry(
577 __field(u32, dev)
578 __field(struct i915_address_space *, vm)
579 ),
580
581 TP_fast_assign(
582 __entry->dev = vm->i915->drm.primary->index;
583 __entry->vm = vm;
584 ),
585
586 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
587);
588
e61e0f51
CW
589TRACE_EVENT(i915_request_queue,
590 TP_PROTO(struct i915_request *rq, u32 flags),
591 TP_ARGS(rq, flags),
1c5d22f7
CW
592
593 TP_STRUCT__entry(
4f49be54 594 __field(u32, dev)
151a99ec 595 __field(u32, hw_id)
57d7116c 596 __field(u64, ctx)
2956e970
TU
597 __field(u16, class)
598 __field(u16, instance)
1c5d22f7 599 __field(u32, seqno)
d7d4eedd 600 __field(u32, flags)
1c5d22f7
CW
601 ),
602
603 TP_fast_assign(
e61e0f51 604 __entry->dev = rq->i915->drm.primary->index;
4e0d64db 605 __entry->hw_id = rq->gem_context->hw_id;
2956e970
TU
606 __entry->class = rq->engine->uabi_class;
607 __entry->instance = rq->engine->instance;
e61e0f51
CW
608 __entry->ctx = rq->fence.context;
609 __entry->seqno = rq->fence.seqno;
d7d4eedd 610 __entry->flags = flags;
1c5d22f7
CW
611 ),
612
57d7116c 613 TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, flags=0x%x",
f24e74a7
TU
614 __entry->dev, __entry->class, __entry->instance,
615 __entry->hw_id, __entry->ctx, __entry->seqno,
2956e970 616 __entry->flags)
1c5d22f7
CW
617);
618
e61e0f51
CW
619DECLARE_EVENT_CLASS(i915_request,
620 TP_PROTO(struct i915_request *rq),
621 TP_ARGS(rq),
1c5d22f7
CW
622
623 TP_STRUCT__entry(
4f49be54 624 __field(u32, dev)
151a99ec 625 __field(u32, hw_id)
57d7116c 626 __field(u64, ctx)
2956e970
TU
627 __field(u16, class)
628 __field(u16, instance)
1c5d22f7 629 __field(u32, seqno)
e235b530 630 __field(u32, global)
1c5d22f7
CW
631 ),
632
633 TP_fast_assign(
e61e0f51 634 __entry->dev = rq->i915->drm.primary->index;
4e0d64db 635 __entry->hw_id = rq->gem_context->hw_id;
2956e970
TU
636 __entry->class = rq->engine->uabi_class;
637 __entry->instance = rq->engine->instance;
e61e0f51
CW
638 __entry->ctx = rq->fence.context;
639 __entry->seqno = rq->fence.seqno;
640 __entry->global = rq->global_seqno;
1c5d22f7
CW
641 ),
642
57d7116c 643 TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, global=%u",
f24e74a7
TU
644 __entry->dev, __entry->class, __entry->instance,
645 __entry->hw_id, __entry->ctx, __entry->seqno,
2956e970 646 __entry->global)
1c5d22f7
CW
647);
648
e61e0f51
CW
649DEFINE_EVENT(i915_request, i915_request_add,
650 TP_PROTO(struct i915_request *rq),
651 TP_ARGS(rq)
db53a302 652);
1c5d22f7 653
354d036f 654#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
e61e0f51
CW
655DEFINE_EVENT(i915_request, i915_request_submit,
656 TP_PROTO(struct i915_request *rq),
657 TP_ARGS(rq)
354d036f
TU
658);
659
e61e0f51
CW
660DEFINE_EVENT(i915_request, i915_request_execute,
661 TP_PROTO(struct i915_request *rq),
662 TP_ARGS(rq)
354d036f 663);
d7d96833 664
f2742e47
TU
665TRACE_EVENT(i915_request_in,
666 TP_PROTO(struct i915_request *rq, unsigned int port),
667 TP_ARGS(rq, port),
668
669 TP_STRUCT__entry(
670 __field(u32, dev)
671 __field(u32, hw_id)
57d7116c 672 __field(u64, ctx)
2956e970
TU
673 __field(u16, class)
674 __field(u16, instance)
f2742e47
TU
675 __field(u32, seqno)
676 __field(u32, global_seqno)
677 __field(u32, port)
678 __field(u32, prio)
679 ),
d7d96833 680
f2742e47
TU
681 TP_fast_assign(
682 __entry->dev = rq->i915->drm.primary->index;
4e0d64db 683 __entry->hw_id = rq->gem_context->hw_id;
2956e970
TU
684 __entry->class = rq->engine->uabi_class;
685 __entry->instance = rq->engine->instance;
f2742e47
TU
686 __entry->ctx = rq->fence.context;
687 __entry->seqno = rq->fence.seqno;
688 __entry->global_seqno = rq->global_seqno;
689 __entry->prio = rq->sched.attr.priority;
690 __entry->port = port;
691 ),
692
57d7116c 693 TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, prio=%u, global=%u, port=%u",
f24e74a7
TU
694 __entry->dev, __entry->class, __entry->instance,
695 __entry->hw_id, __entry->ctx, __entry->seqno,
2956e970 696 __entry->prio, __entry->global_seqno, __entry->port)
d7d96833
TU
697);
698
f2742e47
TU
699TRACE_EVENT(i915_request_out,
700 TP_PROTO(struct i915_request *rq),
701 TP_ARGS(rq),
702
703 TP_STRUCT__entry(
704 __field(u32, dev)
705 __field(u32, hw_id)
57d7116c 706 __field(u64, ctx)
2956e970
TU
707 __field(u16, class)
708 __field(u16, instance)
f2742e47
TU
709 __field(u32, seqno)
710 __field(u32, global_seqno)
711 __field(u32, completed)
712 ),
713
714 TP_fast_assign(
715 __entry->dev = rq->i915->drm.primary->index;
4e0d64db 716 __entry->hw_id = rq->gem_context->hw_id;
2956e970
TU
717 __entry->class = rq->engine->uabi_class;
718 __entry->instance = rq->engine->instance;
f2742e47
TU
719 __entry->ctx = rq->fence.context;
720 __entry->seqno = rq->fence.seqno;
721 __entry->global_seqno = rq->global_seqno;
722 __entry->completed = i915_request_completed(rq);
723 ),
724
57d7116c 725 TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, global=%u, completed?=%u",
f24e74a7
TU
726 __entry->dev, __entry->class, __entry->instance,
727 __entry->hw_id, __entry->ctx, __entry->seqno,
f2742e47 728 __entry->global_seqno, __entry->completed)
d7d96833 729);
f2742e47 730
354d036f
TU
731#else
732#if !defined(TRACE_HEADER_MULTI_READ)
733static inline void
e61e0f51 734trace_i915_request_submit(struct i915_request *rq)
354d036f
TU
735{
736}
737
738static inline void
e61e0f51 739trace_i915_request_execute(struct i915_request *rq)
354d036f
TU
740{
741}
d7d96833
TU
742
743static inline void
e61e0f51 744trace_i915_request_in(struct i915_request *rq, unsigned int port)
d7d96833
TU
745{
746}
747
748static inline void
e61e0f51 749trace_i915_request_out(struct i915_request *rq)
d7d96833
TU
750{
751}
354d036f
TU
752#endif
753#endif
754
e61e0f51
CW
755DEFINE_EVENT(i915_request, i915_request_retire,
756 TP_PROTO(struct i915_request *rq),
757 TP_ARGS(rq)
1c5d22f7
CW
758);
759
e61e0f51
CW
760TRACE_EVENT(i915_request_wait_begin,
761 TP_PROTO(struct i915_request *rq, unsigned int flags),
762 TP_ARGS(rq, flags),
f3fd3768
BW
763
764 TP_STRUCT__entry(
765 __field(u32, dev)
151a99ec 766 __field(u32, hw_id)
57d7116c 767 __field(u64, ctx)
2956e970
TU
768 __field(u16, class)
769 __field(u16, instance)
f3fd3768 770 __field(u32, seqno)
93692502
TU
771 __field(u32, global)
772 __field(unsigned int, flags)
f3fd3768
BW
773 ),
774
775 /* NB: the blocking information is racy since mutex_is_locked
776 * doesn't check that the current thread holds the lock. The only
777 * other option would be to pass the boolean information of whether
778 * or not the class was blocking down through the stack which is
779 * less desirable.
780 */
781 TP_fast_assign(
e61e0f51 782 __entry->dev = rq->i915->drm.primary->index;
4e0d64db 783 __entry->hw_id = rq->gem_context->hw_id;
2956e970
TU
784 __entry->class = rq->engine->uabi_class;
785 __entry->instance = rq->engine->instance;
e61e0f51
CW
786 __entry->ctx = rq->fence.context;
787 __entry->seqno = rq->fence.seqno;
788 __entry->global = rq->global_seqno;
93692502 789 __entry->flags = flags;
f3fd3768
BW
790 ),
791
57d7116c 792 TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, global=%u, blocking=%u, flags=0x%x",
f24e74a7
TU
793 __entry->dev, __entry->class, __entry->instance,
794 __entry->hw_id, __entry->ctx, __entry->seqno,
2956e970
TU
795 __entry->global, !!(__entry->flags & I915_WAIT_LOCKED),
796 __entry->flags)
903cf20c 797);
1c5d22f7 798
e61e0f51
CW
799DEFINE_EVENT(i915_request, i915_request_wait_end,
800 TP_PROTO(struct i915_request *rq),
801 TP_ARGS(rq)
1c5d22f7
CW
802);
803
ed71f1b4 804TRACE_EVENT_CONDITION(i915_reg_rw,
f0f59a00 805 TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
0206e353 806
ed71f1b4
CW
807 TP_ARGS(write, reg, val, len, trace),
808
809 TP_CONDITION(trace),
0206e353
AJ
810
811 TP_STRUCT__entry(
812 __field(u64, val)
813 __field(u32, reg)
814 __field(u16, write)
815 __field(u16, len)
816 ),
817
818 TP_fast_assign(
819 __entry->val = (u64)val;
f0f59a00 820 __entry->reg = i915_mmio_reg_offset(reg);
0206e353
AJ
821 __entry->write = write;
822 __entry->len = len;
823 ),
824
825 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
826 __entry->write ? "write" : "read",
827 __entry->reg, __entry->len,
828 (u32)(__entry->val & 0xffffffff),
829 (u32)(__entry->val >> 32))
ba4f01a3
YL
830);
831
be2cde9a
SV
832TRACE_EVENT(intel_gpu_freq_change,
833 TP_PROTO(u32 freq),
834 TP_ARGS(freq),
835
836 TP_STRUCT__entry(
837 __field(u32, freq)
838 ),
839
840 TP_fast_assign(
841 __entry->freq = freq;
842 ),
843
844 TP_printk("new_freq=%u", __entry->freq)
845);
846
198c974d
DCS
847/**
848 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
849 *
850 * With full ppgtt enabled each process using drm will allocate at least one
851 * translation table. With these traces it is possible to keep track of the
852 * allocation and of the lifetime of the tables; this can be used during
853 * testing/debug to verify that we are not leaking ppgtts.
854 * These traces identify the ppgtt through the vm pointer, which is also printed
855 * by the i915_vma_bind and i915_vma_unbind tracepoints.
856 */
857DECLARE_EVENT_CLASS(i915_ppgtt,
858 TP_PROTO(struct i915_address_space *vm),
859 TP_ARGS(vm),
860
861 TP_STRUCT__entry(
862 __field(struct i915_address_space *, vm)
863 __field(u32, dev)
864 ),
865
866 TP_fast_assign(
867 __entry->vm = vm;
c6385c94 868 __entry->dev = vm->i915->drm.primary->index;
198c974d
DCS
869 ),
870
871 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
872)
873
874DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
875 TP_PROTO(struct i915_address_space *vm),
876 TP_ARGS(vm)
877);
878
879DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
880 TP_PROTO(struct i915_address_space *vm),
881 TP_ARGS(vm)
882);
883
884/**
885 * DOC: i915_context_create and i915_context_free tracepoints
886 *
887 * These tracepoints are used to track creation and deletion of contexts.
888 * If full ppgtt is enabled, they also print the address of the vm assigned to
889 * the context.
890 */
891DECLARE_EVENT_CLASS(i915_context,
e2efd130 892 TP_PROTO(struct i915_gem_context *ctx),
198c974d
DCS
893 TP_ARGS(ctx),
894
895 TP_STRUCT__entry(
896 __field(u32, dev)
e2efd130 897 __field(struct i915_gem_context *, ctx)
99c181a0 898 __field(u32, hw_id)
198c974d
DCS
899 __field(struct i915_address_space *, vm)
900 ),
901
902 TP_fast_assign(
99c181a0 903 __entry->dev = ctx->i915->drm.primary->index;
198c974d 904 __entry->ctx = ctx;
99c181a0 905 __entry->hw_id = ctx->hw_id;
82ad6443 906 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->vm : NULL;
198c974d
DCS
907 ),
908
99c181a0
TU
909 TP_printk("dev=%u, ctx=%p, ctx_vm=%p, hw_id=%u",
910 __entry->dev, __entry->ctx, __entry->vm, __entry->hw_id)
198c974d
DCS
911)
912
913DEFINE_EVENT(i915_context, i915_context_create,
e2efd130 914 TP_PROTO(struct i915_gem_context *ctx),
198c974d
DCS
915 TP_ARGS(ctx)
916);
917
918DEFINE_EVENT(i915_context, i915_context_free,
e2efd130 919 TP_PROTO(struct i915_gem_context *ctx),
198c974d
DCS
920 TP_ARGS(ctx)
921);
922
1c5d22f7
CW
923#endif /* _I915_TRACE_H_ */
924
925/* This part must be outside protection */
926#undef TRACE_INCLUDE_PATH
4e6d7719 927#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
1c5d22f7 928#include <trace/define_trace.h>