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