Linux Audio

Check our new training course

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