i915_trace.h 11.0 KB
Newer Older
C
Chris Wilson 已提交
1 2 3 4 5 6 7 8
#if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _I915_TRACE_H_

#include <linux/stringify.h>
#include <linux/types.h>
#include <linux/tracepoint.h>

#include <drm/drmP.h>
9
#include "i915_drv.h"
C
Chris Wilson 已提交
10
#include "intel_ringbuffer.h"
C
Chris Wilson 已提交
11 12 13 14 15 16 17 18 19

#undef TRACE_SYSTEM
#define TRACE_SYSTEM i915
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE i915_trace

/* object tracking */

TRACE_EVENT(i915_gem_object_create,
20
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
21 22 23
	    TP_ARGS(obj),

	    TP_STRUCT__entry(
24
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
25 26 27 28 29
			     __field(u32, size)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
30
			   __entry->size = obj->base.size;
C
Chris Wilson 已提交
31 32 33 34 35 36
			   ),

	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
);

TRACE_EVENT(i915_gem_object_bind,
C
Chris Wilson 已提交
37 38
	    TP_PROTO(struct drm_i915_gem_object *obj, bool mappable),
	    TP_ARGS(obj, mappable),
C
Chris Wilson 已提交
39 40

	    TP_STRUCT__entry(
41
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
42 43
			     __field(u32, offset)
			     __field(u32, size)
44
			     __field(bool, mappable)
C
Chris Wilson 已提交
45 46 47 48
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
C
Chris Wilson 已提交
49 50
			   __entry->offset = obj->gtt_space->start;
			   __entry->size = obj->gtt_space->size;
51
			   __entry->mappable = mappable;
C
Chris Wilson 已提交
52 53
			   ),

C
Chris Wilson 已提交
54 55
	    TP_printk("obj=%p, offset=%08x size=%x%s",
		      __entry->obj, __entry->offset, __entry->size,
56
		      __entry->mappable ? ", mappable" : "")
C
Chris Wilson 已提交
57 58
);

C
Chris Wilson 已提交
59 60 61 62 63 64 65 66 67
TRACE_EVENT(i915_gem_object_unbind,
	    TP_PROTO(struct drm_i915_gem_object *obj),
	    TP_ARGS(obj),

	    TP_STRUCT__entry(
			     __field(struct drm_i915_gem_object *, obj)
			     __field(u32, offset)
			     __field(u32, size)
			     ),
C
Chris Wilson 已提交
68

C
Chris Wilson 已提交
69 70 71 72 73
	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->offset = obj->gtt_space->start;
			   __entry->size = obj->gtt_space->size;
			   ),
C
Chris Wilson 已提交
74

C
Chris Wilson 已提交
75 76 77 78 79 80 81
	    TP_printk("obj=%p, offset=%08x size=%x",
		      __entry->obj, __entry->offset, __entry->size)
);

TRACE_EVENT(i915_gem_object_change_domain,
	    TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write),
	    TP_ARGS(obj, old_read, old_write),
C
Chris Wilson 已提交
82 83

	    TP_STRUCT__entry(
84
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
85 86 87 88 89 90
			     __field(u32, read_domains)
			     __field(u32, write_domain)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
C
Chris Wilson 已提交
91 92
			   __entry->read_domains = obj->base.read_domains | (old_read << 16);
			   __entry->write_domain = obj->base.write_domain | (old_write << 16);
C
Chris Wilson 已提交
93 94
			   ),

C
Chris Wilson 已提交
95
	    TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
C
Chris Wilson 已提交
96
		      __entry->obj,
C
Chris Wilson 已提交
97 98 99 100
		      __entry->read_domains >> 16,
		      __entry->read_domains & 0xffff,
		      __entry->write_domain >> 16,
		      __entry->write_domain & 0xffff)
C
Chris Wilson 已提交
101 102
);

C
Chris Wilson 已提交
103 104 105
TRACE_EVENT(i915_gem_object_pwrite,
	    TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
	    TP_ARGS(obj, offset, len),
C
Chris Wilson 已提交
106

C
Chris Wilson 已提交
107 108 109 110 111
	    TP_STRUCT__entry(
			     __field(struct drm_i915_gem_object *, obj)
			     __field(u32, offset)
			     __field(u32, len)
			     ),
C
Chris Wilson 已提交
112

C
Chris Wilson 已提交
113 114 115 116 117 118 119 120 121 122 123 124 125
	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->offset = offset;
			   __entry->len = len;
			   ),

	    TP_printk("obj=%p, offset=%u, len=%u",
		      __entry->obj, __entry->offset, __entry->len)
);

TRACE_EVENT(i915_gem_object_pread,
	    TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
	    TP_ARGS(obj, offset, len),
C
Chris Wilson 已提交
126 127

	    TP_STRUCT__entry(
128
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
129 130
			     __field(u32, offset)
			     __field(u32, len)
C
Chris Wilson 已提交
131 132 133 134
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
C
Chris Wilson 已提交
135 136
			   __entry->offset = offset;
			   __entry->len = len;
C
Chris Wilson 已提交
137 138
			   ),

C
Chris Wilson 已提交
139 140
	    TP_printk("obj=%p, offset=%u, len=%u",
		      __entry->obj, __entry->offset, __entry->len)
C
Chris Wilson 已提交
141 142
);

C
Chris Wilson 已提交
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
TRACE_EVENT(i915_gem_object_fault,
	    TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write),
	    TP_ARGS(obj, index, gtt, write),

	    TP_STRUCT__entry(
			     __field(struct drm_i915_gem_object *, obj)
			     __field(u32, index)
			     __field(bool, gtt)
			     __field(bool, write)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->index = index;
			   __entry->gtt = gtt;
			   __entry->write = write;
			   ),
160

C
Chris Wilson 已提交
161 162 163 164 165 166 167 168
	    TP_printk("obj=%p, %s index=%u %s",
		      __entry->obj,
		      __entry->gtt ? "GTT" : "CPU",
		      __entry->index,
		      __entry->write ? ", writable" : "")
);

DECLARE_EVENT_CLASS(i915_gem_object,
169
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
170
	    TP_ARGS(obj),
171

C
Chris Wilson 已提交
172 173 174 175 176 177 178 179 180
	    TP_STRUCT__entry(
			     __field(struct drm_i915_gem_object *, obj)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   ),

	    TP_printk("obj=%p", __entry->obj)
181 182
);

C
Chris Wilson 已提交
183 184 185 186
DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
	     TP_PROTO(struct drm_i915_gem_object *obj),
	     TP_ARGS(obj)
);
C
Chris Wilson 已提交
187

C
Chris Wilson 已提交
188
DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
189
	    TP_PROTO(struct drm_i915_gem_object *obj),
190 191
	    TP_ARGS(obj)
);
C
Chris Wilson 已提交
192

C
Chris Wilson 已提交
193 194 195
TRACE_EVENT(i915_gem_evict,
	    TP_PROTO(struct drm_device *dev, u32 size, u32 align, bool mappable),
	    TP_ARGS(dev, size, align, mappable),
C
Chris Wilson 已提交
196

C
Chris Wilson 已提交
197 198 199 200 201 202
	    TP_STRUCT__entry(
			     __field(u32, dev)
			     __field(u32, size)
			     __field(u32, align)
			     __field(bool, mappable)
			    ),
C
Chris Wilson 已提交
203

C
Chris Wilson 已提交
204 205 206 207 208 209 210 211 212 213
	    TP_fast_assign(
			   __entry->dev = dev->primary->index;
			   __entry->size = size;
			   __entry->align = align;
			   __entry->mappable = mappable;
			  ),

	    TP_printk("dev=%d, size=%d, align=%d %s",
		      __entry->dev, __entry->size, __entry->align,
		      __entry->mappable ? ", mappable" : "")
C
Chris Wilson 已提交
214 215
);

C
Chris Wilson 已提交
216
TRACE_EVENT(i915_gem_evict_everything,
C
Chris Wilson 已提交
217 218
	    TP_PROTO(struct drm_device *dev),
	    TP_ARGS(dev),
C
Chris Wilson 已提交
219

C
Chris Wilson 已提交
220 221 222 223 224 225 226
	    TP_STRUCT__entry(
			     __field(u32, dev)
			    ),

	    TP_fast_assign(
			   __entry->dev = dev->primary->index;
			  ),
C
Chris Wilson 已提交
227

C
Chris Wilson 已提交
228
	    TP_printk("dev=%d", __entry->dev)
C
Chris Wilson 已提交
229
);
C
Chris Wilson 已提交
230

C
Chris Wilson 已提交
231
TRACE_EVENT(i915_gem_ring_dispatch,
232 233
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno, u32 flags),
	    TP_ARGS(ring, seqno, flags),
C
Chris Wilson 已提交
234 235

	    TP_STRUCT__entry(
236
			     __field(u32, dev)
C
Chris Wilson 已提交
237
			     __field(u32, ring)
C
Chris Wilson 已提交
238
			     __field(u32, seqno)
239
			     __field(u32, flags)
C
Chris Wilson 已提交
240 241 242
			     ),

	    TP_fast_assign(
C
Chris Wilson 已提交
243 244
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
C
Chris Wilson 已提交
245
			   __entry->seqno = seqno;
246
			   __entry->flags = flags;
C
Chris Wilson 已提交
247
			   i915_trace_irq_get(ring, seqno);
C
Chris Wilson 已提交
248 249
			   ),

250 251
	    TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
		      __entry->dev, __entry->ring, __entry->seqno, __entry->flags)
C
Chris Wilson 已提交
252 253
);

C
Chris Wilson 已提交
254 255 256
TRACE_EVENT(i915_gem_ring_flush,
	    TP_PROTO(struct intel_ring_buffer *ring, u32 invalidate, u32 flush),
	    TP_ARGS(ring, invalidate, flush),
C
Chris Wilson 已提交
257 258

	    TP_STRUCT__entry(
259
			     __field(u32, dev)
C
Chris Wilson 已提交
260 261 262
			     __field(u32, ring)
			     __field(u32, invalidate)
			     __field(u32, flush)
C
Chris Wilson 已提交
263 264 265
			     ),

	    TP_fast_assign(
C
Chris Wilson 已提交
266 267 268 269
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
			   __entry->invalidate = invalidate;
			   __entry->flush = flush;
C
Chris Wilson 已提交
270 271
			   ),

C
Chris Wilson 已提交
272 273 274
	    TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
		      __entry->dev, __entry->ring,
		      __entry->invalidate, __entry->flush)
C
Chris Wilson 已提交
275 276
);

277
DECLARE_EVENT_CLASS(i915_gem_request,
C
Chris Wilson 已提交
278 279
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno),
C
Chris Wilson 已提交
280 281

	    TP_STRUCT__entry(
282
			     __field(u32, dev)
C
Chris Wilson 已提交
283
			     __field(u32, ring)
C
Chris Wilson 已提交
284 285 286 287
			     __field(u32, seqno)
			     ),

	    TP_fast_assign(
C
Chris Wilson 已提交
288 289
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
C
Chris Wilson 已提交
290 291 292
			   __entry->seqno = seqno;
			   ),

C
Chris Wilson 已提交
293 294
	    TP_printk("dev=%u, ring=%u, seqno=%u",
		      __entry->dev, __entry->ring, __entry->seqno)
C
Chris Wilson 已提交
295 296
);

C
Chris Wilson 已提交
297 298 299 300
DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
);
C
Chris Wilson 已提交
301

C
Chris Wilson 已提交
302 303 304
DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
C
Chris Wilson 已提交
305 306
);

307
DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
C
Chris Wilson 已提交
308 309
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
C
Chris Wilson 已提交
310 311
);

312
TRACE_EVENT(i915_gem_request_wait_begin,
C
Chris Wilson 已提交
313
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
	    TP_ARGS(ring, seqno),

	    TP_STRUCT__entry(
			     __field(u32, dev)
			     __field(u32, ring)
			     __field(u32, seqno)
			     __field(bool, blocking)
			     ),

	    /* NB: the blocking information is racy since mutex_is_locked
	     * doesn't check that the current thread holds the lock. The only
	     * other option would be to pass the boolean information of whether
	     * or not the class was blocking down through the stack which is
	     * less desirable.
	     */
	    TP_fast_assign(
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
			   __entry->seqno = seqno;
			   __entry->blocking = mutex_is_locked(&ring->dev->struct_mutex);
			   ),

	    TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
		      __entry->dev, __entry->ring, __entry->seqno,
		      __entry->blocking ?  "yes (NB)" : "no")
339
);
C
Chris Wilson 已提交
340

341
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
C
Chris Wilson 已提交
342 343
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
C
Chris Wilson 已提交
344 345
);

346
DECLARE_EVENT_CLASS(i915_ring,
C
Chris Wilson 已提交
347 348
	    TP_PROTO(struct intel_ring_buffer *ring),
	    TP_ARGS(ring),
C
Chris Wilson 已提交
349 350

	    TP_STRUCT__entry(
351
			     __field(u32, dev)
C
Chris Wilson 已提交
352
			     __field(u32, ring)
C
Chris Wilson 已提交
353 354 355
			     ),

	    TP_fast_assign(
C
Chris Wilson 已提交
356 357
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
C
Chris Wilson 已提交
358 359
			   ),

C
Chris Wilson 已提交
360
	    TP_printk("dev=%u, ring=%u", __entry->dev, __entry->ring)
C
Chris Wilson 已提交
361 362
);

363
DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
C
Chris Wilson 已提交
364 365
	    TP_PROTO(struct intel_ring_buffer *ring),
	    TP_ARGS(ring)
366
);
C
Chris Wilson 已提交
367

368
DEFINE_EVENT(i915_ring, i915_ring_wait_end,
C
Chris Wilson 已提交
369 370
	    TP_PROTO(struct intel_ring_buffer *ring),
	    TP_ARGS(ring)
C
Chris Wilson 已提交
371 372
);

373
TRACE_EVENT(i915_flip_request,
374
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
375 376 377 378 379

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
380
		    __field(struct drm_i915_gem_object *, obj)
381 382 383 384 385 386 387 388 389 390 391
		    ),

	    TP_fast_assign(
		    __entry->plane = plane;
		    __entry->obj = obj;
		    ),

	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
);

TRACE_EVENT(i915_flip_complete,
392
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
393 394 395 396 397

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
398
		    __field(struct drm_i915_gem_object *, obj)
399 400 401 402 403 404 405 406 407 408
		    ),

	    TP_fast_assign(
		    __entry->plane = plane;
		    __entry->obj = obj;
		    ),

	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
);

409
TRACE_EVENT(i915_reg_rw,
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
	TP_PROTO(bool write, u32 reg, u64 val, int len),

	TP_ARGS(write, reg, val, len),

	TP_STRUCT__entry(
		__field(u64, val)
		__field(u32, reg)
		__field(u16, write)
		__field(u16, len)
		),

	TP_fast_assign(
		__entry->val = (u64)val;
		__entry->reg = reg;
		__entry->write = write;
		__entry->len = len;
		),

	TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
		__entry->write ? "write" : "read",
		__entry->reg, __entry->len,
		(u32)(__entry->val & 0xffffffff),
		(u32)(__entry->val >> 32))
433 434
);

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
TRACE_EVENT(intel_gpu_freq_change,
	    TP_PROTO(u32 freq),
	    TP_ARGS(freq),

	    TP_STRUCT__entry(
			     __field(u32, freq)
			     ),

	    TP_fast_assign(
			   __entry->freq = freq;
			   ),

	    TP_printk("new_freq=%u", __entry->freq)
);

C
Chris Wilson 已提交
450 451 452 453
#endif /* _I915_TRACE_H_ */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
P
Peter Clifton 已提交
454
#define TRACE_INCLUDE_PATH .
C
Chris Wilson 已提交
455
#include <trace/define_trace.h>