i915_trace.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  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 i915_request *to, struct i915_request *from),
  492. TP_ARGS(to, from),
  493. TP_STRUCT__entry(
  494. __field(u32, dev)
  495. __field(u32, sync_from)
  496. __field(u32, sync_to)
  497. __field(u32, seqno)
  498. ),
  499. TP_fast_assign(
  500. __entry->dev = from->i915->drm.primary->index;
  501. __entry->sync_from = from->engine->id;
  502. __entry->sync_to = to->engine->id;
  503. __entry->seqno = from->global_seqno;
  504. ),
  505. TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u",
  506. __entry->dev,
  507. __entry->sync_from, __entry->sync_to,
  508. __entry->seqno)
  509. );
  510. TRACE_EVENT(i915_request_queue,
  511. TP_PROTO(struct i915_request *rq, u32 flags),
  512. TP_ARGS(rq, flags),
  513. TP_STRUCT__entry(
  514. __field(u32, dev)
  515. __field(u32, hw_id)
  516. __field(u32, ring)
  517. __field(u32, ctx)
  518. __field(u32, seqno)
  519. __field(u32, flags)
  520. ),
  521. TP_fast_assign(
  522. __entry->dev = rq->i915->drm.primary->index;
  523. __entry->hw_id = rq->ctx->hw_id;
  524. __entry->ring = rq->engine->id;
  525. __entry->ctx = rq->fence.context;
  526. __entry->seqno = rq->fence.seqno;
  527. __entry->flags = flags;
  528. ),
  529. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, flags=0x%x",
  530. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  531. __entry->seqno, __entry->flags)
  532. );
  533. DECLARE_EVENT_CLASS(i915_request,
  534. TP_PROTO(struct i915_request *rq),
  535. TP_ARGS(rq),
  536. TP_STRUCT__entry(
  537. __field(u32, dev)
  538. __field(u32, hw_id)
  539. __field(u32, ring)
  540. __field(u32, ctx)
  541. __field(u32, seqno)
  542. __field(u32, global)
  543. ),
  544. TP_fast_assign(
  545. __entry->dev = rq->i915->drm.primary->index;
  546. __entry->hw_id = rq->ctx->hw_id;
  547. __entry->ring = rq->engine->id;
  548. __entry->ctx = rq->fence.context;
  549. __entry->seqno = rq->fence.seqno;
  550. __entry->global = rq->global_seqno;
  551. ),
  552. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u",
  553. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  554. __entry->seqno, __entry->global)
  555. );
  556. DEFINE_EVENT(i915_request, i915_request_add,
  557. TP_PROTO(struct i915_request *rq),
  558. TP_ARGS(rq)
  559. );
  560. #if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
  561. DEFINE_EVENT(i915_request, i915_request_submit,
  562. TP_PROTO(struct i915_request *rq),
  563. TP_ARGS(rq)
  564. );
  565. DEFINE_EVENT(i915_request, i915_request_execute,
  566. TP_PROTO(struct i915_request *rq),
  567. TP_ARGS(rq)
  568. );
  569. TRACE_EVENT(i915_request_in,
  570. TP_PROTO(struct i915_request *rq, unsigned int port),
  571. TP_ARGS(rq, port),
  572. TP_STRUCT__entry(
  573. __field(u32, dev)
  574. __field(u32, hw_id)
  575. __field(u32, ring)
  576. __field(u32, ctx)
  577. __field(u32, seqno)
  578. __field(u32, global_seqno)
  579. __field(u32, port)
  580. __field(u32, prio)
  581. ),
  582. TP_fast_assign(
  583. __entry->dev = rq->i915->drm.primary->index;
  584. __entry->hw_id = rq->ctx->hw_id;
  585. __entry->ring = rq->engine->id;
  586. __entry->ctx = rq->fence.context;
  587. __entry->seqno = rq->fence.seqno;
  588. __entry->global_seqno = rq->global_seqno;
  589. __entry->prio = rq->sched.attr.priority;
  590. __entry->port = port;
  591. ),
  592. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, prio=%u, global=%u, port=%u",
  593. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  594. __entry->seqno, __entry->prio, __entry->global_seqno,
  595. __entry->port)
  596. );
  597. TRACE_EVENT(i915_request_out,
  598. TP_PROTO(struct i915_request *rq),
  599. TP_ARGS(rq),
  600. TP_STRUCT__entry(
  601. __field(u32, dev)
  602. __field(u32, hw_id)
  603. __field(u32, ring)
  604. __field(u32, ctx)
  605. __field(u32, seqno)
  606. __field(u32, global_seqno)
  607. __field(u32, completed)
  608. ),
  609. TP_fast_assign(
  610. __entry->dev = rq->i915->drm.primary->index;
  611. __entry->hw_id = rq->ctx->hw_id;
  612. __entry->ring = rq->engine->id;
  613. __entry->ctx = rq->fence.context;
  614. __entry->seqno = rq->fence.seqno;
  615. __entry->global_seqno = rq->global_seqno;
  616. __entry->completed = i915_request_completed(rq);
  617. ),
  618. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, completed?=%u",
  619. __entry->dev, __entry->hw_id, __entry->ring,
  620. __entry->ctx, __entry->seqno,
  621. __entry->global_seqno, __entry->completed)
  622. );
  623. #else
  624. #if !defined(TRACE_HEADER_MULTI_READ)
  625. static inline void
  626. trace_i915_request_submit(struct i915_request *rq)
  627. {
  628. }
  629. static inline void
  630. trace_i915_request_execute(struct i915_request *rq)
  631. {
  632. }
  633. static inline void
  634. trace_i915_request_in(struct i915_request *rq, unsigned int port)
  635. {
  636. }
  637. static inline void
  638. trace_i915_request_out(struct i915_request *rq)
  639. {
  640. }
  641. #endif
  642. #endif
  643. TRACE_EVENT(intel_engine_notify,
  644. TP_PROTO(struct intel_engine_cs *engine, bool waiters),
  645. TP_ARGS(engine, waiters),
  646. TP_STRUCT__entry(
  647. __field(u32, dev)
  648. __field(u32, ring)
  649. __field(u32, seqno)
  650. __field(bool, waiters)
  651. ),
  652. TP_fast_assign(
  653. __entry->dev = engine->i915->drm.primary->index;
  654. __entry->ring = engine->id;
  655. __entry->seqno = intel_engine_get_seqno(engine);
  656. __entry->waiters = waiters;
  657. ),
  658. TP_printk("dev=%u, ring=%u, seqno=%u, waiters=%u",
  659. __entry->dev, __entry->ring, __entry->seqno,
  660. __entry->waiters)
  661. );
  662. DEFINE_EVENT(i915_request, i915_request_retire,
  663. TP_PROTO(struct i915_request *rq),
  664. TP_ARGS(rq)
  665. );
  666. TRACE_EVENT(i915_request_wait_begin,
  667. TP_PROTO(struct i915_request *rq, unsigned int flags),
  668. TP_ARGS(rq, flags),
  669. TP_STRUCT__entry(
  670. __field(u32, dev)
  671. __field(u32, hw_id)
  672. __field(u32, ring)
  673. __field(u32, ctx)
  674. __field(u32, seqno)
  675. __field(u32, global)
  676. __field(unsigned int, flags)
  677. ),
  678. /* NB: the blocking information is racy since mutex_is_locked
  679. * doesn't check that the current thread holds the lock. The only
  680. * other option would be to pass the boolean information of whether
  681. * or not the class was blocking down through the stack which is
  682. * less desirable.
  683. */
  684. TP_fast_assign(
  685. __entry->dev = rq->i915->drm.primary->index;
  686. __entry->hw_id = rq->ctx->hw_id;
  687. __entry->ring = rq->engine->id;
  688. __entry->ctx = rq->fence.context;
  689. __entry->seqno = rq->fence.seqno;
  690. __entry->global = rq->global_seqno;
  691. __entry->flags = flags;
  692. ),
  693. TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, blocking=%u, flags=0x%x",
  694. __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
  695. __entry->seqno, __entry->global,
  696. !!(__entry->flags & I915_WAIT_LOCKED), __entry->flags)
  697. );
  698. DEFINE_EVENT(i915_request, i915_request_wait_end,
  699. TP_PROTO(struct i915_request *rq),
  700. TP_ARGS(rq)
  701. );
  702. TRACE_EVENT_CONDITION(i915_reg_rw,
  703. TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
  704. TP_ARGS(write, reg, val, len, trace),
  705. TP_CONDITION(trace),
  706. TP_STRUCT__entry(
  707. __field(u64, val)
  708. __field(u32, reg)
  709. __field(u16, write)
  710. __field(u16, len)
  711. ),
  712. TP_fast_assign(
  713. __entry->val = (u64)val;
  714. __entry->reg = i915_mmio_reg_offset(reg);
  715. __entry->write = write;
  716. __entry->len = len;
  717. ),
  718. TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
  719. __entry->write ? "write" : "read",
  720. __entry->reg, __entry->len,
  721. (u32)(__entry->val & 0xffffffff),
  722. (u32)(__entry->val >> 32))
  723. );
  724. TRACE_EVENT(intel_gpu_freq_change,
  725. TP_PROTO(u32 freq),
  726. TP_ARGS(freq),
  727. TP_STRUCT__entry(
  728. __field(u32, freq)
  729. ),
  730. TP_fast_assign(
  731. __entry->freq = freq;
  732. ),
  733. TP_printk("new_freq=%u", __entry->freq)
  734. );
  735. /**
  736. * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
  737. *
  738. * With full ppgtt enabled each process using drm will allocate at least one
  739. * translation table. With these traces it is possible to keep track of the
  740. * allocation and of the lifetime of the tables; this can be used during
  741. * testing/debug to verify that we are not leaking ppgtts.
  742. * These traces identify the ppgtt through the vm pointer, which is also printed
  743. * by the i915_vma_bind and i915_vma_unbind tracepoints.
  744. */
  745. DECLARE_EVENT_CLASS(i915_ppgtt,
  746. TP_PROTO(struct i915_address_space *vm),
  747. TP_ARGS(vm),
  748. TP_STRUCT__entry(
  749. __field(struct i915_address_space *, vm)
  750. __field(u32, dev)
  751. ),
  752. TP_fast_assign(
  753. __entry->vm = vm;
  754. __entry->dev = vm->i915->drm.primary->index;
  755. ),
  756. TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
  757. )
  758. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
  759. TP_PROTO(struct i915_address_space *vm),
  760. TP_ARGS(vm)
  761. );
  762. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
  763. TP_PROTO(struct i915_address_space *vm),
  764. TP_ARGS(vm)
  765. );
  766. /**
  767. * DOC: i915_context_create and i915_context_free tracepoints
  768. *
  769. * These tracepoints are used to track creation and deletion of contexts.
  770. * If full ppgtt is enabled, they also print the address of the vm assigned to
  771. * the context.
  772. */
  773. DECLARE_EVENT_CLASS(i915_context,
  774. TP_PROTO(struct i915_gem_context *ctx),
  775. TP_ARGS(ctx),
  776. TP_STRUCT__entry(
  777. __field(u32, dev)
  778. __field(struct i915_gem_context *, ctx)
  779. __field(u32, hw_id)
  780. __field(struct i915_address_space *, vm)
  781. ),
  782. TP_fast_assign(
  783. __entry->dev = ctx->i915->drm.primary->index;
  784. __entry->ctx = ctx;
  785. __entry->hw_id = ctx->hw_id;
  786. __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
  787. ),
  788. TP_printk("dev=%u, ctx=%p, ctx_vm=%p, hw_id=%u",
  789. __entry->dev, __entry->ctx, __entry->vm, __entry->hw_id)
  790. )
  791. DEFINE_EVENT(i915_context, i915_context_create,
  792. TP_PROTO(struct i915_gem_context *ctx),
  793. TP_ARGS(ctx)
  794. );
  795. DEFINE_EVENT(i915_context, i915_context_free,
  796. TP_PROTO(struct i915_gem_context *ctx),
  797. TP_ARGS(ctx)
  798. );
  799. /**
  800. * DOC: switch_mm tracepoint
  801. *
  802. * This tracepoint allows tracking of the mm switch, which is an important point
  803. * in the lifetime of the vm in the legacy submission path. This tracepoint is
  804. * called only if full ppgtt is enabled.
  805. */
  806. TRACE_EVENT(switch_mm,
  807. TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to),
  808. TP_ARGS(engine, to),
  809. TP_STRUCT__entry(
  810. __field(u32, ring)
  811. __field(struct i915_gem_context *, to)
  812. __field(struct i915_address_space *, vm)
  813. __field(u32, dev)
  814. ),
  815. TP_fast_assign(
  816. __entry->ring = engine->id;
  817. __entry->to = to;
  818. __entry->vm = to->ppgtt? &to->ppgtt->base : NULL;
  819. __entry->dev = engine->i915->drm.primary->index;
  820. ),
  821. TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p",
  822. __entry->dev, __entry->ring, __entry->to, __entry->vm)
  823. );
  824. #endif /* _I915_TRACE_H_ */
  825. /* This part must be outside protection */
  826. #undef TRACE_INCLUDE_PATH
  827. #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
  828. #include <trace/define_trace.h>