i915_trace.h 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  3. #define _I915_TRACE_H_
  4. #include <linux/stringify.h>
  5. #include <linux/types.h>
  6. #include <linux/tracepoint.h>
  7. #include <drm/drmP.h>
  8. #include "i915_drv.h"
  9. #include "intel_drv.h"
  10. #include "intel_ringbuffer.h"
  11. #undef TRACE_SYSTEM
  12. #define TRACE_SYSTEM i915
  13. #define TRACE_INCLUDE_FILE i915_trace
  14. /* watermark/fifo updates */
  15. TRACE_EVENT(intel_cpu_fifo_underrun,
  16. TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
  17. TP_ARGS(dev_priv, pipe),
  18. TP_STRUCT__entry(
  19. __field(enum pipe, pipe)
  20. __field(u32, frame)
  21. __field(u32, scanline)
  22. ),
  23. TP_fast_assign(
  24. __entry->pipe = pipe;
  25. __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
  26. __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
  27. ),
  28. TP_printk("pipe %c, frame=%u, scanline=%u",
  29. pipe_name(__entry->pipe),
  30. __entry->frame, __entry->scanline)
  31. );
  32. TRACE_EVENT(intel_pch_fifo_underrun,
  33. TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder),
  34. TP_ARGS(dev_priv, pch_transcoder),
  35. TP_STRUCT__entry(
  36. __field(enum pipe, pipe)
  37. __field(u32, frame)
  38. __field(u32, scanline)
  39. ),
  40. TP_fast_assign(
  41. enum pipe pipe = pch_transcoder;
  42. __entry->pipe = pipe;
  43. __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
  44. __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
  45. ),
  46. TP_printk("pch transcoder %c, frame=%u, scanline=%u",
  47. pipe_name(__entry->pipe),
  48. __entry->frame, __entry->scanline)
  49. );
  50. TRACE_EVENT(intel_memory_cxsr,
  51. TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new),
  52. TP_ARGS(dev_priv, old, new),
  53. TP_STRUCT__entry(
  54. __array(u32, frame, 3)
  55. __array(u32, scanline, 3)
  56. __field(bool, old)
  57. __field(bool, new)
  58. ),
  59. TP_fast_assign(
  60. enum pipe pipe;
  61. for_each_pipe(dev_priv, pipe) {
  62. __entry->frame[pipe] =
  63. dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
  64. __entry->scanline[pipe] =
  65. intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
  66. }
  67. __entry->old = old;
  68. __entry->new = new;
  69. ),
  70. TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
  71. onoff(__entry->old), onoff(__entry->new),
  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. TRACE_EVENT(g4x_wm,
  77. TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
  78. TP_ARGS(crtc, wm),
  79. TP_STRUCT__entry(
  80. __field(enum pipe, pipe)
  81. __field(u32, frame)
  82. __field(u32, scanline)
  83. __field(u16, primary)
  84. __field(u16, sprite)
  85. __field(u16, cursor)
  86. __field(u16, sr_plane)
  87. __field(u16, sr_cursor)
  88. __field(u16, sr_fbc)
  89. __field(u16, hpll_plane)
  90. __field(u16, hpll_cursor)
  91. __field(u16, hpll_fbc)
  92. __field(bool, cxsr)
  93. __field(bool, hpll)
  94. __field(bool, fbc)
  95. ),
  96. TP_fast_assign(
  97. __entry->pipe = crtc->pipe;
  98. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  99. crtc->pipe);
  100. __entry->scanline = intel_get_crtc_scanline(crtc);
  101. __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
  102. __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
  103. __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
  104. __entry->sr_plane = wm->sr.plane;
  105. __entry->sr_cursor = wm->sr.cursor;
  106. __entry->sr_fbc = wm->sr.fbc;
  107. __entry->hpll_plane = wm->hpll.plane;
  108. __entry->hpll_cursor = wm->hpll.cursor;
  109. __entry->hpll_fbc = wm->hpll.fbc;
  110. __entry->cxsr = wm->cxsr;
  111. __entry->hpll = wm->hpll_en;
  112. __entry->fbc = wm->fbc_en;
  113. ),
  114. TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
  115. pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
  116. __entry->primary, __entry->sprite, __entry->cursor,
  117. yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
  118. yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
  119. yesno(__entry->fbc))
  120. );
  121. TRACE_EVENT(vlv_wm,
  122. TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
  123. TP_ARGS(crtc, wm),
  124. TP_STRUCT__entry(
  125. __field(enum pipe, pipe)
  126. __field(u32, frame)
  127. __field(u32, scanline)
  128. __field(u32, level)
  129. __field(u32, cxsr)
  130. __field(u32, primary)
  131. __field(u32, sprite0)
  132. __field(u32, sprite1)
  133. __field(u32, cursor)
  134. __field(u32, sr_plane)
  135. __field(u32, sr_cursor)
  136. ),
  137. TP_fast_assign(
  138. __entry->pipe = crtc->pipe;
  139. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  140. crtc->pipe);
  141. __entry->scanline = intel_get_crtc_scanline(crtc);
  142. __entry->level = wm->level;
  143. __entry->cxsr = wm->cxsr;
  144. __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
  145. __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
  146. __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
  147. __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
  148. __entry->sr_plane = wm->sr.plane;
  149. __entry->sr_cursor = wm->sr.cursor;
  150. ),
  151. TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
  152. pipe_name(__entry->pipe), __entry->frame,
  153. __entry->scanline, __entry->level, __entry->cxsr,
  154. __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
  155. __entry->sr_plane, __entry->sr_cursor)
  156. );
  157. TRACE_EVENT(vlv_fifo_size,
  158. TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
  159. TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
  160. TP_STRUCT__entry(
  161. __field(enum pipe, pipe)
  162. __field(u32, frame)
  163. __field(u32, scanline)
  164. __field(u32, sprite0_start)
  165. __field(u32, sprite1_start)
  166. __field(u32, fifo_size)
  167. ),
  168. TP_fast_assign(
  169. __entry->pipe = crtc->pipe;
  170. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  171. crtc->pipe);
  172. __entry->scanline = intel_get_crtc_scanline(crtc);
  173. __entry->sprite0_start = sprite0_start;
  174. __entry->sprite1_start = sprite1_start;
  175. __entry->fifo_size = fifo_size;
  176. ),
  177. TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
  178. pipe_name(__entry->pipe), __entry->frame,
  179. __entry->scanline, __entry->sprite0_start,
  180. __entry->sprite1_start, __entry->fifo_size)
  181. );
  182. /* plane updates */
  183. TRACE_EVENT(intel_update_plane,
  184. TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
  185. TP_ARGS(plane, crtc),
  186. TP_STRUCT__entry(
  187. __field(enum pipe, pipe)
  188. __field(const char *, name)
  189. __field(u32, frame)
  190. __field(u32, scanline)
  191. __array(int, src, 4)
  192. __array(int, dst, 4)
  193. ),
  194. TP_fast_assign(
  195. __entry->pipe = crtc->pipe;
  196. __entry->name = plane->name;
  197. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  198. crtc->pipe);
  199. __entry->scanline = intel_get_crtc_scanline(crtc);
  200. memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
  201. memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
  202. ),
  203. TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
  204. pipe_name(__entry->pipe), __entry->name,
  205. __entry->frame, __entry->scanline,
  206. DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
  207. DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
  208. );
  209. TRACE_EVENT(intel_disable_plane,
  210. TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
  211. TP_ARGS(plane, crtc),
  212. TP_STRUCT__entry(
  213. __field(enum pipe, pipe)
  214. __field(const char *, name)
  215. __field(u32, frame)
  216. __field(u32, scanline)
  217. ),
  218. TP_fast_assign(
  219. __entry->pipe = crtc->pipe;
  220. __entry->name = plane->name;
  221. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  222. crtc->pipe);
  223. __entry->scanline = intel_get_crtc_scanline(crtc);
  224. ),
  225. TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
  226. pipe_name(__entry->pipe), __entry->name,
  227. __entry->frame, __entry->scanline)
  228. );
  229. /* pipe updates */
  230. TRACE_EVENT(i915_pipe_update_start,
  231. TP_PROTO(struct intel_crtc *crtc),
  232. TP_ARGS(crtc),
  233. TP_STRUCT__entry(
  234. __field(enum pipe, pipe)
  235. __field(u32, frame)
  236. __field(u32, scanline)
  237. __field(u32, min)
  238. __field(u32, max)
  239. ),
  240. TP_fast_assign(
  241. __entry->pipe = crtc->pipe;
  242. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  243. crtc->pipe);
  244. __entry->scanline = intel_get_crtc_scanline(crtc);
  245. __entry->min = crtc->debug.min_vbl;
  246. __entry->max = crtc->debug.max_vbl;
  247. ),
  248. TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
  249. pipe_name(__entry->pipe), __entry->frame,
  250. __entry->scanline, __entry->min, __entry->max)
  251. );
  252. TRACE_EVENT(i915_pipe_update_vblank_evaded,
  253. TP_PROTO(struct intel_crtc *crtc),
  254. TP_ARGS(crtc),
  255. TP_STRUCT__entry(
  256. __field(enum pipe, pipe)
  257. __field(u32, frame)
  258. __field(u32, scanline)
  259. __field(u32, min)
  260. __field(u32, max)
  261. ),
  262. TP_fast_assign(
  263. __entry->pipe = crtc->pipe;
  264. __entry->frame = crtc->debug.start_vbl_count;
  265. __entry->scanline = crtc->debug.scanline_start;
  266. __entry->min = crtc->debug.min_vbl;
  267. __entry->max = crtc->debug.max_vbl;
  268. ),
  269. TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
  270. pipe_name(__entry->pipe), __entry->frame,
  271. __entry->scanline, __entry->min, __entry->max)
  272. );
  273. TRACE_EVENT(i915_pipe_update_end,
  274. TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
  275. TP_ARGS(crtc, frame, scanline_end),
  276. TP_STRUCT__entry(
  277. __field(enum pipe, pipe)
  278. __field(u32, frame)
  279. __field(u32, scanline)
  280. ),
  281. TP_fast_assign(
  282. __entry->pipe = crtc->pipe;
  283. __entry->frame = frame;
  284. __entry->scanline = scanline_end;
  285. ),
  286. TP_printk("pipe %c, frame=%u, scanline=%u",
  287. pipe_name(__entry->pipe), __entry->frame,
  288. __entry->scanline)
  289. );
  290. /* object tracking */
  291. TRACE_EVENT(i915_gem_object_create,
  292. TP_PROTO(struct drm_i915_gem_object *obj),
  293. TP_ARGS(obj),
  294. TP_STRUCT__entry(
  295. __field(struct drm_i915_gem_object *, obj)
  296. __field(u64, size)
  297. ),
  298. TP_fast_assign(
  299. __entry->obj = obj;
  300. __entry->size = obj->base.size;
  301. ),
  302. TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size)
  303. );
  304. TRACE_EVENT(i915_gem_shrink,
  305. TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
  306. TP_ARGS(i915, target, flags),
  307. TP_STRUCT__entry(
  308. __field(int, dev)
  309. __field(unsigned long, target)
  310. __field(unsigned, flags)
  311. ),
  312. TP_fast_assign(
  313. __entry->dev = i915->drm.primary->index;
  314. __entry->target = target;
  315. __entry->flags = flags;
  316. ),
  317. TP_printk("dev=%d, target=%lu, flags=%x",
  318. __entry->dev, __entry->target, __entry->flags)
  319. );
  320. TRACE_EVENT(i915_vma_bind,
  321. TP_PROTO(struct i915_vma *vma, unsigned flags),
  322. TP_ARGS(vma, flags),
  323. TP_STRUCT__entry(
  324. __field(struct drm_i915_gem_object *, obj)
  325. __field(struct i915_address_space *, vm)
  326. __field(u64, offset)
  327. __field(u64, size)
  328. __field(unsigned, flags)
  329. ),
  330. TP_fast_assign(
  331. __entry->obj = vma->obj;
  332. __entry->vm = vma->vm;
  333. __entry->offset = vma->node.start;
  334. __entry->size = vma->node.size;
  335. __entry->flags = flags;
  336. ),
  337. TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
  338. __entry->obj, __entry->offset, __entry->size,
  339. __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
  340. __entry->vm)
  341. );
  342. TRACE_EVENT(i915_vma_unbind,
  343. TP_PROTO(struct i915_vma *vma),
  344. TP_ARGS(vma),
  345. TP_STRUCT__entry(
  346. __field(struct drm_i915_gem_object *, obj)
  347. __field(struct i915_address_space *, vm)
  348. __field(u64, offset)
  349. __field(u64, size)
  350. ),
  351. TP_fast_assign(
  352. __entry->obj = vma->obj;
  353. __entry->vm = vma->vm;
  354. __entry->offset = vma->node.start;
  355. __entry->size = vma->node.size;
  356. ),
  357. TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
  358. __entry->obj, __entry->offset, __entry->size, __entry->vm)
  359. );
  360. TRACE_EVENT(i915_gem_object_pwrite,
  361. TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
  362. TP_ARGS(obj, offset, len),
  363. TP_STRUCT__entry(
  364. __field(struct drm_i915_gem_object *, obj)
  365. __field(u64, offset)
  366. __field(u64, len)
  367. ),
  368. TP_fast_assign(
  369. __entry->obj = obj;
  370. __entry->offset = offset;
  371. __entry->len = len;
  372. ),
  373. TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
  374. __entry->obj, __entry->offset, __entry->len)
  375. );
  376. TRACE_EVENT(i915_gem_object_pread,
  377. TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
  378. TP_ARGS(obj, offset, len),
  379. TP_STRUCT__entry(
  380. __field(struct drm_i915_gem_object *, obj)
  381. __field(u64, offset)
  382. __field(u64, len)
  383. ),
  384. TP_fast_assign(
  385. __entry->obj = obj;
  386. __entry->offset = offset;
  387. __entry->len = len;
  388. ),
  389. TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
  390. __entry->obj, __entry->offset, __entry->len)
  391. );
  392. TRACE_EVENT(i915_gem_object_fault,
  393. TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write),
  394. TP_ARGS(obj, index, gtt, write),
  395. TP_STRUCT__entry(
  396. __field(struct drm_i915_gem_object *, obj)
  397. __field(u64, index)
  398. __field(bool, gtt)
  399. __field(bool, write)
  400. ),
  401. TP_fast_assign(
  402. __entry->obj = obj;
  403. __entry->index = index;
  404. __entry->gtt = gtt;
  405. __entry->write = write;
  406. ),
  407. TP_printk("obj=%p, %s index=%llu %s",
  408. __entry->obj,
  409. __entry->gtt ? "GTT" : "CPU",
  410. __entry->index,
  411. __entry->write ? ", writable" : "")
  412. );
  413. DECLARE_EVENT_CLASS(i915_gem_object,
  414. TP_PROTO(struct drm_i915_gem_object *obj),
  415. TP_ARGS(obj),
  416. TP_STRUCT__entry(
  417. __field(struct drm_i915_gem_object *, obj)
  418. ),
  419. TP_fast_assign(
  420. __entry->obj = obj;
  421. ),
  422. TP_printk("obj=%p", __entry->obj)
  423. );
  424. DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
  425. TP_PROTO(struct drm_i915_gem_object *obj),
  426. TP_ARGS(obj)
  427. );
  428. DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
  429. TP_PROTO(struct drm_i915_gem_object *obj),
  430. TP_ARGS(obj)
  431. );
  432. TRACE_EVENT(i915_gem_evict,
  433. TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags),
  434. TP_ARGS(vm, size, align, flags),
  435. TP_STRUCT__entry(
  436. __field(u32, dev)
  437. __field(struct i915_address_space *, vm)
  438. __field(u64, size)
  439. __field(u64, align)
  440. __field(unsigned int, flags)
  441. ),
  442. TP_fast_assign(
  443. __entry->dev = vm->i915->drm.primary->index;
  444. __entry->vm = vm;
  445. __entry->size = size;
  446. __entry->align = align;
  447. __entry->flags = flags;
  448. ),
  449. TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
  450. __entry->dev, __entry->vm, __entry->size, __entry->align,
  451. __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
  452. );
  453. TRACE_EVENT(i915_gem_evict_node,
  454. TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags),
  455. TP_ARGS(vm, node, flags),
  456. TP_STRUCT__entry(
  457. __field(u32, dev)
  458. __field(struct i915_address_space *, vm)
  459. __field(u64, start)
  460. __field(u64, size)
  461. __field(unsigned long, color)
  462. __field(unsigned int, flags)
  463. ),
  464. TP_fast_assign(
  465. __entry->dev = vm->i915->drm.primary->index;
  466. __entry->vm = vm;
  467. __entry->start = node->start;
  468. __entry->size = node->size;
  469. __entry->color = node->color;
  470. __entry->flags = flags;
  471. ),
  472. TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
  473. __entry->dev, __entry->vm,
  474. __entry->start, __entry->size,
  475. __entry->color, __entry->flags)
  476. );
  477. TRACE_EVENT(i915_gem_evict_vm,
  478. TP_PROTO(struct i915_address_space *vm),
  479. TP_ARGS(vm),
  480. TP_STRUCT__entry(
  481. __field(u32, dev)
  482. __field(struct i915_address_space *, vm)
  483. ),
  484. TP_fast_assign(
  485. __entry->dev = vm->i915->drm.primary->index;
  486. __entry->vm = vm;
  487. ),
  488. TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
  489. );
  490. TRACE_EVENT(i915_gem_ring_sync_to,
  491. TP_PROTO(struct drm_i915_gem_request *to,
  492. struct drm_i915_gem_request *from),
  493. TP_ARGS(to, from),
  494. TP_STRUCT__entry(
  495. __field(u32, dev)
  496. __field(u32, sync_from)
  497. __field(u32, sync_to)
  498. __field(u32, seqno)
  499. ),
  500. TP_fast_assign(
  501. __entry->dev = from->i915->drm.primary->index;
  502. __entry->sync_from = from->engine->id;
  503. __entry->sync_to = to->engine->id;
  504. __entry->seqno = from->global_seqno;
  505. ),
  506. TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u",
  507. __entry->dev,
  508. __entry->sync_from, __entry->sync_to,
  509. __entry->seqno)
  510. );
  511. TRACE_EVENT(i915_gem_request_queue,
  512. TP_PROTO(struct drm_i915_gem_request *req, u32 flags),
  513. TP_ARGS(req, flags),
  514. TP_STRUCT__entry(
  515. __field(u32, dev)
  516. __field(u32, hw_id)
  517. __field(u32, ring)
  518. __field(u32, ctx)
  519. __field(u32, seqno)
  520. __field(u32, flags)
  521. ),
  522. TP_fast_assign(
  523. __entry->dev = req->i915->drm.primary->index;
  524. __entry->hw_id = req->ctx->hw_id;
  525. __entry->ring = req->engine->id;
  526. __entry->ctx = req->fence.context;
  527. __entry->seqno = req->fence.seqno;
  528. __entry->flags = flags;
  529. ),
  530. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, flags=0x%x",
  531. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  532. __entry->seqno, __entry->flags)
  533. );
  534. DECLARE_EVENT_CLASS(i915_gem_request,
  535. TP_PROTO(struct drm_i915_gem_request *req),
  536. TP_ARGS(req),
  537. TP_STRUCT__entry(
  538. __field(u32, dev)
  539. __field(u32, hw_id)
  540. __field(u32, ring)
  541. __field(u32, ctx)
  542. __field(u32, seqno)
  543. __field(u32, global)
  544. ),
  545. TP_fast_assign(
  546. __entry->dev = req->i915->drm.primary->index;
  547. __entry->hw_id = req->ctx->hw_id;
  548. __entry->ring = req->engine->id;
  549. __entry->ctx = req->fence.context;
  550. __entry->seqno = req->fence.seqno;
  551. __entry->global = req->global_seqno;
  552. ),
  553. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u",
  554. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  555. __entry->seqno, __entry->global)
  556. );
  557. DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
  558. TP_PROTO(struct drm_i915_gem_request *req),
  559. TP_ARGS(req)
  560. );
  561. #if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
  562. DEFINE_EVENT(i915_gem_request, i915_gem_request_submit,
  563. TP_PROTO(struct drm_i915_gem_request *req),
  564. TP_ARGS(req)
  565. );
  566. DEFINE_EVENT(i915_gem_request, i915_gem_request_execute,
  567. TP_PROTO(struct drm_i915_gem_request *req),
  568. TP_ARGS(req)
  569. );
  570. DECLARE_EVENT_CLASS(i915_gem_request_hw,
  571. TP_PROTO(struct drm_i915_gem_request *req,
  572. unsigned int port),
  573. TP_ARGS(req, port),
  574. TP_STRUCT__entry(
  575. __field(u32, dev)
  576. __field(u32, hw_id)
  577. __field(u32, ring)
  578. __field(u32, ctx)
  579. __field(u32, seqno)
  580. __field(u32, global_seqno)
  581. __field(u32, port)
  582. ),
  583. TP_fast_assign(
  584. __entry->dev = req->i915->drm.primary->index;
  585. __entry->hw_id = req->ctx->hw_id;
  586. __entry->ring = req->engine->id;
  587. __entry->ctx = req->fence.context;
  588. __entry->seqno = req->fence.seqno;
  589. __entry->global_seqno = req->global_seqno;
  590. __entry->port = port;
  591. ),
  592. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, port=%u",
  593. __entry->dev, __entry->hw_id, __entry->ring,
  594. __entry->ctx, __entry->seqno,
  595. __entry->global_seqno, __entry->port)
  596. );
  597. DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in,
  598. TP_PROTO(struct drm_i915_gem_request *req, unsigned int port),
  599. TP_ARGS(req, port)
  600. );
  601. DEFINE_EVENT(i915_gem_request, i915_gem_request_out,
  602. TP_PROTO(struct drm_i915_gem_request *req),
  603. TP_ARGS(req)
  604. );
  605. #else
  606. #if !defined(TRACE_HEADER_MULTI_READ)
  607. static inline void
  608. trace_i915_gem_request_submit(struct drm_i915_gem_request *req)
  609. {
  610. }
  611. static inline void
  612. trace_i915_gem_request_execute(struct drm_i915_gem_request *req)
  613. {
  614. }
  615. static inline void
  616. trace_i915_gem_request_in(struct drm_i915_gem_request *req, unsigned int port)
  617. {
  618. }
  619. static inline void
  620. trace_i915_gem_request_out(struct drm_i915_gem_request *req)
  621. {
  622. }
  623. #endif
  624. #endif
  625. TRACE_EVENT(intel_engine_notify,
  626. TP_PROTO(struct intel_engine_cs *engine, bool waiters),
  627. TP_ARGS(engine, waiters),
  628. TP_STRUCT__entry(
  629. __field(u32, dev)
  630. __field(u32, ring)
  631. __field(u32, seqno)
  632. __field(bool, waiters)
  633. ),
  634. TP_fast_assign(
  635. __entry->dev = engine->i915->drm.primary->index;
  636. __entry->ring = engine->id;
  637. __entry->seqno = intel_engine_get_seqno(engine);
  638. __entry->waiters = waiters;
  639. ),
  640. TP_printk("dev=%u, ring=%u, seqno=%u, waiters=%u",
  641. __entry->dev, __entry->ring, __entry->seqno,
  642. __entry->waiters)
  643. );
  644. DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
  645. TP_PROTO(struct drm_i915_gem_request *req),
  646. TP_ARGS(req)
  647. );
  648. TRACE_EVENT(i915_gem_request_wait_begin,
  649. TP_PROTO(struct drm_i915_gem_request *req, unsigned int flags),
  650. TP_ARGS(req, flags),
  651. TP_STRUCT__entry(
  652. __field(u32, dev)
  653. __field(u32, hw_id)
  654. __field(u32, ring)
  655. __field(u32, ctx)
  656. __field(u32, seqno)
  657. __field(u32, global)
  658. __field(unsigned int, flags)
  659. ),
  660. /* NB: the blocking information is racy since mutex_is_locked
  661. * doesn't check that the current thread holds the lock. The only
  662. * other option would be to pass the boolean information of whether
  663. * or not the class was blocking down through the stack which is
  664. * less desirable.
  665. */
  666. TP_fast_assign(
  667. __entry->dev = req->i915->drm.primary->index;
  668. __entry->hw_id = req->ctx->hw_id;
  669. __entry->ring = req->engine->id;
  670. __entry->ctx = req->fence.context;
  671. __entry->seqno = req->fence.seqno;
  672. __entry->global = req->global_seqno;
  673. __entry->flags = flags;
  674. ),
  675. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, blocking=%u, flags=0x%x",
  676. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  677. __entry->seqno, __entry->global,
  678. !!(__entry->flags & I915_WAIT_LOCKED), __entry->flags)
  679. );
  680. DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
  681. TP_PROTO(struct drm_i915_gem_request *req),
  682. TP_ARGS(req)
  683. );
  684. TRACE_EVENT(i915_flip_request,
  685. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  686. TP_ARGS(plane, obj),
  687. TP_STRUCT__entry(
  688. __field(int, plane)
  689. __field(struct drm_i915_gem_object *, obj)
  690. ),
  691. TP_fast_assign(
  692. __entry->plane = plane;
  693. __entry->obj = obj;
  694. ),
  695. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  696. );
  697. TRACE_EVENT(i915_flip_complete,
  698. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  699. TP_ARGS(plane, obj),
  700. TP_STRUCT__entry(
  701. __field(int, plane)
  702. __field(struct drm_i915_gem_object *, obj)
  703. ),
  704. TP_fast_assign(
  705. __entry->plane = plane;
  706. __entry->obj = obj;
  707. ),
  708. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  709. );
  710. TRACE_EVENT_CONDITION(i915_reg_rw,
  711. TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
  712. TP_ARGS(write, reg, val, len, trace),
  713. TP_CONDITION(trace),
  714. TP_STRUCT__entry(
  715. __field(u64, val)
  716. __field(u32, reg)
  717. __field(u16, write)
  718. __field(u16, len)
  719. ),
  720. TP_fast_assign(
  721. __entry->val = (u64)val;
  722. __entry->reg = i915_mmio_reg_offset(reg);
  723. __entry->write = write;
  724. __entry->len = len;
  725. ),
  726. TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
  727. __entry->write ? "write" : "read",
  728. __entry->reg, __entry->len,
  729. (u32)(__entry->val & 0xffffffff),
  730. (u32)(__entry->val >> 32))
  731. );
  732. TRACE_EVENT(intel_gpu_freq_change,
  733. TP_PROTO(u32 freq),
  734. TP_ARGS(freq),
  735. TP_STRUCT__entry(
  736. __field(u32, freq)
  737. ),
  738. TP_fast_assign(
  739. __entry->freq = freq;
  740. ),
  741. TP_printk("new_freq=%u", __entry->freq)
  742. );
  743. /**
  744. * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
  745. *
  746. * With full ppgtt enabled each process using drm will allocate at least one
  747. * translation table. With these traces it is possible to keep track of the
  748. * allocation and of the lifetime of the tables; this can be used during
  749. * testing/debug to verify that we are not leaking ppgtts.
  750. * These traces identify the ppgtt through the vm pointer, which is also printed
  751. * by the i915_vma_bind and i915_vma_unbind tracepoints.
  752. */
  753. DECLARE_EVENT_CLASS(i915_ppgtt,
  754. TP_PROTO(struct i915_address_space *vm),
  755. TP_ARGS(vm),
  756. TP_STRUCT__entry(
  757. __field(struct i915_address_space *, vm)
  758. __field(u32, dev)
  759. ),
  760. TP_fast_assign(
  761. __entry->vm = vm;
  762. __entry->dev = vm->i915->drm.primary->index;
  763. ),
  764. TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
  765. )
  766. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
  767. TP_PROTO(struct i915_address_space *vm),
  768. TP_ARGS(vm)
  769. );
  770. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
  771. TP_PROTO(struct i915_address_space *vm),
  772. TP_ARGS(vm)
  773. );
  774. /**
  775. * DOC: i915_context_create and i915_context_free tracepoints
  776. *
  777. * These tracepoints are used to track creation and deletion of contexts.
  778. * If full ppgtt is enabled, they also print the address of the vm assigned to
  779. * the context.
  780. */
  781. DECLARE_EVENT_CLASS(i915_context,
  782. TP_PROTO(struct i915_gem_context *ctx),
  783. TP_ARGS(ctx),
  784. TP_STRUCT__entry(
  785. __field(u32, dev)
  786. __field(struct i915_gem_context *, ctx)
  787. __field(u32, hw_id)
  788. __field(struct i915_address_space *, vm)
  789. ),
  790. TP_fast_assign(
  791. __entry->dev = ctx->i915->drm.primary->index;
  792. __entry->ctx = ctx;
  793. __entry->hw_id = ctx->hw_id;
  794. __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
  795. ),
  796. TP_printk("dev=%u, ctx=%p, ctx_vm=%p, hw_id=%u",
  797. __entry->dev, __entry->ctx, __entry->vm, __entry->hw_id)
  798. )
  799. DEFINE_EVENT(i915_context, i915_context_create,
  800. TP_PROTO(struct i915_gem_context *ctx),
  801. TP_ARGS(ctx)
  802. );
  803. DEFINE_EVENT(i915_context, i915_context_free,
  804. TP_PROTO(struct i915_gem_context *ctx),
  805. TP_ARGS(ctx)
  806. );
  807. /**
  808. * DOC: switch_mm tracepoint
  809. *
  810. * This tracepoint allows tracking of the mm switch, which is an important point
  811. * in the lifetime of the vm in the legacy submission path. This tracepoint is
  812. * called only if full ppgtt is enabled.
  813. */
  814. TRACE_EVENT(switch_mm,
  815. TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to),
  816. TP_ARGS(engine, to),
  817. TP_STRUCT__entry(
  818. __field(u32, ring)
  819. __field(struct i915_gem_context *, to)
  820. __field(struct i915_address_space *, vm)
  821. __field(u32, dev)
  822. ),
  823. TP_fast_assign(
  824. __entry->ring = engine->id;
  825. __entry->to = to;
  826. __entry->vm = to->ppgtt? &to->ppgtt->base : NULL;
  827. __entry->dev = engine->i915->drm.primary->index;
  828. ),
  829. TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p",
  830. __entry->dev, __entry->ring, __entry->to, __entry->vm)
  831. );
  832. #endif /* _I915_TRACE_H_ */
  833. /* This part must be outside protection */
  834. #undef TRACE_INCLUDE_PATH
  835. #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
  836. #include <trace/define_trace.h>