1 #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 2 #define _I915_TRACE_H_ 3 4 #include <linux/stringify.h> 5 #include <linux/types.h> 6 #include <linux/tracepoint.h> 7 8 #include <drm/drmP.h> 9 #include "i915_drv.h" 10 #include "intel_drv.h" 11 #include "intel_ringbuffer.h" 12 13 #undef TRACE_SYSTEM 14 #define TRACE_SYSTEM i915 15 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) 16 #define TRACE_INCLUDE_FILE i915_trace 17 18 /* pipe updates */ 19 20 TRACE_EVENT(i915_pipe_update_start, 21 TP_PROTO(struct intel_crtc *crtc, u32 min, u32 max), 22 TP_ARGS(crtc, min, max), 23 24 TP_STRUCT__entry( 25 __field(enum pipe, pipe) 26 __field(u32, frame) 27 __field(u32, scanline) 28 __field(u32, min) 29 __field(u32, max) 30 ), 31 32 TP_fast_assign( 33 __entry->pipe = crtc->pipe; 34 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, 35 crtc->pipe); 36 __entry->scanline = intel_get_crtc_scanline(crtc); 37 __entry->min = min; 38 __entry->max = max; 39 ), 40 41 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 42 pipe_name(__entry->pipe), __entry->frame, 43 __entry->scanline, __entry->min, __entry->max) 44 ); 45 46 TRACE_EVENT(i915_pipe_update_vblank_evaded, 47 TP_PROTO(struct intel_crtc *crtc, u32 min, u32 max, u32 frame), 48 TP_ARGS(crtc, min, max, frame), 49 50 TP_STRUCT__entry( 51 __field(enum pipe, pipe) 52 __field(u32, frame) 53 __field(u32, scanline) 54 __field(u32, min) 55 __field(u32, max) 56 ), 57 58 TP_fast_assign( 59 __entry->pipe = crtc->pipe; 60 __entry->frame = frame; 61 __entry->scanline = intel_get_crtc_scanline(crtc); 62 __entry->min = min; 63 __entry->max = max; 64 ), 65 66 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 67 pipe_name(__entry->pipe), __entry->frame, 68 __entry->scanline, __entry->min, __entry->max) 69 ); 70 71 TRACE_EVENT(i915_pipe_update_end, 72 TP_PROTO(struct intel_crtc *crtc, u32 frame), 73 TP_ARGS(crtc, frame), 74 75 TP_STRUCT__entry( 76 __field(enum pipe, pipe) 77 __field(u32, frame) 78 __field(u32, scanline) 79 ), 80 81 TP_fast_assign( 82 __entry->pipe = crtc->pipe; 83 __entry->frame = frame; 84 __entry->scanline = intel_get_crtc_scanline(crtc); 85 ), 86 87 TP_printk("pipe %c, frame=%u, scanline=%u", 88 pipe_name(__entry->pipe), __entry->frame, 89 __entry->scanline) 90 ); 91 92 /* object tracking */ 93 94 TRACE_EVENT(i915_gem_object_create, 95 TP_PROTO(struct drm_i915_gem_object *obj), 96 TP_ARGS(obj), 97 98 TP_STRUCT__entry( 99 __field(struct drm_i915_gem_object *, obj) 100 __field(u32, size) 101 ), 102 103 TP_fast_assign( 104 __entry->obj = obj; 105 __entry->size = obj->base.size; 106 ), 107 108 TP_printk("obj=%p, size=%u", __entry->obj, __entry->size) 109 ); 110 111 TRACE_EVENT(i915_vma_bind, 112 TP_PROTO(struct i915_vma *vma, unsigned flags), 113 TP_ARGS(vma, flags), 114 115 TP_STRUCT__entry( 116 __field(struct drm_i915_gem_object *, obj) 117 __field(struct i915_address_space *, vm) 118 __field(u32, offset) 119 __field(u32, size) 120 __field(unsigned, flags) 121 ), 122 123 TP_fast_assign( 124 __entry->obj = vma->obj; 125 __entry->vm = vma->vm; 126 __entry->offset = vma->node.start; 127 __entry->size = vma->node.size; 128 __entry->flags = flags; 129 ), 130 131 TP_printk("obj=%p, offset=%08x size=%x%s vm=%p", 132 __entry->obj, __entry->offset, __entry->size, 133 __entry->flags & PIN_MAPPABLE ? ", mappable" : "", 134 __entry->vm) 135 ); 136 137 TRACE_EVENT(i915_vma_unbind, 138 TP_PROTO(struct i915_vma *vma), 139 TP_ARGS(vma), 140 141 TP_STRUCT__entry( 142 __field(struct drm_i915_gem_object *, obj) 143 __field(struct i915_address_space *, vm) 144 __field(u32, offset) 145 __field(u32, size) 146 ), 147 148 TP_fast_assign( 149 __entry->obj = vma->obj; 150 __entry->vm = vma->vm; 151 __entry->offset = vma->node.start; 152 __entry->size = vma->node.size; 153 ), 154 155 TP_printk("obj=%p, offset=%08x size=%x vm=%p", 156 __entry->obj, __entry->offset, __entry->size, __entry->vm) 157 ); 158 159 TRACE_EVENT(i915_gem_object_change_domain, 160 TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write), 161 TP_ARGS(obj, old_read, old_write), 162 163 TP_STRUCT__entry( 164 __field(struct drm_i915_gem_object *, obj) 165 __field(u32, read_domains) 166 __field(u32, write_domain) 167 ), 168 169 TP_fast_assign( 170 __entry->obj = obj; 171 __entry->read_domains = obj->base.read_domains | (old_read << 16); 172 __entry->write_domain = obj->base.write_domain | (old_write << 16); 173 ), 174 175 TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x", 176 __entry->obj, 177 __entry->read_domains >> 16, 178 __entry->read_domains & 0xffff, 179 __entry->write_domain >> 16, 180 __entry->write_domain & 0xffff) 181 ); 182 183 TRACE_EVENT(i915_gem_object_pwrite, 184 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 185 TP_ARGS(obj, offset, len), 186 187 TP_STRUCT__entry( 188 __field(struct drm_i915_gem_object *, obj) 189 __field(u32, offset) 190 __field(u32, len) 191 ), 192 193 TP_fast_assign( 194 __entry->obj = obj; 195 __entry->offset = offset; 196 __entry->len = len; 197 ), 198 199 TP_printk("obj=%p, offset=%u, len=%u", 200 __entry->obj, __entry->offset, __entry->len) 201 ); 202 203 TRACE_EVENT(i915_gem_object_pread, 204 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 205 TP_ARGS(obj, offset, len), 206 207 TP_STRUCT__entry( 208 __field(struct drm_i915_gem_object *, obj) 209 __field(u32, offset) 210 __field(u32, len) 211 ), 212 213 TP_fast_assign( 214 __entry->obj = obj; 215 __entry->offset = offset; 216 __entry->len = len; 217 ), 218 219 TP_printk("obj=%p, offset=%u, len=%u", 220 __entry->obj, __entry->offset, __entry->len) 221 ); 222 223 TRACE_EVENT(i915_gem_object_fault, 224 TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write), 225 TP_ARGS(obj, index, gtt, write), 226 227 TP_STRUCT__entry( 228 __field(struct drm_i915_gem_object *, obj) 229 __field(u32, index) 230 __field(bool, gtt) 231 __field(bool, write) 232 ), 233 234 TP_fast_assign( 235 __entry->obj = obj; 236 __entry->index = index; 237 __entry->gtt = gtt; 238 __entry->write = write; 239 ), 240 241 TP_printk("obj=%p, %s index=%u %s", 242 __entry->obj, 243 __entry->gtt ? "GTT" : "CPU", 244 __entry->index, 245 __entry->write ? ", writable" : "") 246 ); 247 248 DECLARE_EVENT_CLASS(i915_gem_object, 249 TP_PROTO(struct drm_i915_gem_object *obj), 250 TP_ARGS(obj), 251 252 TP_STRUCT__entry( 253 __field(struct drm_i915_gem_object *, obj) 254 ), 255 256 TP_fast_assign( 257 __entry->obj = obj; 258 ), 259 260 TP_printk("obj=%p", __entry->obj) 261 ); 262 263 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, 264 TP_PROTO(struct drm_i915_gem_object *obj), 265 TP_ARGS(obj) 266 ); 267 268 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, 269 TP_PROTO(struct drm_i915_gem_object *obj), 270 TP_ARGS(obj) 271 ); 272 273 TRACE_EVENT(i915_gem_evict, 274 TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags), 275 TP_ARGS(dev, size, align, flags), 276 277 TP_STRUCT__entry( 278 __field(u32, dev) 279 __field(u32, size) 280 __field(u32, align) 281 __field(unsigned, flags) 282 ), 283 284 TP_fast_assign( 285 __entry->dev = dev->primary->index; 286 __entry->size = size; 287 __entry->align = align; 288 __entry->flags = flags; 289 ), 290 291 TP_printk("dev=%d, size=%d, align=%d %s", 292 __entry->dev, __entry->size, __entry->align, 293 __entry->flags & PIN_MAPPABLE ? ", mappable" : "") 294 ); 295 296 TRACE_EVENT(i915_gem_evict_everything, 297 TP_PROTO(struct drm_device *dev), 298 TP_ARGS(dev), 299 300 TP_STRUCT__entry( 301 __field(u32, dev) 302 ), 303 304 TP_fast_assign( 305 __entry->dev = dev->primary->index; 306 ), 307 308 TP_printk("dev=%d", __entry->dev) 309 ); 310 311 TRACE_EVENT(i915_gem_evict_vm, 312 TP_PROTO(struct i915_address_space *vm), 313 TP_ARGS(vm), 314 315 TP_STRUCT__entry( 316 __field(u32, dev) 317 __field(struct i915_address_space *, vm) 318 ), 319 320 TP_fast_assign( 321 __entry->dev = vm->dev->primary->index; 322 __entry->vm = vm; 323 ), 324 325 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm) 326 ); 327 328 TRACE_EVENT(i915_gem_ring_sync_to, 329 TP_PROTO(struct intel_engine_cs *from, 330 struct intel_engine_cs *to, 331 u32 seqno), 332 TP_ARGS(from, to, seqno), 333 334 TP_STRUCT__entry( 335 __field(u32, dev) 336 __field(u32, sync_from) 337 __field(u32, sync_to) 338 __field(u32, seqno) 339 ), 340 341 TP_fast_assign( 342 __entry->dev = from->dev->primary->index; 343 __entry->sync_from = from->id; 344 __entry->sync_to = to->id; 345 __entry->seqno = seqno; 346 ), 347 348 TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u", 349 __entry->dev, 350 __entry->sync_from, __entry->sync_to, 351 __entry->seqno) 352 ); 353 354 TRACE_EVENT(i915_gem_ring_dispatch, 355 TP_PROTO(struct intel_engine_cs *ring, u32 seqno, u32 flags), 356 TP_ARGS(ring, seqno, flags), 357 358 TP_STRUCT__entry( 359 __field(u32, dev) 360 __field(u32, ring) 361 __field(u32, seqno) 362 __field(u32, flags) 363 ), 364 365 TP_fast_assign( 366 __entry->dev = ring->dev->primary->index; 367 __entry->ring = ring->id; 368 __entry->seqno = seqno; 369 __entry->flags = flags; 370 i915_trace_irq_get(ring, seqno); 371 ), 372 373 TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x", 374 __entry->dev, __entry->ring, __entry->seqno, __entry->flags) 375 ); 376 377 TRACE_EVENT(i915_gem_ring_flush, 378 TP_PROTO(struct intel_engine_cs *ring, u32 invalidate, u32 flush), 379 TP_ARGS(ring, invalidate, flush), 380 381 TP_STRUCT__entry( 382 __field(u32, dev) 383 __field(u32, ring) 384 __field(u32, invalidate) 385 __field(u32, flush) 386 ), 387 388 TP_fast_assign( 389 __entry->dev = ring->dev->primary->index; 390 __entry->ring = ring->id; 391 __entry->invalidate = invalidate; 392 __entry->flush = flush; 393 ), 394 395 TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x", 396 __entry->dev, __entry->ring, 397 __entry->invalidate, __entry->flush) 398 ); 399 400 DECLARE_EVENT_CLASS(i915_gem_request, 401 TP_PROTO(struct intel_engine_cs *ring, u32 seqno), 402 TP_ARGS(ring, seqno), 403 404 TP_STRUCT__entry( 405 __field(u32, dev) 406 __field(u32, ring) 407 __field(u32, seqno) 408 ), 409 410 TP_fast_assign( 411 __entry->dev = ring->dev->primary->index; 412 __entry->ring = ring->id; 413 __entry->seqno = seqno; 414 ), 415 416 TP_printk("dev=%u, ring=%u, seqno=%u", 417 __entry->dev, __entry->ring, __entry->seqno) 418 ); 419 420 DEFINE_EVENT(i915_gem_request, i915_gem_request_add, 421 TP_PROTO(struct intel_engine_cs *ring, u32 seqno), 422 TP_ARGS(ring, seqno) 423 ); 424 425 TRACE_EVENT(i915_gem_request_complete, 426 TP_PROTO(struct intel_engine_cs *ring), 427 TP_ARGS(ring), 428 429 TP_STRUCT__entry( 430 __field(u32, dev) 431 __field(u32, ring) 432 __field(u32, seqno) 433 ), 434 435 TP_fast_assign( 436 __entry->dev = ring->dev->primary->index; 437 __entry->ring = ring->id; 438 __entry->seqno = ring->get_seqno(ring, false); 439 ), 440 441 TP_printk("dev=%u, ring=%u, seqno=%u", 442 __entry->dev, __entry->ring, __entry->seqno) 443 ); 444 445 DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, 446 TP_PROTO(struct intel_engine_cs *ring, u32 seqno), 447 TP_ARGS(ring, seqno) 448 ); 449 450 TRACE_EVENT(i915_gem_request_wait_begin, 451 TP_PROTO(struct intel_engine_cs *ring, u32 seqno), 452 TP_ARGS(ring, seqno), 453 454 TP_STRUCT__entry( 455 __field(u32, dev) 456 __field(u32, ring) 457 __field(u32, seqno) 458 __field(bool, blocking) 459 ), 460 461 /* NB: the blocking information is racy since mutex_is_locked 462 * doesn't check that the current thread holds the lock. The only 463 * other option would be to pass the boolean information of whether 464 * or not the class was blocking down through the stack which is 465 * less desirable. 466 */ 467 TP_fast_assign( 468 __entry->dev = ring->dev->primary->index; 469 __entry->ring = ring->id; 470 __entry->seqno = seqno; 471 __entry->blocking = mutex_is_locked(&ring->dev->struct_mutex); 472 ), 473 474 TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s", 475 __entry->dev, __entry->ring, __entry->seqno, 476 __entry->blocking ? "yes (NB)" : "no") 477 ); 478 479 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, 480 TP_PROTO(struct intel_engine_cs *ring, u32 seqno), 481 TP_ARGS(ring, seqno) 482 ); 483 484 DECLARE_EVENT_CLASS(i915_ring, 485 TP_PROTO(struct intel_engine_cs *ring), 486 TP_ARGS(ring), 487 488 TP_STRUCT__entry( 489 __field(u32, dev) 490 __field(u32, ring) 491 ), 492 493 TP_fast_assign( 494 __entry->dev = ring->dev->primary->index; 495 __entry->ring = ring->id; 496 ), 497 498 TP_printk("dev=%u, ring=%u", __entry->dev, __entry->ring) 499 ); 500 501 DEFINE_EVENT(i915_ring, i915_ring_wait_begin, 502 TP_PROTO(struct intel_engine_cs *ring), 503 TP_ARGS(ring) 504 ); 505 506 DEFINE_EVENT(i915_ring, i915_ring_wait_end, 507 TP_PROTO(struct intel_engine_cs *ring), 508 TP_ARGS(ring) 509 ); 510 511 TRACE_EVENT(i915_flip_request, 512 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 513 514 TP_ARGS(plane, obj), 515 516 TP_STRUCT__entry( 517 __field(int, plane) 518 __field(struct drm_i915_gem_object *, obj) 519 ), 520 521 TP_fast_assign( 522 __entry->plane = plane; 523 __entry->obj = obj; 524 ), 525 526 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 527 ); 528 529 TRACE_EVENT(i915_flip_complete, 530 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 531 532 TP_ARGS(plane, obj), 533 534 TP_STRUCT__entry( 535 __field(int, plane) 536 __field(struct drm_i915_gem_object *, obj) 537 ), 538 539 TP_fast_assign( 540 __entry->plane = plane; 541 __entry->obj = obj; 542 ), 543 544 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 545 ); 546 547 TRACE_EVENT_CONDITION(i915_reg_rw, 548 TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace), 549 550 TP_ARGS(write, reg, val, len, trace), 551 552 TP_CONDITION(trace), 553 554 TP_STRUCT__entry( 555 __field(u64, val) 556 __field(u32, reg) 557 __field(u16, write) 558 __field(u16, len) 559 ), 560 561 TP_fast_assign( 562 __entry->val = (u64)val; 563 __entry->reg = reg; 564 __entry->write = write; 565 __entry->len = len; 566 ), 567 568 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)", 569 __entry->write ? "write" : "read", 570 __entry->reg, __entry->len, 571 (u32)(__entry->val & 0xffffffff), 572 (u32)(__entry->val >> 32)) 573 ); 574 575 TRACE_EVENT(intel_gpu_freq_change, 576 TP_PROTO(u32 freq), 577 TP_ARGS(freq), 578 579 TP_STRUCT__entry( 580 __field(u32, freq) 581 ), 582 583 TP_fast_assign( 584 __entry->freq = freq; 585 ), 586 587 TP_printk("new_freq=%u", __entry->freq) 588 ); 589 590 #endif /* _I915_TRACE_H_ */ 591 592 /* This part must be outside protection */ 593 #undef TRACE_INCLUDE_PATH 594 #define TRACE_INCLUDE_PATH . 595 #include <trace/define_trace.h> 596