blob: 4e76768ffa9570c0034575f77bbf3b2c682fa19b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Chris Wilson1c5d22f2009-08-25 11:15:50 +01002#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
9#include <drm/drmP.h>
Chris Wilson05394f32010-11-08 19:18:58 +000010#include "i915_drv.h"
Ville Syrjälä25ef2842014-04-29 13:35:48 +030011#include "intel_drv.h"
Chris Wilsondb53a302011-02-03 11:57:46 +000012#include "intel_ringbuffer.h"
Chris Wilson1c5d22f2009-08-25 11:15:50 +010013
14#undef TRACE_SYSTEM
15#define TRACE_SYSTEM i915
Chris Wilson1c5d22f2009-08-25 11:15:50 +010016#define TRACE_INCLUDE_FILE i915_trace
17
Ville Syrjäläc137d662017-03-02 19:15:06 +020018/* watermark/fifo updates */
19
Ville Syrjälä53a79152017-03-02 19:15:08 +020020TRACE_EVENT(intel_cpu_fifo_underrun,
21 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
22 TP_ARGS(dev_priv, pipe),
23
24 TP_STRUCT__entry(
25 __field(enum pipe, pipe)
26 __field(u32, frame)
27 __field(u32, scanline)
28 ),
29
30 TP_fast_assign(
31 __entry->pipe = pipe;
32 __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
33 __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
34 ),
35
36 TP_printk("pipe %c, frame=%u, scanline=%u",
37 pipe_name(__entry->pipe),
38 __entry->frame, __entry->scanline)
39);
40
41TRACE_EVENT(intel_pch_fifo_underrun,
Ville Syrjälä034263a2017-09-01 17:31:23 +030042 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder),
Ville Syrjälä53a79152017-03-02 19:15:08 +020043 TP_ARGS(dev_priv, pch_transcoder),
44
45 TP_STRUCT__entry(
46 __field(enum pipe, pipe)
47 __field(u32, frame)
48 __field(u32, scanline)
49 ),
50
51 TP_fast_assign(
Ville Syrjälä034263a2017-09-01 17:31:23 +030052 enum pipe pipe = pch_transcoder;
Ville Syrjälä53a79152017-03-02 19:15:08 +020053 __entry->pipe = pipe;
54 __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
55 __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
56 ),
57
58 TP_printk("pch transcoder %c, frame=%u, scanline=%u",
59 pipe_name(__entry->pipe),
60 __entry->frame, __entry->scanline)
61);
62
Ville Syrjälä1489bba2017-03-02 19:15:07 +020063TRACE_EVENT(intel_memory_cxsr,
64 TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new),
65 TP_ARGS(dev_priv, old, new),
66
67 TP_STRUCT__entry(
68 __array(u32, frame, 3)
69 __array(u32, scanline, 3)
70 __field(bool, old)
71 __field(bool, new)
72 ),
73
74 TP_fast_assign(
75 enum pipe pipe;
76 for_each_pipe(dev_priv, pipe) {
77 __entry->frame[pipe] =
78 dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
79 __entry->scanline[pipe] =
80 intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
81 }
82 __entry->old = old;
83 __entry->new = new;
84 ),
85
86 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
87 onoff(__entry->old), onoff(__entry->new),
88 __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
89 __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
90 __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
91);
92
Ville Syrjäläe93329a2017-04-21 21:14:31 +030093TRACE_EVENT(g4x_wm,
94 TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
95 TP_ARGS(crtc, wm),
96
97 TP_STRUCT__entry(
98 __field(enum pipe, pipe)
99 __field(u32, frame)
100 __field(u32, scanline)
101 __field(u16, primary)
102 __field(u16, sprite)
103 __field(u16, cursor)
104 __field(u16, sr_plane)
105 __field(u16, sr_cursor)
106 __field(u16, sr_fbc)
107 __field(u16, hpll_plane)
108 __field(u16, hpll_cursor)
109 __field(u16, hpll_fbc)
110 __field(bool, cxsr)
111 __field(bool, hpll)
112 __field(bool, fbc)
113 ),
114
115 TP_fast_assign(
116 __entry->pipe = crtc->pipe;
117 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
118 crtc->pipe);
119 __entry->scanline = intel_get_crtc_scanline(crtc);
120 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
121 __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
122 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
123 __entry->sr_plane = wm->sr.plane;
124 __entry->sr_cursor = wm->sr.cursor;
125 __entry->sr_fbc = wm->sr.fbc;
126 __entry->hpll_plane = wm->hpll.plane;
127 __entry->hpll_cursor = wm->hpll.cursor;
128 __entry->hpll_fbc = wm->hpll.fbc;
129 __entry->cxsr = wm->cxsr;
130 __entry->hpll = wm->hpll_en;
131 __entry->fbc = wm->fbc_en;
132 ),
133
134 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
135 pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
136 __entry->primary, __entry->sprite, __entry->cursor,
137 yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
138 yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
139 yesno(__entry->fbc))
140);
141
Ville Syrjäläc137d662017-03-02 19:15:06 +0200142TRACE_EVENT(vlv_wm,
143 TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
144 TP_ARGS(crtc, wm),
145
146 TP_STRUCT__entry(
147 __field(enum pipe, pipe)
148 __field(u32, frame)
149 __field(u32, scanline)
150 __field(u32, level)
151 __field(u32, cxsr)
152 __field(u32, primary)
153 __field(u32, sprite0)
154 __field(u32, sprite1)
155 __field(u32, cursor)
156 __field(u32, sr_plane)
157 __field(u32, sr_cursor)
158 ),
159
160 TP_fast_assign(
161 __entry->pipe = crtc->pipe;
162 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
163 crtc->pipe);
164 __entry->scanline = intel_get_crtc_scanline(crtc);
165 __entry->level = wm->level;
166 __entry->cxsr = wm->cxsr;
167 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
168 __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
169 __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
170 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
171 __entry->sr_plane = wm->sr.plane;
172 __entry->sr_cursor = wm->sr.cursor;
173 ),
174
175 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
176 pipe_name(__entry->pipe), __entry->frame,
177 __entry->scanline, __entry->level, __entry->cxsr,
178 __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
179 __entry->sr_plane, __entry->sr_cursor)
180);
181
182TRACE_EVENT(vlv_fifo_size,
183 TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
184 TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
185
186 TP_STRUCT__entry(
187 __field(enum pipe, pipe)
188 __field(u32, frame)
189 __field(u32, scanline)
190 __field(u32, sprite0_start)
191 __field(u32, sprite1_start)
192 __field(u32, fifo_size)
193 ),
194
195 TP_fast_assign(
196 __entry->pipe = crtc->pipe;
197 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
198 crtc->pipe);
199 __entry->scanline = intel_get_crtc_scanline(crtc);
200 __entry->sprite0_start = sprite0_start;
201 __entry->sprite1_start = sprite1_start;
202 __entry->fifo_size = fifo_size;
203 ),
204
205 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
206 pipe_name(__entry->pipe), __entry->frame,
207 __entry->scanline, __entry->sprite0_start,
208 __entry->sprite1_start, __entry->fifo_size)
209);
210
Ville Syrjälä72259532017-03-02 19:15:05 +0200211/* plane updates */
212
213TRACE_EVENT(intel_update_plane,
214 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
215 TP_ARGS(plane, crtc),
216
217 TP_STRUCT__entry(
218 __field(enum pipe, pipe)
219 __field(const char *, name)
220 __field(u32, frame)
221 __field(u32, scanline)
222 __array(int, src, 4)
223 __array(int, dst, 4)
224 ),
225
226 TP_fast_assign(
227 __entry->pipe = crtc->pipe;
228 __entry->name = plane->name;
229 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
230 crtc->pipe);
231 __entry->scanline = intel_get_crtc_scanline(crtc);
232 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
233 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
234 ),
235
236 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
237 pipe_name(__entry->pipe), __entry->name,
238 __entry->frame, __entry->scanline,
239 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
240 DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
241);
242
243TRACE_EVENT(intel_disable_plane,
244 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
245 TP_ARGS(plane, crtc),
246
247 TP_STRUCT__entry(
248 __field(enum pipe, pipe)
249 __field(const char *, name)
250 __field(u32, frame)
251 __field(u32, scanline)
252 ),
253
254 TP_fast_assign(
255 __entry->pipe = crtc->pipe;
256 __entry->name = plane->name;
257 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
258 crtc->pipe);
259 __entry->scanline = intel_get_crtc_scanline(crtc);
260 ),
261
262 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
263 pipe_name(__entry->pipe), __entry->name,
264 __entry->frame, __entry->scanline)
265);
266
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300267/* pipe updates */
268
269TRACE_EVENT(i915_pipe_update_start,
Jesse Barnesd637ce32015-09-17 08:08:32 -0700270 TP_PROTO(struct intel_crtc *crtc),
271 TP_ARGS(crtc),
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300272
273 TP_STRUCT__entry(
274 __field(enum pipe, pipe)
275 __field(u32, frame)
276 __field(u32, scanline)
277 __field(u32, min)
278 __field(u32, max)
279 ),
280
281 TP_fast_assign(
282 __entry->pipe = crtc->pipe;
283 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
284 crtc->pipe);
285 __entry->scanline = intel_get_crtc_scanline(crtc);
Jesse Barnesd637ce32015-09-17 08:08:32 -0700286 __entry->min = crtc->debug.min_vbl;
287 __entry->max = crtc->debug.max_vbl;
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300288 ),
289
290 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
291 pipe_name(__entry->pipe), __entry->frame,
292 __entry->scanline, __entry->min, __entry->max)
293);
294
295TRACE_EVENT(i915_pipe_update_vblank_evaded,
Jesse Barnesd637ce32015-09-17 08:08:32 -0700296 TP_PROTO(struct intel_crtc *crtc),
297 TP_ARGS(crtc),
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300298
299 TP_STRUCT__entry(
300 __field(enum pipe, pipe)
301 __field(u32, frame)
302 __field(u32, scanline)
303 __field(u32, min)
304 __field(u32, max)
305 ),
306
307 TP_fast_assign(
308 __entry->pipe = crtc->pipe;
Jesse Barnesd637ce32015-09-17 08:08:32 -0700309 __entry->frame = crtc->debug.start_vbl_count;
310 __entry->scanline = crtc->debug.scanline_start;
311 __entry->min = crtc->debug.min_vbl;
312 __entry->max = crtc->debug.max_vbl;
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300313 ),
314
315 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
316 pipe_name(__entry->pipe), __entry->frame,
317 __entry->scanline, __entry->min, __entry->max)
318);
319
320TRACE_EVENT(i915_pipe_update_end,
Jesse Barnesd637ce32015-09-17 08:08:32 -0700321 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
322 TP_ARGS(crtc, frame, scanline_end),
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300323
324 TP_STRUCT__entry(
325 __field(enum pipe, pipe)
326 __field(u32, frame)
327 __field(u32, scanline)
328 ),
329
330 TP_fast_assign(
331 __entry->pipe = crtc->pipe;
332 __entry->frame = frame;
Jesse Barnesd637ce32015-09-17 08:08:32 -0700333 __entry->scanline = scanline_end;
Ville Syrjälä25ef2842014-04-29 13:35:48 +0300334 ),
335
336 TP_printk("pipe %c, frame=%u, scanline=%u",
337 pipe_name(__entry->pipe), __entry->frame,
338 __entry->scanline)
339);
340
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100341/* object tracking */
342
343TRACE_EVENT(i915_gem_object_create,
Chris Wilson05394f32010-11-08 19:18:58 +0000344 TP_PROTO(struct drm_i915_gem_object *obj),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100345 TP_ARGS(obj),
346
347 TP_STRUCT__entry(
Chris Wilson05394f32010-11-08 19:18:58 +0000348 __field(struct drm_i915_gem_object *, obj)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100349 __field(u64, size)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100350 ),
351
352 TP_fast_assign(
353 __entry->obj = obj;
Chris Wilson05394f32010-11-08 19:18:58 +0000354 __entry->size = obj->base.size;
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100355 ),
356
Chris Wilson6c1fa342017-10-03 13:50:54 +0100357 TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100358);
359
Chris Wilson3abafa52015-10-01 12:18:26 +0100360TRACE_EVENT(i915_gem_shrink,
361 TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
362 TP_ARGS(i915, target, flags),
363
364 TP_STRUCT__entry(
365 __field(int, dev)
366 __field(unsigned long, target)
367 __field(unsigned, flags)
368 ),
369
370 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100371 __entry->dev = i915->drm.primary->index;
Chris Wilson3abafa52015-10-01 12:18:26 +0100372 __entry->target = target;
373 __entry->flags = flags;
374 ),
375
376 TP_printk("dev=%d, target=%lu, flags=%x",
377 __entry->dev, __entry->target, __entry->flags)
378);
379
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700380TRACE_EVENT(i915_vma_bind,
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100381 TP_PROTO(struct i915_vma *vma, unsigned flags),
382 TP_ARGS(vma, flags),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100383
384 TP_STRUCT__entry(
Chris Wilson05394f32010-11-08 19:18:58 +0000385 __field(struct drm_i915_gem_object *, obj)
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700386 __field(struct i915_address_space *, vm)
Ben Widawsky33938712015-01-22 17:01:23 +0000387 __field(u64, offset)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100388 __field(u64, size)
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100389 __field(unsigned, flags)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100390 ),
391
392 TP_fast_assign(
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700393 __entry->obj = vma->obj;
394 __entry->vm = vma->vm;
395 __entry->offset = vma->node.start;
396 __entry->size = vma->node.size;
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100397 __entry->flags = flags;
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100398 ),
399
Chris Wilson6c1fa342017-10-03 13:50:54 +0100400 TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
Chris Wilsondb53a302011-02-03 11:57:46 +0000401 __entry->obj, __entry->offset, __entry->size,
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100402 __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700403 __entry->vm)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100404);
405
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700406TRACE_EVENT(i915_vma_unbind,
407 TP_PROTO(struct i915_vma *vma),
408 TP_ARGS(vma),
Chris Wilsondb53a302011-02-03 11:57:46 +0000409
410 TP_STRUCT__entry(
411 __field(struct drm_i915_gem_object *, obj)
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700412 __field(struct i915_address_space *, vm)
Ben Widawsky33938712015-01-22 17:01:23 +0000413 __field(u64, offset)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100414 __field(u64, size)
Chris Wilsondb53a302011-02-03 11:57:46 +0000415 ),
416
417 TP_fast_assign(
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700418 __entry->obj = vma->obj;
419 __entry->vm = vma->vm;
420 __entry->offset = vma->node.start;
421 __entry->size = vma->node.size;
Chris Wilsondb53a302011-02-03 11:57:46 +0000422 ),
423
Chris Wilson6c1fa342017-10-03 13:50:54 +0100424 TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
Ben Widawsky07fe0b12013-07-31 17:00:10 -0700425 __entry->obj, __entry->offset, __entry->size, __entry->vm)
Chris Wilsondb53a302011-02-03 11:57:46 +0000426);
427
Chris Wilsondb53a302011-02-03 11:57:46 +0000428TRACE_EVENT(i915_gem_object_pwrite,
Chris Wilson6c1fa342017-10-03 13:50:54 +0100429 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
Chris Wilsondb53a302011-02-03 11:57:46 +0000430 TP_ARGS(obj, offset, len),
431
432 TP_STRUCT__entry(
433 __field(struct drm_i915_gem_object *, obj)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100434 __field(u64, offset)
435 __field(u64, len)
Chris Wilsondb53a302011-02-03 11:57:46 +0000436 ),
437
438 TP_fast_assign(
439 __entry->obj = obj;
440 __entry->offset = offset;
441 __entry->len = len;
442 ),
443
Chris Wilson6c1fa342017-10-03 13:50:54 +0100444 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
Chris Wilsondb53a302011-02-03 11:57:46 +0000445 __entry->obj, __entry->offset, __entry->len)
446);
447
448TRACE_EVENT(i915_gem_object_pread,
Chris Wilson6c1fa342017-10-03 13:50:54 +0100449 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
Chris Wilsondb53a302011-02-03 11:57:46 +0000450 TP_ARGS(obj, offset, len),
451
452 TP_STRUCT__entry(
453 __field(struct drm_i915_gem_object *, obj)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100454 __field(u64, offset)
455 __field(u64, len)
Chris Wilsondb53a302011-02-03 11:57:46 +0000456 ),
457
458 TP_fast_assign(
459 __entry->obj = obj;
460 __entry->offset = offset;
461 __entry->len = len;
462 ),
463
Chris Wilson6c1fa342017-10-03 13:50:54 +0100464 TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
Chris Wilsondb53a302011-02-03 11:57:46 +0000465 __entry->obj, __entry->offset, __entry->len)
466);
467
468TRACE_EVENT(i915_gem_object_fault,
Chris Wilson6c1fa342017-10-03 13:50:54 +0100469 TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write),
Chris Wilsondb53a302011-02-03 11:57:46 +0000470 TP_ARGS(obj, index, gtt, write),
471
472 TP_STRUCT__entry(
473 __field(struct drm_i915_gem_object *, obj)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100474 __field(u64, index)
Chris Wilsondb53a302011-02-03 11:57:46 +0000475 __field(bool, gtt)
476 __field(bool, write)
477 ),
478
479 TP_fast_assign(
480 __entry->obj = obj;
481 __entry->index = index;
482 __entry->gtt = gtt;
483 __entry->write = write;
484 ),
485
Chris Wilson6c1fa342017-10-03 13:50:54 +0100486 TP_printk("obj=%p, %s index=%llu %s",
Chris Wilsondb53a302011-02-03 11:57:46 +0000487 __entry->obj,
488 __entry->gtt ? "GTT" : "CPU",
489 __entry->index,
490 __entry->write ? ", writable" : "")
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100491);
492
Li Zefan903cf202010-03-11 16:41:45 +0800493DECLARE_EVENT_CLASS(i915_gem_object,
Chris Wilson05394f32010-11-08 19:18:58 +0000494 TP_PROTO(struct drm_i915_gem_object *obj),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100495 TP_ARGS(obj),
496
497 TP_STRUCT__entry(
Chris Wilson05394f32010-11-08 19:18:58 +0000498 __field(struct drm_i915_gem_object *, obj)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100499 ),
500
501 TP_fast_assign(
502 __entry->obj = obj;
503 ),
504
505 TP_printk("obj=%p", __entry->obj)
506);
507
Li Zefanf41275e2010-05-24 16:25:44 +0800508DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
Chris Wilsondb53a302011-02-03 11:57:46 +0000509 TP_PROTO(struct drm_i915_gem_object *obj),
510 TP_ARGS(obj)
Li Zefan903cf202010-03-11 16:41:45 +0800511);
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100512
Li Zefan903cf202010-03-11 16:41:45 +0800513DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
Chris Wilson05394f32010-11-08 19:18:58 +0000514 TP_PROTO(struct drm_i915_gem_object *obj),
Li Zefan903cf202010-03-11 16:41:45 +0800515 TP_ARGS(obj)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100516);
517
Chris Wilsondb53a302011-02-03 11:57:46 +0000518TRACE_EVENT(i915_gem_evict,
Chris Wilson6c1fa342017-10-03 13:50:54 +0100519 TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags),
Chris Wilsone522ac22016-08-04 16:32:18 +0100520 TP_ARGS(vm, size, align, flags),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100521
522 TP_STRUCT__entry(
Chris Wilson4f49be52009-09-24 00:23:33 +0100523 __field(u32, dev)
Chris Wilsone522ac22016-08-04 16:32:18 +0100524 __field(struct i915_address_space *, vm)
Chris Wilson6c1fa342017-10-03 13:50:54 +0100525 __field(u64, size)
526 __field(u64, align)
Chris Wilsone522ac22016-08-04 16:32:18 +0100527 __field(unsigned int, flags)
Chris Wilsondb53a302011-02-03 11:57:46 +0000528 ),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100529
530 TP_fast_assign(
Chris Wilsonc6385c92016-11-29 12:42:05 +0000531 __entry->dev = vm->i915->drm.primary->index;
Chris Wilsone522ac22016-08-04 16:32:18 +0100532 __entry->vm = vm;
Chris Wilsondb53a302011-02-03 11:57:46 +0000533 __entry->size = size;
534 __entry->align = align;
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100535 __entry->flags = flags;
Chris Wilsondb53a302011-02-03 11:57:46 +0000536 ),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100537
Chris Wilson6c1fa342017-10-03 13:50:54 +0100538 TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
Chris Wilsone522ac22016-08-04 16:32:18 +0100539 __entry->dev, __entry->vm, __entry->size, __entry->align,
Daniel Vetter1ec9e262014-02-14 14:01:11 +0100540 __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100541);
542
Chris Wilson625d9882017-01-11 11:23:11 +0000543TRACE_EVENT(i915_gem_evict_node,
544 TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags),
545 TP_ARGS(vm, node, flags),
Chris Wilson172ae5b2016-12-05 14:29:37 +0000546
547 TP_STRUCT__entry(
548 __field(u32, dev)
549 __field(struct i915_address_space *, vm)
550 __field(u64, start)
551 __field(u64, size)
552 __field(unsigned long, color)
553 __field(unsigned int, flags)
554 ),
555
556 TP_fast_assign(
Chris Wilson625d9882017-01-11 11:23:11 +0000557 __entry->dev = vm->i915->drm.primary->index;
558 __entry->vm = vm;
559 __entry->start = node->start;
560 __entry->size = node->size;
561 __entry->color = node->color;
Chris Wilson172ae5b2016-12-05 14:29:37 +0000562 __entry->flags = flags;
563 ),
564
Chris Wilson6c1fa342017-10-03 13:50:54 +0100565 TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
Chris Wilson172ae5b2016-12-05 14:29:37 +0000566 __entry->dev, __entry->vm,
567 __entry->start, __entry->size,
568 __entry->color, __entry->flags)
569);
570
Chris Wilson65921222017-10-03 13:50:55 +0100571TRACE_EVENT(i915_gem_evict_vm,
572 TP_PROTO(struct i915_address_space *vm),
573 TP_ARGS(vm),
574
575 TP_STRUCT__entry(
576 __field(u32, dev)
577 __field(struct i915_address_space *, vm)
578 ),
579
580 TP_fast_assign(
581 __entry->dev = vm->i915->drm.primary->index;
582 __entry->vm = vm;
583 ),
584
585 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
586);
587
Chris Wilsonb52b89d2013-09-25 11:43:28 +0100588TRACE_EVENT(i915_gem_ring_sync_to,
Chris Wilson8e637172016-08-02 22:50:26 +0100589 TP_PROTO(struct drm_i915_gem_request *to,
590 struct drm_i915_gem_request *from),
591 TP_ARGS(to, from),
Chris Wilsonb52b89d2013-09-25 11:43:28 +0100592
593 TP_STRUCT__entry(
594 __field(u32, dev)
595 __field(u32, sync_from)
596 __field(u32, sync_to)
597 __field(u32, seqno)
598 ),
599
600 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100601 __entry->dev = from->i915->drm.primary->index;
Chris Wilson8e637172016-08-02 22:50:26 +0100602 __entry->sync_from = from->engine->id;
603 __entry->sync_to = to->engine->id;
Chris Wilson65e47602016-10-28 13:58:49 +0100604 __entry->seqno = from->global_seqno;
Chris Wilsonb52b89d2013-09-25 11:43:28 +0100605 ),
606
607 TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u",
608 __entry->dev,
609 __entry->sync_from, __entry->sync_to,
610 __entry->seqno)
611);
612
Tvrtko Ursulin1cce8922017-02-21 09:13:44 +0000613TRACE_EVENT(i915_gem_request_queue,
John Harrison74328ee2014-11-24 18:49:38 +0000614 TP_PROTO(struct drm_i915_gem_request *req, u32 flags),
615 TP_ARGS(req, flags),
Chris Wilsondb53a302011-02-03 11:57:46 +0000616
617 TP_STRUCT__entry(
618 __field(u32, dev)
619 __field(u32, ring)
Tvrtko Ursulin1cce8922017-02-21 09:13:44 +0000620 __field(u32, ctx)
Chris Wilsondb53a302011-02-03 11:57:46 +0000621 __field(u32, seqno)
Chris Wilsond7d4eed2012-10-17 12:09:54 +0100622 __field(u32, flags)
Chris Wilsondb53a302011-02-03 11:57:46 +0000623 ),
624
625 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100626 __entry->dev = req->i915->drm.primary->index;
Chris Wilsonc0336662016-05-06 15:40:21 +0100627 __entry->ring = req->engine->id;
Chris Wilson60367132017-03-16 20:42:35 +0000628 __entry->ctx = req->fence.context;
Tvrtko Ursulin1cce8922017-02-21 09:13:44 +0000629 __entry->seqno = req->fence.seqno;
Chris Wilsond7d4eed2012-10-17 12:09:54 +0100630 __entry->flags = flags;
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100631 ),
632
Tvrtko Ursulin1cce8922017-02-21 09:13:44 +0000633 TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, flags=0x%x",
634 __entry->dev, __entry->ring, __entry->ctx, __entry->seqno,
635 __entry->flags)
Chris Wilsondb53a302011-02-03 11:57:46 +0000636);
637
Li Zefan903cf202010-03-11 16:41:45 +0800638DECLARE_EVENT_CLASS(i915_gem_request,
John Harrison74328ee2014-11-24 18:49:38 +0000639 TP_PROTO(struct drm_i915_gem_request *req),
640 TP_ARGS(req),
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100641
642 TP_STRUCT__entry(
Chris Wilson4f49be52009-09-24 00:23:33 +0100643 __field(u32, dev)
Tvrtko Ursuline235b532017-02-21 09:13:43 +0000644 __field(u32, ctx)
Chris Wilsondb53a302011-02-03 11:57:46 +0000645 __field(u32, ring)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100646 __field(u32, seqno)
Tvrtko Ursuline235b532017-02-21 09:13:43 +0000647 __field(u32, global)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100648 ),
649
650 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100651 __entry->dev = req->i915->drm.primary->index;
Chris Wilsonc0336662016-05-06 15:40:21 +0100652 __entry->ring = req->engine->id;
Chris Wilson60367132017-03-16 20:42:35 +0000653 __entry->ctx = req->fence.context;
Tvrtko Ursuline235b532017-02-21 09:13:43 +0000654 __entry->seqno = req->fence.seqno;
655 __entry->global = req->global_seqno;
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100656 ),
657
Tvrtko Ursuline235b532017-02-21 09:13:43 +0000658 TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u",
659 __entry->dev, __entry->ring, __entry->ctx, __entry->seqno,
660 __entry->global)
Chris Wilsondb53a302011-02-03 11:57:46 +0000661);
662
663DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
John Harrison74328ee2014-11-24 18:49:38 +0000664 TP_PROTO(struct drm_i915_gem_request *req),
665 TP_ARGS(req)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100666);
667
Tvrtko Ursulin354d0362017-02-21 11:01:42 +0000668#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
669DEFINE_EVENT(i915_gem_request, i915_gem_request_submit,
670 TP_PROTO(struct drm_i915_gem_request *req),
671 TP_ARGS(req)
672);
673
674DEFINE_EVENT(i915_gem_request, i915_gem_request_execute,
675 TP_PROTO(struct drm_i915_gem_request *req),
676 TP_ARGS(req)
677);
Tvrtko Ursulind7d96832017-02-21 11:03:00 +0000678
679DECLARE_EVENT_CLASS(i915_gem_request_hw,
680 TP_PROTO(struct drm_i915_gem_request *req,
681 unsigned int port),
682 TP_ARGS(req, port),
683
684 TP_STRUCT__entry(
685 __field(u32, dev)
686 __field(u32, ring)
687 __field(u32, seqno)
688 __field(u32, global_seqno)
689 __field(u32, ctx)
690 __field(u32, port)
691 ),
692
693 TP_fast_assign(
694 __entry->dev = req->i915->drm.primary->index;
695 __entry->ring = req->engine->id;
Chris Wilson60367132017-03-16 20:42:35 +0000696 __entry->ctx = req->fence.context;
Tvrtko Ursulind7d96832017-02-21 11:03:00 +0000697 __entry->seqno = req->fence.seqno;
698 __entry->global_seqno = req->global_seqno;
699 __entry->port = port;
700 ),
701
702 TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, port=%u",
703 __entry->dev, __entry->ring, __entry->ctx,
704 __entry->seqno, __entry->global_seqno,
705 __entry->port)
706);
707
708DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in,
709 TP_PROTO(struct drm_i915_gem_request *req, unsigned int port),
710 TP_ARGS(req, port)
711);
712
713DEFINE_EVENT(i915_gem_request, i915_gem_request_out,
714 TP_PROTO(struct drm_i915_gem_request *req),
715 TP_ARGS(req)
716);
Tvrtko Ursulin354d0362017-02-21 11:01:42 +0000717#else
718#if !defined(TRACE_HEADER_MULTI_READ)
719static inline void
720trace_i915_gem_request_submit(struct drm_i915_gem_request *req)
721{
722}
723
724static inline void
725trace_i915_gem_request_execute(struct drm_i915_gem_request *req)
726{
727}
Tvrtko Ursulind7d96832017-02-21 11:03:00 +0000728
729static inline void
730trace_i915_gem_request_in(struct drm_i915_gem_request *req, unsigned int port)
731{
732}
733
734static inline void
735trace_i915_gem_request_out(struct drm_i915_gem_request *req)
736{
737}
Tvrtko Ursulin354d0362017-02-21 11:01:42 +0000738#endif
739#endif
740
Tvrtko Ursulindffabc82017-02-21 09:13:48 +0000741TRACE_EVENT(intel_engine_notify,
742 TP_PROTO(struct intel_engine_cs *engine, bool waiters),
743 TP_ARGS(engine, waiters),
Chris Wilson814e9b52013-09-23 17:33:19 -0300744
745 TP_STRUCT__entry(
746 __field(u32, dev)
747 __field(u32, ring)
748 __field(u32, seqno)
Tvrtko Ursulindffabc82017-02-21 09:13:48 +0000749 __field(bool, waiters)
Chris Wilson814e9b52013-09-23 17:33:19 -0300750 ),
751
752 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100753 __entry->dev = engine->i915->drm.primary->index;
Tvrtko Ursulin4a570db2016-03-16 11:00:38 +0000754 __entry->ring = engine->id;
Chris Wilson1b7744e2016-07-01 17:23:17 +0100755 __entry->seqno = intel_engine_get_seqno(engine);
Tvrtko Ursulindffabc82017-02-21 09:13:48 +0000756 __entry->waiters = waiters;
Chris Wilson814e9b52013-09-23 17:33:19 -0300757 ),
758
Tvrtko Ursulindffabc82017-02-21 09:13:48 +0000759 TP_printk("dev=%u, ring=%u, seqno=%u, waiters=%u",
760 __entry->dev, __entry->ring, __entry->seqno,
761 __entry->waiters)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100762);
763
Li Zefan903cf202010-03-11 16:41:45 +0800764DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
John Harrison74328ee2014-11-24 18:49:38 +0000765 TP_PROTO(struct drm_i915_gem_request *req),
766 TP_ARGS(req)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100767);
768
Ben Widawskyf3fd3762012-05-24 15:03:09 -0700769TRACE_EVENT(i915_gem_request_wait_begin,
Tvrtko Ursulin93692502017-02-21 11:00:24 +0000770 TP_PROTO(struct drm_i915_gem_request *req, unsigned int flags),
771 TP_ARGS(req, flags),
Ben Widawskyf3fd3762012-05-24 15:03:09 -0700772
773 TP_STRUCT__entry(
774 __field(u32, dev)
775 __field(u32, ring)
Tvrtko Ursulin93692502017-02-21 11:00:24 +0000776 __field(u32, ctx)
Ben Widawskyf3fd3762012-05-24 15:03:09 -0700777 __field(u32, seqno)
Tvrtko Ursulin93692502017-02-21 11:00:24 +0000778 __field(u32, global)
779 __field(unsigned int, flags)
Ben Widawskyf3fd3762012-05-24 15:03:09 -0700780 ),
781
782 /* NB: the blocking information is racy since mutex_is_locked
783 * doesn't check that the current thread holds the lock. The only
784 * other option would be to pass the boolean information of whether
785 * or not the class was blocking down through the stack which is
786 * less desirable.
787 */
788 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100789 __entry->dev = req->i915->drm.primary->index;
Chris Wilsonc0336662016-05-06 15:40:21 +0100790 __entry->ring = req->engine->id;
Chris Wilson60367132017-03-16 20:42:35 +0000791 __entry->ctx = req->fence.context;
Tvrtko Ursulin93692502017-02-21 11:00:24 +0000792 __entry->seqno = req->fence.seqno;
793 __entry->global = req->global_seqno;
794 __entry->flags = flags;
Ben Widawskyf3fd3762012-05-24 15:03:09 -0700795 ),
796
Tvrtko Ursulin93692502017-02-21 11:00:24 +0000797 TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, blocking=%u, flags=0x%x",
798 __entry->dev, __entry->ring, __entry->ctx, __entry->seqno,
799 __entry->global, !!(__entry->flags & I915_WAIT_LOCKED),
800 __entry->flags)
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100801);
802
Li Zefan903cf202010-03-11 16:41:45 +0800803DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
John Harrison74328ee2014-11-24 18:49:38 +0000804 TP_PROTO(struct drm_i915_gem_request *req),
805 TP_ARGS(req)
Li Zefan903cf202010-03-11 16:41:45 +0800806);
807
Jesse Barnese5510fa2010-07-01 16:48:37 -0700808TRACE_EVENT(i915_flip_request,
Chris Wilson05394f32010-11-08 19:18:58 +0000809 TP_PROTO(int plane, struct drm_i915_gem_object *obj),
Jesse Barnese5510fa2010-07-01 16:48:37 -0700810
811 TP_ARGS(plane, obj),
812
813 TP_STRUCT__entry(
814 __field(int, plane)
Chris Wilson05394f32010-11-08 19:18:58 +0000815 __field(struct drm_i915_gem_object *, obj)
Jesse Barnese5510fa2010-07-01 16:48:37 -0700816 ),
817
818 TP_fast_assign(
819 __entry->plane = plane;
820 __entry->obj = obj;
821 ),
822
823 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
824);
825
826TRACE_EVENT(i915_flip_complete,
Chris Wilson05394f32010-11-08 19:18:58 +0000827 TP_PROTO(int plane, struct drm_i915_gem_object *obj),
Jesse Barnese5510fa2010-07-01 16:48:37 -0700828
829 TP_ARGS(plane, obj),
830
831 TP_STRUCT__entry(
832 __field(int, plane)
Chris Wilson05394f32010-11-08 19:18:58 +0000833 __field(struct drm_i915_gem_object *, obj)
Jesse Barnese5510fa2010-07-01 16:48:37 -0700834 ),
835
836 TP_fast_assign(
837 __entry->plane = plane;
838 __entry->obj = obj;
839 ),
840
841 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
842);
843
Chris Wilsoned71f1b2013-07-19 20:36:56 +0100844TRACE_EVENT_CONDITION(i915_reg_rw,
Ville Syrjäläf0f59a02015-11-18 15:33:26 +0200845 TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
Yuanhan Liuba4f01a2010-11-08 17:09:41 +0800846
Chris Wilsoned71f1b2013-07-19 20:36:56 +0100847 TP_ARGS(write, reg, val, len, trace),
848
849 TP_CONDITION(trace),
Yuanhan Liuba4f01a2010-11-08 17:09:41 +0800850
Akshay Joshi0206e352011-08-16 15:34:10 -0400851 TP_STRUCT__entry(
852 __field(u64, val)
853 __field(u32, reg)
854 __field(u16, write)
855 __field(u16, len)
856 ),
Yuanhan Liuba4f01a2010-11-08 17:09:41 +0800857
Akshay Joshi0206e352011-08-16 15:34:10 -0400858 TP_fast_assign(
859 __entry->val = (u64)val;
Ville Syrjäläf0f59a02015-11-18 15:33:26 +0200860 __entry->reg = i915_mmio_reg_offset(reg);
Akshay Joshi0206e352011-08-16 15:34:10 -0400861 __entry->write = write;
862 __entry->len = len;
863 ),
Yuanhan Liuba4f01a2010-11-08 17:09:41 +0800864
Akshay Joshi0206e352011-08-16 15:34:10 -0400865 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
866 __entry->write ? "write" : "read",
867 __entry->reg, __entry->len,
868 (u32)(__entry->val & 0xffffffff),
869 (u32)(__entry->val >> 32))
Yuanhan Liuba4f01a2010-11-08 17:09:41 +0800870);
871
Daniel Vetterbe2cde92012-08-30 13:26:48 +0200872TRACE_EVENT(intel_gpu_freq_change,
873 TP_PROTO(u32 freq),
874 TP_ARGS(freq),
875
876 TP_STRUCT__entry(
877 __field(u32, freq)
878 ),
879
880 TP_fast_assign(
881 __entry->freq = freq;
882 ),
883
884 TP_printk("new_freq=%u", __entry->freq)
885);
886
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000887/**
888 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
889 *
890 * With full ppgtt enabled each process using drm will allocate at least one
891 * translation table. With these traces it is possible to keep track of the
892 * allocation and of the lifetime of the tables; this can be used during
893 * testing/debug to verify that we are not leaking ppgtts.
894 * These traces identify the ppgtt through the vm pointer, which is also printed
895 * by the i915_vma_bind and i915_vma_unbind tracepoints.
896 */
897DECLARE_EVENT_CLASS(i915_ppgtt,
898 TP_PROTO(struct i915_address_space *vm),
899 TP_ARGS(vm),
900
901 TP_STRUCT__entry(
902 __field(struct i915_address_space *, vm)
903 __field(u32, dev)
904 ),
905
906 TP_fast_assign(
907 __entry->vm = vm;
Chris Wilsonc6385c92016-11-29 12:42:05 +0000908 __entry->dev = vm->i915->drm.primary->index;
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000909 ),
910
911 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
912)
913
914DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
915 TP_PROTO(struct i915_address_space *vm),
916 TP_ARGS(vm)
917);
918
919DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
920 TP_PROTO(struct i915_address_space *vm),
921 TP_ARGS(vm)
922);
923
924/**
925 * DOC: i915_context_create and i915_context_free tracepoints
926 *
927 * These tracepoints are used to track creation and deletion of contexts.
928 * If full ppgtt is enabled, they also print the address of the vm assigned to
929 * the context.
930 */
931DECLARE_EVENT_CLASS(i915_context,
Chris Wilsone2efd132016-05-24 14:53:34 +0100932 TP_PROTO(struct i915_gem_context *ctx),
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000933 TP_ARGS(ctx),
934
935 TP_STRUCT__entry(
936 __field(u32, dev)
Chris Wilsone2efd132016-05-24 14:53:34 +0100937 __field(struct i915_gem_context *, ctx)
Tvrtko Ursulin99c181a2017-02-21 09:13:50 +0000938 __field(u32, hw_id)
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000939 __field(struct i915_address_space *, vm)
940 ),
941
942 TP_fast_assign(
Chris Wilson91c8a322016-07-05 10:40:23 +0100943 __entry->dev = ctx->i915->drm.primary->index;
Tvrtko Ursulin99c181a2017-02-21 09:13:50 +0000944 __entry->ctx = ctx;
945 __entry->hw_id = ctx->hw_id;
946 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000947 ),
948
Tvrtko Ursulin99c181a2017-02-21 09:13:50 +0000949 TP_printk("dev=%u, ctx=%p, ctx_vm=%p, hw_id=%u",
950 __entry->dev, __entry->ctx, __entry->vm, __entry->hw_id)
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000951)
952
953DEFINE_EVENT(i915_context, i915_context_create,
Chris Wilsone2efd132016-05-24 14:53:34 +0100954 TP_PROTO(struct i915_gem_context *ctx),
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000955 TP_ARGS(ctx)
956);
957
958DEFINE_EVENT(i915_context, i915_context_free,
Chris Wilsone2efd132016-05-24 14:53:34 +0100959 TP_PROTO(struct i915_gem_context *ctx),
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000960 TP_ARGS(ctx)
961);
962
963/**
964 * DOC: switch_mm tracepoint
965 *
966 * This tracepoint allows tracking of the mm switch, which is an important point
967 * in the lifetime of the vm in the legacy submission path. This tracepoint is
968 * called only if full ppgtt is enabled.
969 */
970TRACE_EVENT(switch_mm,
Chris Wilsone2efd132016-05-24 14:53:34 +0100971 TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to),
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000972
Tvrtko Ursulin4a570db2016-03-16 11:00:38 +0000973 TP_ARGS(engine, to),
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000974
975 TP_STRUCT__entry(
976 __field(u32, ring)
Chris Wilsone2efd132016-05-24 14:53:34 +0100977 __field(struct i915_gem_context *, to)
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000978 __field(struct i915_address_space *, vm)
979 __field(u32, dev)
980 ),
981
982 TP_fast_assign(
Tvrtko Ursulin4a570db2016-03-16 11:00:38 +0000983 __entry->ring = engine->id;
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000984 __entry->to = to;
985 __entry->vm = to->ppgtt? &to->ppgtt->base : NULL;
Chris Wilson91c8a322016-07-05 10:40:23 +0100986 __entry->dev = engine->i915->drm.primary->index;
Daniele Ceraolo Spurio198c9742014-11-10 13:44:31 +0000987 ),
988
989 TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p",
990 __entry->dev, __entry->ring, __entry->to, __entry->vm)
991);
992
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100993#endif /* _I915_TRACE_H_ */
994
995/* This part must be outside protection */
996#undef TRACE_INCLUDE_PATH
Thierry Reding4e6d7712017-09-01 16:49:52 +0200997#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
Chris Wilson1c5d22f2009-08-25 11:15:50 +0100998#include <trace/define_trace.h>