i915_trace.h 10.3 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 217 218
TRACE_EVENT(i915_gem_evict_everything,
	    TP_PROTO(struct drm_device *dev, bool purgeable),
	    TP_ARGS(dev, purgeable),
C
Chris Wilson 已提交
219

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

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

C
Chris Wilson 已提交
230 231 232 233
	    TP_printk("dev=%d%s",
		      __entry->dev,
		      __entry->purgeable ? ", purgeable only" : "")
);
C
Chris Wilson 已提交
234

C
Chris Wilson 已提交
235 236 237
TRACE_EVENT(i915_gem_ring_dispatch,
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno),
C
Chris Wilson 已提交
238 239

	    TP_STRUCT__entry(
240
			     __field(u32, dev)
C
Chris Wilson 已提交
241
			     __field(u32, ring)
C
Chris Wilson 已提交
242 243 244 245
			     __field(u32, seqno)
			     ),

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

C
Chris Wilson 已提交
252 253
	    TP_printk("dev=%u, ring=%u, seqno=%u",
		      __entry->dev, __entry->ring, __entry->seqno)
C
Chris Wilson 已提交
254 255
);

C
Chris Wilson 已提交
256 257 258
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 已提交
259 260

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

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

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

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

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

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

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

C
Chris Wilson 已提交
299 300 301 302
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 已提交
303

C
Chris Wilson 已提交
304 305 306
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 已提交
307 308
);

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

314
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
C
Chris Wilson 已提交
315 316
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
317
);
C
Chris Wilson 已提交
318

319
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
C
Chris Wilson 已提交
320 321
	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
	    TP_ARGS(ring, seqno)
C
Chris Wilson 已提交
322 323
);

324
DECLARE_EVENT_CLASS(i915_ring,
C
Chris Wilson 已提交
325 326
	    TP_PROTO(struct intel_ring_buffer *ring),
	    TP_ARGS(ring),
C
Chris Wilson 已提交
327 328

	    TP_STRUCT__entry(
329
			     __field(u32, dev)
C
Chris Wilson 已提交
330
			     __field(u32, ring)
C
Chris Wilson 已提交
331 332 333
			     ),

	    TP_fast_assign(
C
Chris Wilson 已提交
334 335
			   __entry->dev = ring->dev->primary->index;
			   __entry->ring = ring->id;
C
Chris Wilson 已提交
336 337
			   ),

C
Chris Wilson 已提交
338
	    TP_printk("dev=%u, ring=%u", __entry->dev, __entry->ring)
C
Chris Wilson 已提交
339 340
);

341
DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
C
Chris Wilson 已提交
342 343
	    TP_PROTO(struct intel_ring_buffer *ring),
	    TP_ARGS(ring)
344
);
C
Chris Wilson 已提交
345

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

351
TRACE_EVENT(i915_flip_request,
352
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
353 354 355 356 357

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
358
		    __field(struct drm_i915_gem_object *, obj)
359 360 361 362 363 364 365 366 367 368 369
		    ),

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

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

TRACE_EVENT(i915_flip_complete,
370
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
371 372 373 374 375

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
376
		    __field(struct drm_i915_gem_object *, obj)
377 378 379 380 381 382 383 384 385 386
		    ),

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

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

387
TRACE_EVENT(i915_reg_rw,
C
Chris Wilson 已提交
388
           TP_PROTO(bool write, u32 reg, u64 val, int len),
389

C
Chris Wilson 已提交
390
           TP_ARGS(write, reg, val, len),
391 392

           TP_STRUCT__entry(
C
Chris Wilson 已提交
393 394 395 396
                   __field(u64, val)
                   __field(u32, reg)
                   __field(u16, write)
                   __field(u16, len)
397 398 399
                   ),

           TP_fast_assign(
C
Chris Wilson 已提交
400
                   __entry->val = (u64)val;
401
                   __entry->reg = reg;
C
Chris Wilson 已提交
402
                   __entry->write = write;
403 404 405
                   __entry->len = len;
                   ),

C
Chris Wilson 已提交
406 407 408 409 410
           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))
411 412
);

C
Chris Wilson 已提交
413 414 415 416
#endif /* _I915_TRACE_H_ */

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