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 "display/intel_crtc.h" 12 #include "display/intel_display_types.h" 13 #include "gt/intel_engine.h" 14 15 #include "i915_drv.h" 16 #include "i915_irq.h" 17 18 #undef TRACE_SYSTEM 19 #define TRACE_SYSTEM i915 20 #define TRACE_INCLUDE_FILE i915_trace 21 22 /* watermark/fifo updates */ 23 24 TRACE_EVENT(intel_pipe_enable, 25 TP_PROTO(struct intel_crtc *crtc), 26 TP_ARGS(crtc), 27 28 TP_STRUCT__entry( 29 __array(u32, frame, 3) 30 __array(u32, scanline, 3) 31 __field(enum pipe, pipe) 32 ), 33 TP_fast_assign( 34 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 35 struct intel_crtc *it__; 36 for_each_intel_crtc(&dev_priv->drm, it__) { 37 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); 38 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); 39 } 40 __entry->pipe = crtc->pipe; 41 ), 42 43 TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 44 pipe_name(__entry->pipe), 45 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 46 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 47 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 48 ); 49 50 TRACE_EVENT(intel_pipe_disable, 51 TP_PROTO(struct intel_crtc *crtc), 52 TP_ARGS(crtc), 53 54 TP_STRUCT__entry( 55 __array(u32, frame, 3) 56 __array(u32, scanline, 3) 57 __field(enum pipe, pipe) 58 ), 59 60 TP_fast_assign( 61 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 62 struct intel_crtc *it__; 63 for_each_intel_crtc(&dev_priv->drm, it__) { 64 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); 65 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); 66 } 67 __entry->pipe = crtc->pipe; 68 ), 69 70 TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 71 pipe_name(__entry->pipe), 72 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 73 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 74 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 75 ); 76 77 TRACE_EVENT(intel_pipe_crc, 78 TP_PROTO(struct intel_crtc *crtc, const u32 *crcs), 79 TP_ARGS(crtc, crcs), 80 81 TP_STRUCT__entry( 82 __field(enum pipe, pipe) 83 __field(u32, frame) 84 __field(u32, scanline) 85 __array(u32, crcs, 5) 86 ), 87 88 TP_fast_assign( 89 __entry->pipe = crtc->pipe; 90 __entry->frame = intel_crtc_get_vblank_counter(crtc); 91 __entry->scanline = intel_get_crtc_scanline(crtc); 92 memcpy(__entry->crcs, crcs, sizeof(__entry->crcs)); 93 ), 94 95 TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x", 96 pipe_name(__entry->pipe), __entry->frame, __entry->scanline, 97 __entry->crcs[0], __entry->crcs[1], __entry->crcs[2], 98 __entry->crcs[3], __entry->crcs[4]) 99 ); 100 101 TRACE_EVENT(intel_cpu_fifo_underrun, 102 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), 103 TP_ARGS(dev_priv, pipe), 104 105 TP_STRUCT__entry( 106 __field(enum pipe, pipe) 107 __field(u32, frame) 108 __field(u32, scanline) 109 ), 110 111 TP_fast_assign( 112 struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); 113 __entry->pipe = pipe; 114 __entry->frame = intel_crtc_get_vblank_counter(crtc); 115 __entry->scanline = intel_get_crtc_scanline(crtc); 116 ), 117 118 TP_printk("pipe %c, frame=%u, scanline=%u", 119 pipe_name(__entry->pipe), 120 __entry->frame, __entry->scanline) 121 ); 122 123 TRACE_EVENT(intel_pch_fifo_underrun, 124 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder), 125 TP_ARGS(dev_priv, pch_transcoder), 126 127 TP_STRUCT__entry( 128 __field(enum pipe, pipe) 129 __field(u32, frame) 130 __field(u32, scanline) 131 ), 132 133 TP_fast_assign( 134 enum pipe pipe = pch_transcoder; 135 struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); 136 __entry->pipe = pipe; 137 __entry->frame = intel_crtc_get_vblank_counter(crtc); 138 __entry->scanline = intel_get_crtc_scanline(crtc); 139 ), 140 141 TP_printk("pch transcoder %c, frame=%u, scanline=%u", 142 pipe_name(__entry->pipe), 143 __entry->frame, __entry->scanline) 144 ); 145 146 TRACE_EVENT(intel_memory_cxsr, 147 TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new), 148 TP_ARGS(dev_priv, old, new), 149 150 TP_STRUCT__entry( 151 __array(u32, frame, 3) 152 __array(u32, scanline, 3) 153 __field(bool, old) 154 __field(bool, new) 155 ), 156 157 TP_fast_assign( 158 struct intel_crtc *crtc; 159 for_each_intel_crtc(&dev_priv->drm, crtc) { 160 __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc); 161 __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc); 162 } 163 __entry->old = old; 164 __entry->new = new; 165 ), 166 167 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 168 onoff(__entry->old), onoff(__entry->new), 169 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 170 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 171 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 172 ); 173 174 TRACE_EVENT(g4x_wm, 175 TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm), 176 TP_ARGS(crtc, wm), 177 178 TP_STRUCT__entry( 179 __field(enum pipe, pipe) 180 __field(u32, frame) 181 __field(u32, scanline) 182 __field(u16, primary) 183 __field(u16, sprite) 184 __field(u16, cursor) 185 __field(u16, sr_plane) 186 __field(u16, sr_cursor) 187 __field(u16, sr_fbc) 188 __field(u16, hpll_plane) 189 __field(u16, hpll_cursor) 190 __field(u16, hpll_fbc) 191 __field(bool, cxsr) 192 __field(bool, hpll) 193 __field(bool, fbc) 194 ), 195 196 TP_fast_assign( 197 __entry->pipe = crtc->pipe; 198 __entry->frame = intel_crtc_get_vblank_counter(crtc); 199 __entry->scanline = intel_get_crtc_scanline(crtc); 200 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; 201 __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; 202 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR]; 203 __entry->sr_plane = wm->sr.plane; 204 __entry->sr_cursor = wm->sr.cursor; 205 __entry->sr_fbc = wm->sr.fbc; 206 __entry->hpll_plane = wm->hpll.plane; 207 __entry->hpll_cursor = wm->hpll.cursor; 208 __entry->hpll_fbc = wm->hpll.fbc; 209 __entry->cxsr = wm->cxsr; 210 __entry->hpll = wm->hpll_en; 211 __entry->fbc = wm->fbc_en; 212 ), 213 214 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s", 215 pipe_name(__entry->pipe), __entry->frame, __entry->scanline, 216 __entry->primary, __entry->sprite, __entry->cursor, 217 yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc, 218 yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc, 219 yesno(__entry->fbc)) 220 ); 221 222 TRACE_EVENT(vlv_wm, 223 TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm), 224 TP_ARGS(crtc, wm), 225 226 TP_STRUCT__entry( 227 __field(enum pipe, pipe) 228 __field(u32, frame) 229 __field(u32, scanline) 230 __field(u32, level) 231 __field(u32, cxsr) 232 __field(u32, primary) 233 __field(u32, sprite0) 234 __field(u32, sprite1) 235 __field(u32, cursor) 236 __field(u32, sr_plane) 237 __field(u32, sr_cursor) 238 ), 239 240 TP_fast_assign( 241 __entry->pipe = crtc->pipe; 242 __entry->frame = intel_crtc_get_vblank_counter(crtc); 243 __entry->scanline = intel_get_crtc_scanline(crtc); 244 __entry->level = wm->level; 245 __entry->cxsr = wm->cxsr; 246 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; 247 __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; 248 __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1]; 249 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR]; 250 __entry->sr_plane = wm->sr.plane; 251 __entry->sr_cursor = wm->sr.cursor; 252 ), 253 254 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d", 255 pipe_name(__entry->pipe), __entry->frame, 256 __entry->scanline, __entry->level, __entry->cxsr, 257 __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor, 258 __entry->sr_plane, __entry->sr_cursor) 259 ); 260 261 TRACE_EVENT(vlv_fifo_size, 262 TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size), 263 TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size), 264 265 TP_STRUCT__entry( 266 __field(enum pipe, pipe) 267 __field(u32, frame) 268 __field(u32, scanline) 269 __field(u32, sprite0_start) 270 __field(u32, sprite1_start) 271 __field(u32, fifo_size) 272 ), 273 274 TP_fast_assign( 275 __entry->pipe = crtc->pipe; 276 __entry->frame = intel_crtc_get_vblank_counter(crtc); 277 __entry->scanline = intel_get_crtc_scanline(crtc); 278 __entry->sprite0_start = sprite0_start; 279 __entry->sprite1_start = sprite1_start; 280 __entry->fifo_size = fifo_size; 281 ), 282 283 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d", 284 pipe_name(__entry->pipe), __entry->frame, 285 __entry->scanline, __entry->sprite0_start, 286 __entry->sprite1_start, __entry->fifo_size) 287 ); 288 289 /* plane updates */ 290 291 TRACE_EVENT(intel_update_plane, 292 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), 293 TP_ARGS(plane, crtc), 294 295 TP_STRUCT__entry( 296 __field(enum pipe, pipe) 297 __field(u32, frame) 298 __field(u32, scanline) 299 __array(int, src, 4) 300 __array(int, dst, 4) 301 __string(name, plane->name) 302 ), 303 304 TP_fast_assign( 305 __assign_str(name, plane->name); 306 __entry->pipe = crtc->pipe; 307 __entry->frame = intel_crtc_get_vblank_counter(crtc); 308 __entry->scanline = intel_get_crtc_scanline(crtc); 309 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src)); 310 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst)); 311 ), 312 313 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT, 314 pipe_name(__entry->pipe), __get_str(name), 315 __entry->frame, __entry->scanline, 316 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src), 317 DRM_RECT_ARG((const struct drm_rect *)__entry->dst)) 318 ); 319 320 TRACE_EVENT(intel_disable_plane, 321 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), 322 TP_ARGS(plane, crtc), 323 324 TP_STRUCT__entry( 325 __field(enum pipe, pipe) 326 __field(u32, frame) 327 __field(u32, scanline) 328 __string(name, plane->name) 329 ), 330 331 TP_fast_assign( 332 __assign_str(name, plane->name); 333 __entry->pipe = crtc->pipe; 334 __entry->frame = intel_crtc_get_vblank_counter(crtc); 335 __entry->scanline = intel_get_crtc_scanline(crtc); 336 ), 337 338 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u", 339 pipe_name(__entry->pipe), __get_str(name), 340 __entry->frame, __entry->scanline) 341 ); 342 343 /* fbc */ 344 345 TRACE_EVENT(intel_fbc_activate, 346 TP_PROTO(struct intel_crtc *crtc), 347 TP_ARGS(crtc), 348 349 TP_STRUCT__entry( 350 __field(enum pipe, pipe) 351 __field(u32, frame) 352 __field(u32, scanline) 353 ), 354 355 TP_fast_assign( 356 __entry->pipe = crtc->pipe; 357 __entry->frame = intel_crtc_get_vblank_counter(crtc); 358 __entry->scanline = intel_get_crtc_scanline(crtc); 359 ), 360 361 TP_printk("pipe %c, frame=%u, scanline=%u", 362 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 363 ); 364 365 TRACE_EVENT(intel_fbc_deactivate, 366 TP_PROTO(struct intel_crtc *crtc), 367 TP_ARGS(crtc), 368 369 TP_STRUCT__entry( 370 __field(enum pipe, pipe) 371 __field(u32, frame) 372 __field(u32, scanline) 373 ), 374 375 TP_fast_assign( 376 __entry->pipe = crtc->pipe; 377 __entry->frame = intel_crtc_get_vblank_counter(crtc); 378 __entry->scanline = intel_get_crtc_scanline(crtc); 379 ), 380 381 TP_printk("pipe %c, frame=%u, scanline=%u", 382 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 383 ); 384 385 TRACE_EVENT(intel_fbc_nuke, 386 TP_PROTO(struct intel_crtc *crtc), 387 TP_ARGS(crtc), 388 389 TP_STRUCT__entry( 390 __field(enum pipe, pipe) 391 __field(u32, frame) 392 __field(u32, scanline) 393 ), 394 395 TP_fast_assign( 396 __entry->pipe = crtc->pipe; 397 __entry->frame = intel_crtc_get_vblank_counter(crtc); 398 __entry->scanline = intel_get_crtc_scanline(crtc); 399 ), 400 401 TP_printk("pipe %c, frame=%u, scanline=%u", 402 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 403 ); 404 405 /* pipe updates */ 406 407 TRACE_EVENT(intel_pipe_update_start, 408 TP_PROTO(struct intel_crtc *crtc), 409 TP_ARGS(crtc), 410 411 TP_STRUCT__entry( 412 __field(enum pipe, pipe) 413 __field(u32, frame) 414 __field(u32, scanline) 415 __field(u32, min) 416 __field(u32, max) 417 ), 418 419 TP_fast_assign( 420 __entry->pipe = crtc->pipe; 421 __entry->frame = intel_crtc_get_vblank_counter(crtc); 422 __entry->scanline = intel_get_crtc_scanline(crtc); 423 __entry->min = crtc->debug.min_vbl; 424 __entry->max = crtc->debug.max_vbl; 425 ), 426 427 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 428 pipe_name(__entry->pipe), __entry->frame, 429 __entry->scanline, __entry->min, __entry->max) 430 ); 431 432 TRACE_EVENT(intel_pipe_update_vblank_evaded, 433 TP_PROTO(struct intel_crtc *crtc), 434 TP_ARGS(crtc), 435 436 TP_STRUCT__entry( 437 __field(enum pipe, pipe) 438 __field(u32, frame) 439 __field(u32, scanline) 440 __field(u32, min) 441 __field(u32, max) 442 ), 443 444 TP_fast_assign( 445 __entry->pipe = crtc->pipe; 446 __entry->frame = crtc->debug.start_vbl_count; 447 __entry->scanline = crtc->debug.scanline_start; 448 __entry->min = crtc->debug.min_vbl; 449 __entry->max = crtc->debug.max_vbl; 450 ), 451 452 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 453 pipe_name(__entry->pipe), __entry->frame, 454 __entry->scanline, __entry->min, __entry->max) 455 ); 456 457 TRACE_EVENT(intel_pipe_update_end, 458 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end), 459 TP_ARGS(crtc, frame, scanline_end), 460 461 TP_STRUCT__entry( 462 __field(enum pipe, pipe) 463 __field(u32, frame) 464 __field(u32, scanline) 465 ), 466 467 TP_fast_assign( 468 __entry->pipe = crtc->pipe; 469 __entry->frame = frame; 470 __entry->scanline = scanline_end; 471 ), 472 473 TP_printk("pipe %c, frame=%u, scanline=%u", 474 pipe_name(__entry->pipe), __entry->frame, 475 __entry->scanline) 476 ); 477 478 /* frontbuffer tracking */ 479 480 TRACE_EVENT(intel_frontbuffer_invalidate, 481 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin), 482 TP_ARGS(frontbuffer_bits, origin), 483 484 TP_STRUCT__entry( 485 __field(unsigned int, frontbuffer_bits) 486 __field(unsigned int, origin) 487 ), 488 489 TP_fast_assign( 490 __entry->frontbuffer_bits = frontbuffer_bits; 491 __entry->origin = origin; 492 ), 493 494 TP_printk("frontbuffer_bits=0x%08x, origin=%u", 495 __entry->frontbuffer_bits, __entry->origin) 496 ); 497 498 TRACE_EVENT(intel_frontbuffer_flush, 499 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin), 500 TP_ARGS(frontbuffer_bits, origin), 501 502 TP_STRUCT__entry( 503 __field(unsigned int, frontbuffer_bits) 504 __field(unsigned int, origin) 505 ), 506 507 TP_fast_assign( 508 __entry->frontbuffer_bits = frontbuffer_bits; 509 __entry->origin = origin; 510 ), 511 512 TP_printk("frontbuffer_bits=0x%08x, origin=%u", 513 __entry->frontbuffer_bits, __entry->origin) 514 ); 515 516 /* object tracking */ 517 518 TRACE_EVENT(i915_gem_object_create, 519 TP_PROTO(struct drm_i915_gem_object *obj), 520 TP_ARGS(obj), 521 522 TP_STRUCT__entry( 523 __field(struct drm_i915_gem_object *, obj) 524 __field(u64, size) 525 ), 526 527 TP_fast_assign( 528 __entry->obj = obj; 529 __entry->size = obj->base.size; 530 ), 531 532 TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size) 533 ); 534 535 TRACE_EVENT(i915_gem_shrink, 536 TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags), 537 TP_ARGS(i915, target, flags), 538 539 TP_STRUCT__entry( 540 __field(int, dev) 541 __field(unsigned long, target) 542 __field(unsigned, flags) 543 ), 544 545 TP_fast_assign( 546 __entry->dev = i915->drm.primary->index; 547 __entry->target = target; 548 __entry->flags = flags; 549 ), 550 551 TP_printk("dev=%d, target=%lu, flags=%x", 552 __entry->dev, __entry->target, __entry->flags) 553 ); 554 555 TRACE_EVENT(i915_vma_bind, 556 TP_PROTO(struct i915_vma *vma, unsigned flags), 557 TP_ARGS(vma, flags), 558 559 TP_STRUCT__entry( 560 __field(struct drm_i915_gem_object *, obj) 561 __field(struct i915_address_space *, vm) 562 __field(u64, offset) 563 __field(u64, size) 564 __field(unsigned, flags) 565 ), 566 567 TP_fast_assign( 568 __entry->obj = vma->obj; 569 __entry->vm = vma->vm; 570 __entry->offset = vma->node.start; 571 __entry->size = vma->node.size; 572 __entry->flags = flags; 573 ), 574 575 TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p", 576 __entry->obj, __entry->offset, __entry->size, 577 __entry->flags & PIN_MAPPABLE ? ", mappable" : "", 578 __entry->vm) 579 ); 580 581 TRACE_EVENT(i915_vma_unbind, 582 TP_PROTO(struct i915_vma *vma), 583 TP_ARGS(vma), 584 585 TP_STRUCT__entry( 586 __field(struct drm_i915_gem_object *, obj) 587 __field(struct i915_address_space *, vm) 588 __field(u64, offset) 589 __field(u64, size) 590 ), 591 592 TP_fast_assign( 593 __entry->obj = vma->obj; 594 __entry->vm = vma->vm; 595 __entry->offset = vma->node.start; 596 __entry->size = vma->node.size; 597 ), 598 599 TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p", 600 __entry->obj, __entry->offset, __entry->size, __entry->vm) 601 ); 602 603 TRACE_EVENT(i915_gem_object_pwrite, 604 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len), 605 TP_ARGS(obj, offset, len), 606 607 TP_STRUCT__entry( 608 __field(struct drm_i915_gem_object *, obj) 609 __field(u64, offset) 610 __field(u64, len) 611 ), 612 613 TP_fast_assign( 614 __entry->obj = obj; 615 __entry->offset = offset; 616 __entry->len = len; 617 ), 618 619 TP_printk("obj=%p, offset=0x%llx, len=0x%llx", 620 __entry->obj, __entry->offset, __entry->len) 621 ); 622 623 TRACE_EVENT(i915_gem_object_pread, 624 TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len), 625 TP_ARGS(obj, offset, len), 626 627 TP_STRUCT__entry( 628 __field(struct drm_i915_gem_object *, obj) 629 __field(u64, offset) 630 __field(u64, len) 631 ), 632 633 TP_fast_assign( 634 __entry->obj = obj; 635 __entry->offset = offset; 636 __entry->len = len; 637 ), 638 639 TP_printk("obj=%p, offset=0x%llx, len=0x%llx", 640 __entry->obj, __entry->offset, __entry->len) 641 ); 642 643 TRACE_EVENT(i915_gem_object_fault, 644 TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write), 645 TP_ARGS(obj, index, gtt, write), 646 647 TP_STRUCT__entry( 648 __field(struct drm_i915_gem_object *, obj) 649 __field(u64, index) 650 __field(bool, gtt) 651 __field(bool, write) 652 ), 653 654 TP_fast_assign( 655 __entry->obj = obj; 656 __entry->index = index; 657 __entry->gtt = gtt; 658 __entry->write = write; 659 ), 660 661 TP_printk("obj=%p, %s index=%llu %s", 662 __entry->obj, 663 __entry->gtt ? "GTT" : "CPU", 664 __entry->index, 665 __entry->write ? ", writable" : "") 666 ); 667 668 DECLARE_EVENT_CLASS(i915_gem_object, 669 TP_PROTO(struct drm_i915_gem_object *obj), 670 TP_ARGS(obj), 671 672 TP_STRUCT__entry( 673 __field(struct drm_i915_gem_object *, obj) 674 ), 675 676 TP_fast_assign( 677 __entry->obj = obj; 678 ), 679 680 TP_printk("obj=%p", __entry->obj) 681 ); 682 683 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, 684 TP_PROTO(struct drm_i915_gem_object *obj), 685 TP_ARGS(obj) 686 ); 687 688 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, 689 TP_PROTO(struct drm_i915_gem_object *obj), 690 TP_ARGS(obj) 691 ); 692 693 TRACE_EVENT(i915_gem_evict, 694 TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags), 695 TP_ARGS(vm, size, align, flags), 696 697 TP_STRUCT__entry( 698 __field(u32, dev) 699 __field(struct i915_address_space *, vm) 700 __field(u64, size) 701 __field(u64, align) 702 __field(unsigned int, flags) 703 ), 704 705 TP_fast_assign( 706 __entry->dev = vm->i915->drm.primary->index; 707 __entry->vm = vm; 708 __entry->size = size; 709 __entry->align = align; 710 __entry->flags = flags; 711 ), 712 713 TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s", 714 __entry->dev, __entry->vm, __entry->size, __entry->align, 715 __entry->flags & PIN_MAPPABLE ? ", mappable" : "") 716 ); 717 718 TRACE_EVENT(i915_gem_evict_node, 719 TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags), 720 TP_ARGS(vm, node, flags), 721 722 TP_STRUCT__entry( 723 __field(u32, dev) 724 __field(struct i915_address_space *, vm) 725 __field(u64, start) 726 __field(u64, size) 727 __field(unsigned long, color) 728 __field(unsigned int, flags) 729 ), 730 731 TP_fast_assign( 732 __entry->dev = vm->i915->drm.primary->index; 733 __entry->vm = vm; 734 __entry->start = node->start; 735 __entry->size = node->size; 736 __entry->color = node->color; 737 __entry->flags = flags; 738 ), 739 740 TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x", 741 __entry->dev, __entry->vm, 742 __entry->start, __entry->size, 743 __entry->color, __entry->flags) 744 ); 745 746 TRACE_EVENT(i915_gem_evict_vm, 747 TP_PROTO(struct i915_address_space *vm), 748 TP_ARGS(vm), 749 750 TP_STRUCT__entry( 751 __field(u32, dev) 752 __field(struct i915_address_space *, vm) 753 ), 754 755 TP_fast_assign( 756 __entry->dev = vm->i915->drm.primary->index; 757 __entry->vm = vm; 758 ), 759 760 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm) 761 ); 762 763 TRACE_EVENT(i915_request_queue, 764 TP_PROTO(struct i915_request *rq, u32 flags), 765 TP_ARGS(rq, flags), 766 767 TP_STRUCT__entry( 768 __field(u32, dev) 769 __field(u64, ctx) 770 __field(u16, class) 771 __field(u16, instance) 772 __field(u32, seqno) 773 __field(u32, flags) 774 ), 775 776 TP_fast_assign( 777 __entry->dev = rq->engine->i915->drm.primary->index; 778 __entry->class = rq->engine->uabi_class; 779 __entry->instance = rq->engine->uabi_instance; 780 __entry->ctx = rq->fence.context; 781 __entry->seqno = rq->fence.seqno; 782 __entry->flags = flags; 783 ), 784 785 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x", 786 __entry->dev, __entry->class, __entry->instance, 787 __entry->ctx, __entry->seqno, __entry->flags) 788 ); 789 790 DECLARE_EVENT_CLASS(i915_request, 791 TP_PROTO(struct i915_request *rq), 792 TP_ARGS(rq), 793 794 TP_STRUCT__entry( 795 __field(u32, dev) 796 __field(u64, ctx) 797 __field(u16, class) 798 __field(u16, instance) 799 __field(u32, seqno) 800 __field(u32, tail) 801 ), 802 803 TP_fast_assign( 804 __entry->dev = rq->engine->i915->drm.primary->index; 805 __entry->class = rq->engine->uabi_class; 806 __entry->instance = rq->engine->uabi_instance; 807 __entry->ctx = rq->fence.context; 808 __entry->seqno = rq->fence.seqno; 809 __entry->tail = rq->tail; 810 ), 811 812 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, tail=%u", 813 __entry->dev, __entry->class, __entry->instance, 814 __entry->ctx, __entry->seqno, __entry->tail) 815 ); 816 817 DEFINE_EVENT(i915_request, i915_request_add, 818 TP_PROTO(struct i915_request *rq), 819 TP_ARGS(rq) 820 ); 821 822 #if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS) 823 DEFINE_EVENT(i915_request, i915_request_guc_submit, 824 TP_PROTO(struct i915_request *rq), 825 TP_ARGS(rq) 826 ); 827 828 DEFINE_EVENT(i915_request, i915_request_submit, 829 TP_PROTO(struct i915_request *rq), 830 TP_ARGS(rq) 831 ); 832 833 DEFINE_EVENT(i915_request, i915_request_execute, 834 TP_PROTO(struct i915_request *rq), 835 TP_ARGS(rq) 836 ); 837 838 TRACE_EVENT(i915_request_in, 839 TP_PROTO(struct i915_request *rq, unsigned int port), 840 TP_ARGS(rq, port), 841 842 TP_STRUCT__entry( 843 __field(u32, dev) 844 __field(u64, ctx) 845 __field(u16, class) 846 __field(u16, instance) 847 __field(u32, seqno) 848 __field(u32, port) 849 __field(s32, prio) 850 ), 851 852 TP_fast_assign( 853 __entry->dev = rq->engine->i915->drm.primary->index; 854 __entry->class = rq->engine->uabi_class; 855 __entry->instance = rq->engine->uabi_instance; 856 __entry->ctx = rq->fence.context; 857 __entry->seqno = rq->fence.seqno; 858 __entry->prio = rq->sched.attr.priority; 859 __entry->port = port; 860 ), 861 862 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, prio=%d, port=%u", 863 __entry->dev, __entry->class, __entry->instance, 864 __entry->ctx, __entry->seqno, 865 __entry->prio, __entry->port) 866 ); 867 868 TRACE_EVENT(i915_request_out, 869 TP_PROTO(struct i915_request *rq), 870 TP_ARGS(rq), 871 872 TP_STRUCT__entry( 873 __field(u32, dev) 874 __field(u64, ctx) 875 __field(u16, class) 876 __field(u16, instance) 877 __field(u32, seqno) 878 __field(u32, completed) 879 ), 880 881 TP_fast_assign( 882 __entry->dev = rq->engine->i915->drm.primary->index; 883 __entry->class = rq->engine->uabi_class; 884 __entry->instance = rq->engine->uabi_instance; 885 __entry->ctx = rq->fence.context; 886 __entry->seqno = rq->fence.seqno; 887 __entry->completed = i915_request_completed(rq); 888 ), 889 890 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, completed?=%u", 891 __entry->dev, __entry->class, __entry->instance, 892 __entry->ctx, __entry->seqno, __entry->completed) 893 ); 894 895 DECLARE_EVENT_CLASS(intel_context, 896 TP_PROTO(struct intel_context *ce), 897 TP_ARGS(ce), 898 899 TP_STRUCT__entry( 900 __field(u32, guc_id) 901 __field(int, pin_count) 902 __field(u32, sched_state) 903 __field(u32, guc_sched_state_no_lock) 904 __field(u8, guc_prio) 905 ), 906 907 TP_fast_assign( 908 __entry->guc_id = ce->guc_id; 909 __entry->pin_count = atomic_read(&ce->pin_count); 910 __entry->sched_state = ce->guc_state.sched_state; 911 __entry->guc_sched_state_no_lock = 912 atomic_read(&ce->guc_sched_state_no_lock); 913 __entry->guc_prio = ce->guc_prio; 914 ), 915 916 TP_printk("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x, guc_prio=%u", 917 __entry->guc_id, __entry->pin_count, 918 __entry->sched_state, 919 __entry->guc_sched_state_no_lock, 920 __entry->guc_prio) 921 ); 922 923 DEFINE_EVENT(intel_context, intel_context_set_prio, 924 TP_PROTO(struct intel_context *ce), 925 TP_ARGS(ce) 926 ); 927 928 DEFINE_EVENT(intel_context, intel_context_reset, 929 TP_PROTO(struct intel_context *ce), 930 TP_ARGS(ce) 931 ); 932 933 DEFINE_EVENT(intel_context, intel_context_ban, 934 TP_PROTO(struct intel_context *ce), 935 TP_ARGS(ce) 936 ); 937 938 DEFINE_EVENT(intel_context, intel_context_register, 939 TP_PROTO(struct intel_context *ce), 940 TP_ARGS(ce) 941 ); 942 943 DEFINE_EVENT(intel_context, intel_context_deregister, 944 TP_PROTO(struct intel_context *ce), 945 TP_ARGS(ce) 946 ); 947 948 DEFINE_EVENT(intel_context, intel_context_deregister_done, 949 TP_PROTO(struct intel_context *ce), 950 TP_ARGS(ce) 951 ); 952 953 DEFINE_EVENT(intel_context, intel_context_sched_enable, 954 TP_PROTO(struct intel_context *ce), 955 TP_ARGS(ce) 956 ); 957 958 DEFINE_EVENT(intel_context, intel_context_sched_disable, 959 TP_PROTO(struct intel_context *ce), 960 TP_ARGS(ce) 961 ); 962 963 DEFINE_EVENT(intel_context, intel_context_sched_done, 964 TP_PROTO(struct intel_context *ce), 965 TP_ARGS(ce) 966 ); 967 968 DEFINE_EVENT(intel_context, intel_context_create, 969 TP_PROTO(struct intel_context *ce), 970 TP_ARGS(ce) 971 ); 972 973 DEFINE_EVENT(intel_context, intel_context_fence_release, 974 TP_PROTO(struct intel_context *ce), 975 TP_ARGS(ce) 976 ); 977 978 DEFINE_EVENT(intel_context, intel_context_free, 979 TP_PROTO(struct intel_context *ce), 980 TP_ARGS(ce) 981 ); 982 983 DEFINE_EVENT(intel_context, intel_context_steal_guc_id, 984 TP_PROTO(struct intel_context *ce), 985 TP_ARGS(ce) 986 ); 987 988 DEFINE_EVENT(intel_context, intel_context_do_pin, 989 TP_PROTO(struct intel_context *ce), 990 TP_ARGS(ce) 991 ); 992 993 DEFINE_EVENT(intel_context, intel_context_do_unpin, 994 TP_PROTO(struct intel_context *ce), 995 TP_ARGS(ce) 996 ); 997 998 #else 999 #if !defined(TRACE_HEADER_MULTI_READ) 1000 static inline void 1001 trace_i915_request_guc_submit(struct i915_request *rq) 1002 { 1003 } 1004 1005 static inline void 1006 trace_i915_request_submit(struct i915_request *rq) 1007 { 1008 } 1009 1010 static inline void 1011 trace_i915_request_execute(struct i915_request *rq) 1012 { 1013 } 1014 1015 static inline void 1016 trace_i915_request_in(struct i915_request *rq, unsigned int port) 1017 { 1018 } 1019 1020 static inline void 1021 trace_i915_request_out(struct i915_request *rq) 1022 { 1023 } 1024 1025 static inline void 1026 trace_intel_context_set_prio(struct intel_context *ce) 1027 { 1028 } 1029 1030 static inline void 1031 trace_intel_context_reset(struct intel_context *ce) 1032 { 1033 } 1034 1035 static inline void 1036 trace_intel_context_ban(struct intel_context *ce) 1037 { 1038 } 1039 1040 static inline void 1041 trace_intel_context_register(struct intel_context *ce) 1042 { 1043 } 1044 1045 static inline void 1046 trace_intel_context_deregister(struct intel_context *ce) 1047 { 1048 } 1049 1050 static inline void 1051 trace_intel_context_deregister_done(struct intel_context *ce) 1052 { 1053 } 1054 1055 static inline void 1056 trace_intel_context_sched_enable(struct intel_context *ce) 1057 { 1058 } 1059 1060 static inline void 1061 trace_intel_context_sched_disable(struct intel_context *ce) 1062 { 1063 } 1064 1065 static inline void 1066 trace_intel_context_sched_done(struct intel_context *ce) 1067 { 1068 } 1069 1070 static inline void 1071 trace_intel_context_create(struct intel_context *ce) 1072 { 1073 } 1074 1075 static inline void 1076 trace_intel_context_fence_release(struct intel_context *ce) 1077 { 1078 } 1079 1080 static inline void 1081 trace_intel_context_free(struct intel_context *ce) 1082 { 1083 } 1084 1085 static inline void 1086 trace_intel_context_steal_guc_id(struct intel_context *ce) 1087 { 1088 } 1089 1090 static inline void 1091 trace_intel_context_do_pin(struct intel_context *ce) 1092 { 1093 } 1094 1095 static inline void 1096 trace_intel_context_do_unpin(struct intel_context *ce) 1097 { 1098 } 1099 #endif 1100 #endif 1101 1102 DEFINE_EVENT(i915_request, i915_request_retire, 1103 TP_PROTO(struct i915_request *rq), 1104 TP_ARGS(rq) 1105 ); 1106 1107 TRACE_EVENT(i915_request_wait_begin, 1108 TP_PROTO(struct i915_request *rq, unsigned int flags), 1109 TP_ARGS(rq, flags), 1110 1111 TP_STRUCT__entry( 1112 __field(u32, dev) 1113 __field(u64, ctx) 1114 __field(u16, class) 1115 __field(u16, instance) 1116 __field(u32, seqno) 1117 __field(unsigned int, flags) 1118 ), 1119 1120 /* NB: the blocking information is racy since mutex_is_locked 1121 * doesn't check that the current thread holds the lock. The only 1122 * other option would be to pass the boolean information of whether 1123 * or not the class was blocking down through the stack which is 1124 * less desirable. 1125 */ 1126 TP_fast_assign( 1127 __entry->dev = rq->engine->i915->drm.primary->index; 1128 __entry->class = rq->engine->uabi_class; 1129 __entry->instance = rq->engine->uabi_instance; 1130 __entry->ctx = rq->fence.context; 1131 __entry->seqno = rq->fence.seqno; 1132 __entry->flags = flags; 1133 ), 1134 1135 TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, flags=0x%x", 1136 __entry->dev, __entry->class, __entry->instance, 1137 __entry->ctx, __entry->seqno, 1138 __entry->flags) 1139 ); 1140 1141 DEFINE_EVENT(i915_request, i915_request_wait_end, 1142 TP_PROTO(struct i915_request *rq), 1143 TP_ARGS(rq) 1144 ); 1145 1146 TRACE_EVENT_CONDITION(i915_reg_rw, 1147 TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace), 1148 1149 TP_ARGS(write, reg, val, len, trace), 1150 1151 TP_CONDITION(trace), 1152 1153 TP_STRUCT__entry( 1154 __field(u64, val) 1155 __field(u32, reg) 1156 __field(u16, write) 1157 __field(u16, len) 1158 ), 1159 1160 TP_fast_assign( 1161 __entry->val = (u64)val; 1162 __entry->reg = i915_mmio_reg_offset(reg); 1163 __entry->write = write; 1164 __entry->len = len; 1165 ), 1166 1167 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)", 1168 __entry->write ? "write" : "read", 1169 __entry->reg, __entry->len, 1170 (u32)(__entry->val & 0xffffffff), 1171 (u32)(__entry->val >> 32)) 1172 ); 1173 1174 TRACE_EVENT(intel_gpu_freq_change, 1175 TP_PROTO(u32 freq), 1176 TP_ARGS(freq), 1177 1178 TP_STRUCT__entry( 1179 __field(u32, freq) 1180 ), 1181 1182 TP_fast_assign( 1183 __entry->freq = freq; 1184 ), 1185 1186 TP_printk("new_freq=%u", __entry->freq) 1187 ); 1188 1189 /** 1190 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints 1191 * 1192 * With full ppgtt enabled each process using drm will allocate at least one 1193 * translation table. With these traces it is possible to keep track of the 1194 * allocation and of the lifetime of the tables; this can be used during 1195 * testing/debug to verify that we are not leaking ppgtts. 1196 * These traces identify the ppgtt through the vm pointer, which is also printed 1197 * by the i915_vma_bind and i915_vma_unbind tracepoints. 1198 */ 1199 DECLARE_EVENT_CLASS(i915_ppgtt, 1200 TP_PROTO(struct i915_address_space *vm), 1201 TP_ARGS(vm), 1202 1203 TP_STRUCT__entry( 1204 __field(struct i915_address_space *, vm) 1205 __field(u32, dev) 1206 ), 1207 1208 TP_fast_assign( 1209 __entry->vm = vm; 1210 __entry->dev = vm->i915->drm.primary->index; 1211 ), 1212 1213 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm) 1214 ) 1215 1216 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create, 1217 TP_PROTO(struct i915_address_space *vm), 1218 TP_ARGS(vm) 1219 ); 1220 1221 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, 1222 TP_PROTO(struct i915_address_space *vm), 1223 TP_ARGS(vm) 1224 ); 1225 1226 /** 1227 * DOC: i915_context_create and i915_context_free tracepoints 1228 * 1229 * These tracepoints are used to track creation and deletion of contexts. 1230 * If full ppgtt is enabled, they also print the address of the vm assigned to 1231 * the context. 1232 */ 1233 DECLARE_EVENT_CLASS(i915_context, 1234 TP_PROTO(struct i915_gem_context *ctx), 1235 TP_ARGS(ctx), 1236 1237 TP_STRUCT__entry( 1238 __field(u32, dev) 1239 __field(struct i915_gem_context *, ctx) 1240 __field(struct i915_address_space *, vm) 1241 ), 1242 1243 TP_fast_assign( 1244 __entry->dev = ctx->i915->drm.primary->index; 1245 __entry->ctx = ctx; 1246 __entry->vm = rcu_access_pointer(ctx->vm); 1247 ), 1248 1249 TP_printk("dev=%u, ctx=%p, ctx_vm=%p", 1250 __entry->dev, __entry->ctx, __entry->vm) 1251 ) 1252 1253 DEFINE_EVENT(i915_context, i915_context_create, 1254 TP_PROTO(struct i915_gem_context *ctx), 1255 TP_ARGS(ctx) 1256 ); 1257 1258 DEFINE_EVENT(i915_context, i915_context_free, 1259 TP_PROTO(struct i915_gem_context *ctx), 1260 TP_ARGS(ctx) 1261 ); 1262 1263 #endif /* _I915_TRACE_H_ */ 1264 1265 /* This part must be outside protection */ 1266 #undef TRACE_INCLUDE_PATH 1267 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915 1268 #include <trace/define_trace.h> 1269