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