1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright © 2021 Intel Corporation 4 */ 5 6 #undef TRACE_SYSTEM 7 #define TRACE_SYSTEM i915 8 9 #if !defined(__INTEL_DISPLAY_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ) 10 #define __INTEL_DISPLAY_TRACE_H__ 11 12 #include <linux/types.h> 13 #include <linux/tracepoint.h> 14 15 #include "i915_drv.h" 16 #include "i915_irq.h" 17 #include "intel_crtc.h" 18 #include "intel_display_types.h" 19 20 TRACE_EVENT(intel_pipe_enable, 21 TP_PROTO(struct intel_crtc *crtc), 22 TP_ARGS(crtc), 23 24 TP_STRUCT__entry( 25 __array(u32, frame, 3) 26 __array(u32, scanline, 3) 27 __field(enum pipe, pipe) 28 ), 29 TP_fast_assign( 30 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 31 struct intel_crtc *it__; 32 for_each_intel_crtc(&dev_priv->drm, it__) { 33 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); 34 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); 35 } 36 __entry->pipe = crtc->pipe; 37 ), 38 39 TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 40 pipe_name(__entry->pipe), 41 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 42 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 43 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 44 ); 45 46 TRACE_EVENT(intel_pipe_disable, 47 TP_PROTO(struct intel_crtc *crtc), 48 TP_ARGS(crtc), 49 50 TP_STRUCT__entry( 51 __array(u32, frame, 3) 52 __array(u32, scanline, 3) 53 __field(enum pipe, pipe) 54 ), 55 56 TP_fast_assign( 57 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 58 struct intel_crtc *it__; 59 for_each_intel_crtc(&dev_priv->drm, it__) { 60 __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); 61 __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); 62 } 63 __entry->pipe = crtc->pipe; 64 ), 65 66 TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 67 pipe_name(__entry->pipe), 68 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 69 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 70 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 71 ); 72 73 TRACE_EVENT(intel_pipe_crc, 74 TP_PROTO(struct intel_crtc *crtc, const u32 *crcs), 75 TP_ARGS(crtc, crcs), 76 77 TP_STRUCT__entry( 78 __field(enum pipe, pipe) 79 __field(u32, frame) 80 __field(u32, scanline) 81 __array(u32, crcs, 5) 82 ), 83 84 TP_fast_assign( 85 __entry->pipe = crtc->pipe; 86 __entry->frame = intel_crtc_get_vblank_counter(crtc); 87 __entry->scanline = intel_get_crtc_scanline(crtc); 88 memcpy(__entry->crcs, crcs, sizeof(__entry->crcs)); 89 ), 90 91 TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x", 92 pipe_name(__entry->pipe), __entry->frame, __entry->scanline, 93 __entry->crcs[0], __entry->crcs[1], __entry->crcs[2], 94 __entry->crcs[3], __entry->crcs[4]) 95 ); 96 97 TRACE_EVENT(intel_cpu_fifo_underrun, 98 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), 99 TP_ARGS(dev_priv, pipe), 100 101 TP_STRUCT__entry( 102 __field(enum pipe, pipe) 103 __field(u32, frame) 104 __field(u32, scanline) 105 ), 106 107 TP_fast_assign( 108 struct intel_crtc *crtc = intel_crtc_for_pipe(dev_priv, pipe); 109 __entry->pipe = pipe; 110 __entry->frame = intel_crtc_get_vblank_counter(crtc); 111 __entry->scanline = intel_get_crtc_scanline(crtc); 112 ), 113 114 TP_printk("pipe %c, frame=%u, scanline=%u", 115 pipe_name(__entry->pipe), 116 __entry->frame, __entry->scanline) 117 ); 118 119 TRACE_EVENT(intel_pch_fifo_underrun, 120 TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder), 121 TP_ARGS(dev_priv, pch_transcoder), 122 123 TP_STRUCT__entry( 124 __field(enum pipe, pipe) 125 __field(u32, frame) 126 __field(u32, scanline) 127 ), 128 129 TP_fast_assign( 130 enum pipe pipe = pch_transcoder; 131 struct intel_crtc *crtc = intel_crtc_for_pipe(dev_priv, pipe); 132 __entry->pipe = pipe; 133 __entry->frame = intel_crtc_get_vblank_counter(crtc); 134 __entry->scanline = intel_get_crtc_scanline(crtc); 135 ), 136 137 TP_printk("pch transcoder %c, frame=%u, scanline=%u", 138 pipe_name(__entry->pipe), 139 __entry->frame, __entry->scanline) 140 ); 141 142 TRACE_EVENT(intel_memory_cxsr, 143 TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new), 144 TP_ARGS(dev_priv, old, new), 145 146 TP_STRUCT__entry( 147 __array(u32, frame, 3) 148 __array(u32, scanline, 3) 149 __field(bool, old) 150 __field(bool, new) 151 ), 152 153 TP_fast_assign( 154 struct intel_crtc *crtc; 155 for_each_intel_crtc(&dev_priv->drm, crtc) { 156 __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc); 157 __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc); 158 } 159 __entry->old = old; 160 __entry->new = new; 161 ), 162 163 TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", 164 onoff(__entry->old), onoff(__entry->new), 165 __entry->frame[PIPE_A], __entry->scanline[PIPE_A], 166 __entry->frame[PIPE_B], __entry->scanline[PIPE_B], 167 __entry->frame[PIPE_C], __entry->scanline[PIPE_C]) 168 ); 169 170 TRACE_EVENT(g4x_wm, 171 TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm), 172 TP_ARGS(crtc, wm), 173 174 TP_STRUCT__entry( 175 __field(enum pipe, pipe) 176 __field(u32, frame) 177 __field(u32, scanline) 178 __field(u16, primary) 179 __field(u16, sprite) 180 __field(u16, cursor) 181 __field(u16, sr_plane) 182 __field(u16, sr_cursor) 183 __field(u16, sr_fbc) 184 __field(u16, hpll_plane) 185 __field(u16, hpll_cursor) 186 __field(u16, hpll_fbc) 187 __field(bool, cxsr) 188 __field(bool, hpll) 189 __field(bool, fbc) 190 ), 191 192 TP_fast_assign( 193 __entry->pipe = crtc->pipe; 194 __entry->frame = intel_crtc_get_vblank_counter(crtc); 195 __entry->scanline = intel_get_crtc_scanline(crtc); 196 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; 197 __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; 198 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR]; 199 __entry->sr_plane = wm->sr.plane; 200 __entry->sr_cursor = wm->sr.cursor; 201 __entry->sr_fbc = wm->sr.fbc; 202 __entry->hpll_plane = wm->hpll.plane; 203 __entry->hpll_cursor = wm->hpll.cursor; 204 __entry->hpll_fbc = wm->hpll.fbc; 205 __entry->cxsr = wm->cxsr; 206 __entry->hpll = wm->hpll_en; 207 __entry->fbc = wm->fbc_en; 208 ), 209 210 TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s", 211 pipe_name(__entry->pipe), __entry->frame, __entry->scanline, 212 __entry->primary, __entry->sprite, __entry->cursor, 213 yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc, 214 yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc, 215 yesno(__entry->fbc)) 216 ); 217 218 TRACE_EVENT(vlv_wm, 219 TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm), 220 TP_ARGS(crtc, wm), 221 222 TP_STRUCT__entry( 223 __field(enum pipe, pipe) 224 __field(u32, frame) 225 __field(u32, scanline) 226 __field(u32, level) 227 __field(u32, cxsr) 228 __field(u32, primary) 229 __field(u32, sprite0) 230 __field(u32, sprite1) 231 __field(u32, cursor) 232 __field(u32, sr_plane) 233 __field(u32, sr_cursor) 234 ), 235 236 TP_fast_assign( 237 __entry->pipe = crtc->pipe; 238 __entry->frame = intel_crtc_get_vblank_counter(crtc); 239 __entry->scanline = intel_get_crtc_scanline(crtc); 240 __entry->level = wm->level; 241 __entry->cxsr = wm->cxsr; 242 __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; 243 __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; 244 __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1]; 245 __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR]; 246 __entry->sr_plane = wm->sr.plane; 247 __entry->sr_cursor = wm->sr.cursor; 248 ), 249 250 TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d", 251 pipe_name(__entry->pipe), __entry->frame, 252 __entry->scanline, __entry->level, __entry->cxsr, 253 __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor, 254 __entry->sr_plane, __entry->sr_cursor) 255 ); 256 257 TRACE_EVENT(vlv_fifo_size, 258 TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size), 259 TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size), 260 261 TP_STRUCT__entry( 262 __field(enum pipe, pipe) 263 __field(u32, frame) 264 __field(u32, scanline) 265 __field(u32, sprite0_start) 266 __field(u32, sprite1_start) 267 __field(u32, fifo_size) 268 ), 269 270 TP_fast_assign( 271 __entry->pipe = crtc->pipe; 272 __entry->frame = intel_crtc_get_vblank_counter(crtc); 273 __entry->scanline = intel_get_crtc_scanline(crtc); 274 __entry->sprite0_start = sprite0_start; 275 __entry->sprite1_start = sprite1_start; 276 __entry->fifo_size = fifo_size; 277 ), 278 279 TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d", 280 pipe_name(__entry->pipe), __entry->frame, 281 __entry->scanline, __entry->sprite0_start, 282 __entry->sprite1_start, __entry->fifo_size) 283 ); 284 285 TRACE_EVENT(intel_plane_update_noarm, 286 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), 287 TP_ARGS(plane, crtc), 288 289 TP_STRUCT__entry( 290 __field(enum pipe, pipe) 291 __field(u32, frame) 292 __field(u32, scanline) 293 __array(int, src, 4) 294 __array(int, dst, 4) 295 __string(name, plane->name) 296 ), 297 298 TP_fast_assign( 299 __assign_str(name, plane->name); 300 __entry->pipe = crtc->pipe; 301 __entry->frame = intel_crtc_get_vblank_counter(crtc); 302 __entry->scanline = intel_get_crtc_scanline(crtc); 303 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src)); 304 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst)); 305 ), 306 307 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT, 308 pipe_name(__entry->pipe), __get_str(name), 309 __entry->frame, __entry->scanline, 310 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src), 311 DRM_RECT_ARG((const struct drm_rect *)__entry->dst)) 312 ); 313 314 TRACE_EVENT(intel_plane_update_arm, 315 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), 316 TP_ARGS(plane, crtc), 317 318 TP_STRUCT__entry( 319 __field(enum pipe, pipe) 320 __field(u32, frame) 321 __field(u32, scanline) 322 __array(int, src, 4) 323 __array(int, dst, 4) 324 __string(name, plane->name) 325 ), 326 327 TP_fast_assign( 328 __assign_str(name, plane->name); 329 __entry->pipe = crtc->pipe; 330 __entry->frame = intel_crtc_get_vblank_counter(crtc); 331 __entry->scanline = intel_get_crtc_scanline(crtc); 332 memcpy(__entry->src, &plane->state->src, sizeof(__entry->src)); 333 memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst)); 334 ), 335 336 TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT, 337 pipe_name(__entry->pipe), __get_str(name), 338 __entry->frame, __entry->scanline, 339 DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src), 340 DRM_RECT_ARG((const struct drm_rect *)__entry->dst)) 341 ); 342 343 TRACE_EVENT(intel_plane_disable_arm, 344 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), 345 TP_ARGS(plane, crtc), 346 347 TP_STRUCT__entry( 348 __field(enum pipe, pipe) 349 __field(u32, frame) 350 __field(u32, scanline) 351 __string(name, plane->name) 352 ), 353 354 TP_fast_assign( 355 __assign_str(name, plane->name); 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, plane %s, frame=%u, scanline=%u", 362 pipe_name(__entry->pipe), __get_str(name), 363 __entry->frame, __entry->scanline) 364 ); 365 366 TRACE_EVENT(intel_fbc_activate, 367 TP_PROTO(struct intel_plane *plane), 368 TP_ARGS(plane), 369 370 TP_STRUCT__entry( 371 __field(enum pipe, pipe) 372 __field(u32, frame) 373 __field(u32, scanline) 374 ), 375 376 TP_fast_assign( 377 struct intel_crtc *crtc = intel_crtc_for_pipe(to_i915(plane->base.dev), 378 plane->pipe); 379 __entry->pipe = crtc->pipe; 380 __entry->frame = intel_crtc_get_vblank_counter(crtc); 381 __entry->scanline = intel_get_crtc_scanline(crtc); 382 ), 383 384 TP_printk("pipe %c, frame=%u, scanline=%u", 385 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 386 ); 387 388 TRACE_EVENT(intel_fbc_deactivate, 389 TP_PROTO(struct intel_plane *plane), 390 TP_ARGS(plane), 391 392 TP_STRUCT__entry( 393 __field(enum pipe, pipe) 394 __field(u32, frame) 395 __field(u32, scanline) 396 ), 397 398 TP_fast_assign( 399 struct intel_crtc *crtc = intel_crtc_for_pipe(to_i915(plane->base.dev), 400 plane->pipe); 401 __entry->pipe = crtc->pipe; 402 __entry->frame = intel_crtc_get_vblank_counter(crtc); 403 __entry->scanline = intel_get_crtc_scanline(crtc); 404 ), 405 406 TP_printk("pipe %c, frame=%u, scanline=%u", 407 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 408 ); 409 410 TRACE_EVENT(intel_fbc_nuke, 411 TP_PROTO(struct intel_plane *plane), 412 TP_ARGS(plane), 413 414 TP_STRUCT__entry( 415 __field(enum pipe, pipe) 416 __field(u32, frame) 417 __field(u32, scanline) 418 ), 419 420 TP_fast_assign( 421 struct intel_crtc *crtc = intel_crtc_for_pipe(to_i915(plane->base.dev), 422 plane->pipe); 423 __entry->pipe = crtc->pipe; 424 __entry->frame = intel_crtc_get_vblank_counter(crtc); 425 __entry->scanline = intel_get_crtc_scanline(crtc); 426 ), 427 428 TP_printk("pipe %c, frame=%u, scanline=%u", 429 pipe_name(__entry->pipe), __entry->frame, __entry->scanline) 430 ); 431 432 TRACE_EVENT(intel_crtc_vblank_work_start, 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 ), 441 442 TP_fast_assign( 443 __entry->pipe = crtc->pipe; 444 __entry->frame = intel_crtc_get_vblank_counter(crtc); 445 __entry->scanline = intel_get_crtc_scanline(crtc); 446 ), 447 448 TP_printk("pipe %c, frame=%u, scanline=%u", 449 pipe_name(__entry->pipe), __entry->frame, 450 __entry->scanline) 451 ); 452 453 TRACE_EVENT(intel_crtc_vblank_work_end, 454 TP_PROTO(struct intel_crtc *crtc), 455 TP_ARGS(crtc), 456 457 TP_STRUCT__entry( 458 __field(enum pipe, pipe) 459 __field(u32, frame) 460 __field(u32, scanline) 461 ), 462 463 TP_fast_assign( 464 __entry->pipe = crtc->pipe; 465 __entry->frame = intel_crtc_get_vblank_counter(crtc); 466 __entry->scanline = intel_get_crtc_scanline(crtc); 467 ), 468 469 TP_printk("pipe %c, frame=%u, scanline=%u", 470 pipe_name(__entry->pipe), __entry->frame, 471 __entry->scanline) 472 ); 473 474 TRACE_EVENT(intel_pipe_update_start, 475 TP_PROTO(struct intel_crtc *crtc), 476 TP_ARGS(crtc), 477 478 TP_STRUCT__entry( 479 __field(enum pipe, pipe) 480 __field(u32, frame) 481 __field(u32, scanline) 482 __field(u32, min) 483 __field(u32, max) 484 ), 485 486 TP_fast_assign( 487 __entry->pipe = crtc->pipe; 488 __entry->frame = intel_crtc_get_vblank_counter(crtc); 489 __entry->scanline = intel_get_crtc_scanline(crtc); 490 __entry->min = crtc->debug.min_vbl; 491 __entry->max = crtc->debug.max_vbl; 492 ), 493 494 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 495 pipe_name(__entry->pipe), __entry->frame, 496 __entry->scanline, __entry->min, __entry->max) 497 ); 498 499 TRACE_EVENT(intel_pipe_update_vblank_evaded, 500 TP_PROTO(struct intel_crtc *crtc), 501 TP_ARGS(crtc), 502 503 TP_STRUCT__entry( 504 __field(enum pipe, pipe) 505 __field(u32, frame) 506 __field(u32, scanline) 507 __field(u32, min) 508 __field(u32, max) 509 ), 510 511 TP_fast_assign( 512 __entry->pipe = crtc->pipe; 513 __entry->frame = crtc->debug.start_vbl_count; 514 __entry->scanline = crtc->debug.scanline_start; 515 __entry->min = crtc->debug.min_vbl; 516 __entry->max = crtc->debug.max_vbl; 517 ), 518 519 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 520 pipe_name(__entry->pipe), __entry->frame, 521 __entry->scanline, __entry->min, __entry->max) 522 ); 523 524 TRACE_EVENT(intel_pipe_update_end, 525 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end), 526 TP_ARGS(crtc, frame, scanline_end), 527 528 TP_STRUCT__entry( 529 __field(enum pipe, pipe) 530 __field(u32, frame) 531 __field(u32, scanline) 532 ), 533 534 TP_fast_assign( 535 __entry->pipe = crtc->pipe; 536 __entry->frame = frame; 537 __entry->scanline = scanline_end; 538 ), 539 540 TP_printk("pipe %c, frame=%u, scanline=%u", 541 pipe_name(__entry->pipe), __entry->frame, 542 __entry->scanline) 543 ); 544 545 TRACE_EVENT(intel_frontbuffer_invalidate, 546 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin), 547 TP_ARGS(frontbuffer_bits, origin), 548 549 TP_STRUCT__entry( 550 __field(unsigned int, frontbuffer_bits) 551 __field(unsigned int, origin) 552 ), 553 554 TP_fast_assign( 555 __entry->frontbuffer_bits = frontbuffer_bits; 556 __entry->origin = origin; 557 ), 558 559 TP_printk("frontbuffer_bits=0x%08x, origin=%u", 560 __entry->frontbuffer_bits, __entry->origin) 561 ); 562 563 TRACE_EVENT(intel_frontbuffer_flush, 564 TP_PROTO(unsigned int frontbuffer_bits, unsigned int origin), 565 TP_ARGS(frontbuffer_bits, origin), 566 567 TP_STRUCT__entry( 568 __field(unsigned int, frontbuffer_bits) 569 __field(unsigned int, origin) 570 ), 571 572 TP_fast_assign( 573 __entry->frontbuffer_bits = frontbuffer_bits; 574 __entry->origin = origin; 575 ), 576 577 TP_printk("frontbuffer_bits=0x%08x, origin=%u", 578 __entry->frontbuffer_bits, __entry->origin) 579 ); 580 581 #endif /* __INTEL_DISPLAY_TRACE_H__ */ 582 583 /* This part must be outside protection */ 584 #undef TRACE_INCLUDE_PATH 585 #undef TRACE_INCLUDE_FILE 586 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915/display 587 #define TRACE_INCLUDE_FILE intel_display_trace 588 #include <trace/define_trace.h> 589