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