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