i915_trace.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  2. #define _I915_TRACE_H_
  3. #include <linux/stringify.h>
  4. #include <linux/types.h>
  5. #include <linux/tracepoint.h>
  6. #include <drm/drmP.h>
  7. #include "i915_drv.h"
  8. #include "intel_drv.h"
  9. #include "intel_ringbuffer.h"
  10. #undef TRACE_SYSTEM
  11. #define TRACE_SYSTEM i915
  12. #define TRACE_INCLUDE_FILE i915_trace
  13. /* pipe updates */
  14. TRACE_EVENT(i915_pipe_update_start,
  15. TP_PROTO(struct intel_crtc *crtc),
  16. TP_ARGS(crtc),
  17. TP_STRUCT__entry(
  18. __field(enum pipe, pipe)
  19. __field(u32, frame)
  20. __field(u32, scanline)
  21. __field(u32, min)
  22. __field(u32, max)
  23. ),
  24. TP_fast_assign(
  25. __entry->pipe = crtc->pipe;
  26. __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
  27. crtc->pipe);
  28. __entry->scanline = intel_get_crtc_scanline(crtc);
  29. __entry->min = crtc->debug.min_vbl;
  30. __entry->max = crtc->debug.max_vbl;
  31. ),
  32. TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
  33. pipe_name(__entry->pipe), __entry->frame,
  34. __entry->scanline, __entry->min, __entry->max)
  35. );
  36. TRACE_EVENT(i915_pipe_update_vblank_evaded,
  37. TP_PROTO(struct intel_crtc *crtc),
  38. TP_ARGS(crtc),
  39. TP_STRUCT__entry(
  40. __field(enum pipe, pipe)
  41. __field(u32, frame)
  42. __field(u32, scanline)
  43. __field(u32, min)
  44. __field(u32, max)
  45. ),
  46. TP_fast_assign(
  47. __entry->pipe = crtc->pipe;
  48. __entry->frame = crtc->debug.start_vbl_count;
  49. __entry->scanline = crtc->debug.scanline_start;
  50. __entry->min = crtc->debug.min_vbl;
  51. __entry->max = crtc->debug.max_vbl;
  52. ),
  53. TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
  54. pipe_name(__entry->pipe), __entry->frame,
  55. __entry->scanline, __entry->min, __entry->max)
  56. );
  57. TRACE_EVENT(i915_pipe_update_end,
  58. TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
  59. TP_ARGS(crtc, frame, scanline_end),
  60. TP_STRUCT__entry(
  61. __field(enum pipe, pipe)
  62. __field(u32, frame)
  63. __field(u32, scanline)
  64. ),
  65. TP_fast_assign(
  66. __entry->pipe = crtc->pipe;
  67. __entry->frame = frame;
  68. __entry->scanline = scanline_end;
  69. ),
  70. TP_printk("pipe %c, frame=%u, scanline=%u",
  71. pipe_name(__entry->pipe), __entry->frame,
  72. __entry->scanline)
  73. );
  74. /* object tracking */
  75. TRACE_EVENT(i915_gem_object_create,
  76. TP_PROTO(struct drm_i915_gem_object *obj),
  77. TP_ARGS(obj),
  78. TP_STRUCT__entry(
  79. __field(struct drm_i915_gem_object *, obj)
  80. __field(u32, size)
  81. ),
  82. TP_fast_assign(
  83. __entry->obj = obj;
  84. __entry->size = obj->base.size;
  85. ),
  86. TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
  87. );
  88. TRACE_EVENT(i915_gem_shrink,
  89. TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
  90. TP_ARGS(i915, target, flags),
  91. TP_STRUCT__entry(
  92. __field(int, dev)
  93. __field(unsigned long, target)
  94. __field(unsigned, flags)
  95. ),
  96. TP_fast_assign(
  97. __entry->dev = i915->dev->primary->index;
  98. __entry->target = target;
  99. __entry->flags = flags;
  100. ),
  101. TP_printk("dev=%d, target=%lu, flags=%x",
  102. __entry->dev, __entry->target, __entry->flags)
  103. );
  104. TRACE_EVENT(i915_vma_bind,
  105. TP_PROTO(struct i915_vma *vma, unsigned flags),
  106. TP_ARGS(vma, flags),
  107. TP_STRUCT__entry(
  108. __field(struct drm_i915_gem_object *, obj)
  109. __field(struct i915_address_space *, vm)
  110. __field(u64, offset)
  111. __field(u32, size)
  112. __field(unsigned, flags)
  113. ),
  114. TP_fast_assign(
  115. __entry->obj = vma->obj;
  116. __entry->vm = vma->vm;
  117. __entry->offset = vma->node.start;
  118. __entry->size = vma->node.size;
  119. __entry->flags = flags;
  120. ),
  121. TP_printk("obj=%p, offset=%016llx size=%x%s vm=%p",
  122. __entry->obj, __entry->offset, __entry->size,
  123. __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
  124. __entry->vm)
  125. );
  126. TRACE_EVENT(i915_vma_unbind,
  127. TP_PROTO(struct i915_vma *vma),
  128. TP_ARGS(vma),
  129. TP_STRUCT__entry(
  130. __field(struct drm_i915_gem_object *, obj)
  131. __field(struct i915_address_space *, vm)
  132. __field(u64, offset)
  133. __field(u32, size)
  134. ),
  135. TP_fast_assign(
  136. __entry->obj = vma->obj;
  137. __entry->vm = vma->vm;
  138. __entry->offset = vma->node.start;
  139. __entry->size = vma->node.size;
  140. ),
  141. TP_printk("obj=%p, offset=%016llx size=%x vm=%p",
  142. __entry->obj, __entry->offset, __entry->size, __entry->vm)
  143. );
  144. #define VM_TO_TRACE_NAME(vm) \
  145. (i915_is_ggtt(vm) ? "G" : \
  146. "P")
  147. DECLARE_EVENT_CLASS(i915_va,
  148. TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name),
  149. TP_ARGS(vm, start, length, name),
  150. TP_STRUCT__entry(
  151. __field(struct i915_address_space *, vm)
  152. __field(u64, start)
  153. __field(u64, end)
  154. __string(name, name)
  155. ),
  156. TP_fast_assign(
  157. __entry->vm = vm;
  158. __entry->start = start;
  159. __entry->end = start + length - 1;
  160. __assign_str(name, name);
  161. ),
  162. TP_printk("vm=%p (%s), 0x%llx-0x%llx",
  163. __entry->vm, __get_str(name), __entry->start, __entry->end)
  164. );
  165. DEFINE_EVENT(i915_va, i915_va_alloc,
  166. TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name),
  167. TP_ARGS(vm, start, length, name)
  168. );
  169. DECLARE_EVENT_CLASS(i915_px_entry,
  170. TP_PROTO(struct i915_address_space *vm, u32 px, u64 start, u64 px_shift),
  171. TP_ARGS(vm, px, start, px_shift),
  172. TP_STRUCT__entry(
  173. __field(struct i915_address_space *, vm)
  174. __field(u32, px)
  175. __field(u64, start)
  176. __field(u64, end)
  177. ),
  178. TP_fast_assign(
  179. __entry->vm = vm;
  180. __entry->px = px;
  181. __entry->start = start;
  182. __entry->end = ((start + (1ULL << px_shift)) & ~((1ULL << px_shift)-1)) - 1;
  183. ),
  184. TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)",
  185. __entry->vm, __entry->px, __entry->start, __entry->end)
  186. );
  187. DEFINE_EVENT(i915_px_entry, i915_page_table_entry_alloc,
  188. TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift),
  189. TP_ARGS(vm, pde, start, pde_shift)
  190. );
  191. DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_entry_alloc,
  192. TP_PROTO(struct i915_address_space *vm, u32 pdpe, u64 start, u64 pdpe_shift),
  193. TP_ARGS(vm, pdpe, start, pdpe_shift),
  194. TP_printk("vm=%p, pdpe=%d (0x%llx-0x%llx)",
  195. __entry->vm, __entry->px, __entry->start, __entry->end)
  196. );
  197. DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_pointer_entry_alloc,
  198. TP_PROTO(struct i915_address_space *vm, u32 pml4e, u64 start, u64 pml4e_shift),
  199. TP_ARGS(vm, pml4e, start, pml4e_shift),
  200. TP_printk("vm=%p, pml4e=%d (0x%llx-0x%llx)",
  201. __entry->vm, __entry->px, __entry->start, __entry->end)
  202. );
  203. /* Avoid extra math because we only support two sizes. The format is defined by
  204. * bitmap_scnprintf. Each 32 bits is 8 HEX digits followed by comma */
  205. #define TRACE_PT_SIZE(bits) \
  206. ((((bits) == 1024) ? 288 : 144) + 1)
  207. DECLARE_EVENT_CLASS(i915_page_table_entry_update,
  208. TP_PROTO(struct i915_address_space *vm, u32 pde,
  209. struct i915_page_table *pt, u32 first, u32 count, u32 bits),
  210. TP_ARGS(vm, pde, pt, first, count, bits),
  211. TP_STRUCT__entry(
  212. __field(struct i915_address_space *, vm)
  213. __field(u32, pde)
  214. __field(u32, first)
  215. __field(u32, last)
  216. __dynamic_array(char, cur_ptes, TRACE_PT_SIZE(bits))
  217. ),
  218. TP_fast_assign(
  219. __entry->vm = vm;
  220. __entry->pde = pde;
  221. __entry->first = first;
  222. __entry->last = first + count - 1;
  223. scnprintf(__get_str(cur_ptes),
  224. TRACE_PT_SIZE(bits),
  225. "%*pb",
  226. bits,
  227. pt->used_ptes);
  228. ),
  229. TP_printk("vm=%p, pde=%d, updating %u:%u\t%s",
  230. __entry->vm, __entry->pde, __entry->last, __entry->first,
  231. __get_str(cur_ptes))
  232. );
  233. DEFINE_EVENT(i915_page_table_entry_update, i915_page_table_entry_map,
  234. TP_PROTO(struct i915_address_space *vm, u32 pde,
  235. struct i915_page_table *pt, u32 first, u32 count, u32 bits),
  236. TP_ARGS(vm, pde, pt, first, count, bits)
  237. );
  238. TRACE_EVENT(i915_gem_object_change_domain,
  239. TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write),
  240. TP_ARGS(obj, old_read, old_write),
  241. TP_STRUCT__entry(
  242. __field(struct drm_i915_gem_object *, obj)
  243. __field(u32, read_domains)
  244. __field(u32, write_domain)
  245. ),
  246. TP_fast_assign(
  247. __entry->obj = obj;
  248. __entry->read_domains = obj->base.read_domains | (old_read << 16);
  249. __entry->write_domain = obj->base.write_domain | (old_write << 16);
  250. ),
  251. TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
  252. __entry->obj,
  253. __entry->read_domains >> 16,
  254. __entry->read_domains & 0xffff,
  255. __entry->write_domain >> 16,
  256. __entry->write_domain & 0xffff)
  257. );
  258. TRACE_EVENT(i915_gem_object_pwrite,
  259. TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
  260. TP_ARGS(obj, offset, len),
  261. TP_STRUCT__entry(
  262. __field(struct drm_i915_gem_object *, obj)
  263. __field(u32, offset)
  264. __field(u32, len)
  265. ),
  266. TP_fast_assign(
  267. __entry->obj = obj;
  268. __entry->offset = offset;
  269. __entry->len = len;
  270. ),
  271. TP_printk("obj=%p, offset=%u, len=%u",
  272. __entry->obj, __entry->offset, __entry->len)
  273. );
  274. TRACE_EVENT(i915_gem_object_pread,
  275. TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
  276. TP_ARGS(obj, offset, len),
  277. TP_STRUCT__entry(
  278. __field(struct drm_i915_gem_object *, obj)
  279. __field(u32, offset)
  280. __field(u32, len)
  281. ),
  282. TP_fast_assign(
  283. __entry->obj = obj;
  284. __entry->offset = offset;
  285. __entry->len = len;
  286. ),
  287. TP_printk("obj=%p, offset=%u, len=%u",
  288. __entry->obj, __entry->offset, __entry->len)
  289. );
  290. TRACE_EVENT(i915_gem_object_fault,
  291. TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write),
  292. TP_ARGS(obj, index, gtt, write),
  293. TP_STRUCT__entry(
  294. __field(struct drm_i915_gem_object *, obj)
  295. __field(u32, index)
  296. __field(bool, gtt)
  297. __field(bool, write)
  298. ),
  299. TP_fast_assign(
  300. __entry->obj = obj;
  301. __entry->index = index;
  302. __entry->gtt = gtt;
  303. __entry->write = write;
  304. ),
  305. TP_printk("obj=%p, %s index=%u %s",
  306. __entry->obj,
  307. __entry->gtt ? "GTT" : "CPU",
  308. __entry->index,
  309. __entry->write ? ", writable" : "")
  310. );
  311. DECLARE_EVENT_CLASS(i915_gem_object,
  312. TP_PROTO(struct drm_i915_gem_object *obj),
  313. TP_ARGS(obj),
  314. TP_STRUCT__entry(
  315. __field(struct drm_i915_gem_object *, obj)
  316. ),
  317. TP_fast_assign(
  318. __entry->obj = obj;
  319. ),
  320. TP_printk("obj=%p", __entry->obj)
  321. );
  322. DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
  323. TP_PROTO(struct drm_i915_gem_object *obj),
  324. TP_ARGS(obj)
  325. );
  326. DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
  327. TP_PROTO(struct drm_i915_gem_object *obj),
  328. TP_ARGS(obj)
  329. );
  330. TRACE_EVENT(i915_gem_evict,
  331. TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags),
  332. TP_ARGS(dev, size, align, flags),
  333. TP_STRUCT__entry(
  334. __field(u32, dev)
  335. __field(u32, size)
  336. __field(u32, align)
  337. __field(unsigned, flags)
  338. ),
  339. TP_fast_assign(
  340. __entry->dev = dev->primary->index;
  341. __entry->size = size;
  342. __entry->align = align;
  343. __entry->flags = flags;
  344. ),
  345. TP_printk("dev=%d, size=%d, align=%d %s",
  346. __entry->dev, __entry->size, __entry->align,
  347. __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
  348. );
  349. TRACE_EVENT(i915_gem_evict_everything,
  350. TP_PROTO(struct drm_device *dev),
  351. TP_ARGS(dev),
  352. TP_STRUCT__entry(
  353. __field(u32, dev)
  354. ),
  355. TP_fast_assign(
  356. __entry->dev = dev->primary->index;
  357. ),
  358. TP_printk("dev=%d", __entry->dev)
  359. );
  360. TRACE_EVENT(i915_gem_evict_vm,
  361. TP_PROTO(struct i915_address_space *vm),
  362. TP_ARGS(vm),
  363. TP_STRUCT__entry(
  364. __field(u32, dev)
  365. __field(struct i915_address_space *, vm)
  366. ),
  367. TP_fast_assign(
  368. __entry->dev = vm->dev->primary->index;
  369. __entry->vm = vm;
  370. ),
  371. TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
  372. );
  373. TRACE_EVENT(i915_gem_ring_sync_to,
  374. TP_PROTO(struct drm_i915_gem_request *to_req,
  375. struct intel_engine_cs *from,
  376. struct drm_i915_gem_request *req),
  377. TP_ARGS(to_req, from, req),
  378. TP_STRUCT__entry(
  379. __field(u32, dev)
  380. __field(u32, sync_from)
  381. __field(u32, sync_to)
  382. __field(u32, seqno)
  383. ),
  384. TP_fast_assign(
  385. __entry->dev = from->dev->primary->index;
  386. __entry->sync_from = from->id;
  387. __entry->sync_to = to_req->ring->id;
  388. __entry->seqno = i915_gem_request_get_seqno(req);
  389. ),
  390. TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u",
  391. __entry->dev,
  392. __entry->sync_from, __entry->sync_to,
  393. __entry->seqno)
  394. );
  395. TRACE_EVENT(i915_gem_ring_dispatch,
  396. TP_PROTO(struct drm_i915_gem_request *req, u32 flags),
  397. TP_ARGS(req, flags),
  398. TP_STRUCT__entry(
  399. __field(u32, dev)
  400. __field(u32, ring)
  401. __field(u32, seqno)
  402. __field(u32, flags)
  403. ),
  404. TP_fast_assign(
  405. struct intel_engine_cs *ring =
  406. i915_gem_request_get_ring(req);
  407. __entry->dev = ring->dev->primary->index;
  408. __entry->ring = ring->id;
  409. __entry->seqno = i915_gem_request_get_seqno(req);
  410. __entry->flags = flags;
  411. i915_trace_irq_get(ring, req);
  412. ),
  413. TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
  414. __entry->dev, __entry->ring, __entry->seqno, __entry->flags)
  415. );
  416. TRACE_EVENT(i915_gem_ring_flush,
  417. TP_PROTO(struct drm_i915_gem_request *req, u32 invalidate, u32 flush),
  418. TP_ARGS(req, invalidate, flush),
  419. TP_STRUCT__entry(
  420. __field(u32, dev)
  421. __field(u32, ring)
  422. __field(u32, invalidate)
  423. __field(u32, flush)
  424. ),
  425. TP_fast_assign(
  426. __entry->dev = req->ring->dev->primary->index;
  427. __entry->ring = req->ring->id;
  428. __entry->invalidate = invalidate;
  429. __entry->flush = flush;
  430. ),
  431. TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
  432. __entry->dev, __entry->ring,
  433. __entry->invalidate, __entry->flush)
  434. );
  435. DECLARE_EVENT_CLASS(i915_gem_request,
  436. TP_PROTO(struct drm_i915_gem_request *req),
  437. TP_ARGS(req),
  438. TP_STRUCT__entry(
  439. __field(u32, dev)
  440. __field(u32, ring)
  441. __field(u32, seqno)
  442. ),
  443. TP_fast_assign(
  444. struct intel_engine_cs *ring =
  445. i915_gem_request_get_ring(req);
  446. __entry->dev = ring->dev->primary->index;
  447. __entry->ring = ring->id;
  448. __entry->seqno = i915_gem_request_get_seqno(req);
  449. ),
  450. TP_printk("dev=%u, ring=%u, seqno=%u",
  451. __entry->dev, __entry->ring, __entry->seqno)
  452. );
  453. DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
  454. TP_PROTO(struct drm_i915_gem_request *req),
  455. TP_ARGS(req)
  456. );
  457. TRACE_EVENT(i915_gem_request_notify,
  458. TP_PROTO(struct intel_engine_cs *ring),
  459. TP_ARGS(ring),
  460. TP_STRUCT__entry(
  461. __field(u32, dev)
  462. __field(u32, ring)
  463. __field(u32, seqno)
  464. ),
  465. TP_fast_assign(
  466. __entry->dev = ring->dev->primary->index;
  467. __entry->ring = ring->id;
  468. __entry->seqno = ring->get_seqno(ring, false);
  469. ),
  470. TP_printk("dev=%u, ring=%u, seqno=%u",
  471. __entry->dev, __entry->ring, __entry->seqno)
  472. );
  473. DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
  474. TP_PROTO(struct drm_i915_gem_request *req),
  475. TP_ARGS(req)
  476. );
  477. DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
  478. TP_PROTO(struct drm_i915_gem_request *req),
  479. TP_ARGS(req)
  480. );
  481. TRACE_EVENT(i915_gem_request_wait_begin,
  482. TP_PROTO(struct drm_i915_gem_request *req),
  483. TP_ARGS(req),
  484. TP_STRUCT__entry(
  485. __field(u32, dev)
  486. __field(u32, ring)
  487. __field(u32, seqno)
  488. __field(bool, blocking)
  489. ),
  490. /* NB: the blocking information is racy since mutex_is_locked
  491. * doesn't check that the current thread holds the lock. The only
  492. * other option would be to pass the boolean information of whether
  493. * or not the class was blocking down through the stack which is
  494. * less desirable.
  495. */
  496. TP_fast_assign(
  497. struct intel_engine_cs *ring =
  498. i915_gem_request_get_ring(req);
  499. __entry->dev = ring->dev->primary->index;
  500. __entry->ring = ring->id;
  501. __entry->seqno = i915_gem_request_get_seqno(req);
  502. __entry->blocking =
  503. mutex_is_locked(&ring->dev->struct_mutex);
  504. ),
  505. TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
  506. __entry->dev, __entry->ring,
  507. __entry->seqno, __entry->blocking ? "yes (NB)" : "no")
  508. );
  509. DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
  510. TP_PROTO(struct drm_i915_gem_request *req),
  511. TP_ARGS(req)
  512. );
  513. TRACE_EVENT(i915_flip_request,
  514. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  515. TP_ARGS(plane, obj),
  516. TP_STRUCT__entry(
  517. __field(int, plane)
  518. __field(struct drm_i915_gem_object *, obj)
  519. ),
  520. TP_fast_assign(
  521. __entry->plane = plane;
  522. __entry->obj = obj;
  523. ),
  524. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  525. );
  526. TRACE_EVENT(i915_flip_complete,
  527. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  528. TP_ARGS(plane, obj),
  529. TP_STRUCT__entry(
  530. __field(int, plane)
  531. __field(struct drm_i915_gem_object *, obj)
  532. ),
  533. TP_fast_assign(
  534. __entry->plane = plane;
  535. __entry->obj = obj;
  536. ),
  537. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  538. );
  539. TRACE_EVENT_CONDITION(i915_reg_rw,
  540. TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace),
  541. TP_ARGS(write, reg, val, len, trace),
  542. TP_CONDITION(trace),
  543. TP_STRUCT__entry(
  544. __field(u64, val)
  545. __field(u32, reg)
  546. __field(u16, write)
  547. __field(u16, len)
  548. ),
  549. TP_fast_assign(
  550. __entry->val = (u64)val;
  551. __entry->reg = reg;
  552. __entry->write = write;
  553. __entry->len = len;
  554. ),
  555. TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
  556. __entry->write ? "write" : "read",
  557. __entry->reg, __entry->len,
  558. (u32)(__entry->val & 0xffffffff),
  559. (u32)(__entry->val >> 32))
  560. );
  561. TRACE_EVENT(intel_gpu_freq_change,
  562. TP_PROTO(u32 freq),
  563. TP_ARGS(freq),
  564. TP_STRUCT__entry(
  565. __field(u32, freq)
  566. ),
  567. TP_fast_assign(
  568. __entry->freq = freq;
  569. ),
  570. TP_printk("new_freq=%u", __entry->freq)
  571. );
  572. /**
  573. * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
  574. *
  575. * With full ppgtt enabled each process using drm will allocate at least one
  576. * translation table. With these traces it is possible to keep track of the
  577. * allocation and of the lifetime of the tables; this can be used during
  578. * testing/debug to verify that we are not leaking ppgtts.
  579. * These traces identify the ppgtt through the vm pointer, which is also printed
  580. * by the i915_vma_bind and i915_vma_unbind tracepoints.
  581. */
  582. DECLARE_EVENT_CLASS(i915_ppgtt,
  583. TP_PROTO(struct i915_address_space *vm),
  584. TP_ARGS(vm),
  585. TP_STRUCT__entry(
  586. __field(struct i915_address_space *, vm)
  587. __field(u32, dev)
  588. ),
  589. TP_fast_assign(
  590. __entry->vm = vm;
  591. __entry->dev = vm->dev->primary->index;
  592. ),
  593. TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
  594. )
  595. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
  596. TP_PROTO(struct i915_address_space *vm),
  597. TP_ARGS(vm)
  598. );
  599. DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
  600. TP_PROTO(struct i915_address_space *vm),
  601. TP_ARGS(vm)
  602. );
  603. /**
  604. * DOC: i915_context_create and i915_context_free tracepoints
  605. *
  606. * These tracepoints are used to track creation and deletion of contexts.
  607. * If full ppgtt is enabled, they also print the address of the vm assigned to
  608. * the context.
  609. */
  610. DECLARE_EVENT_CLASS(i915_context,
  611. TP_PROTO(struct intel_context *ctx),
  612. TP_ARGS(ctx),
  613. TP_STRUCT__entry(
  614. __field(u32, dev)
  615. __field(struct intel_context *, ctx)
  616. __field(struct i915_address_space *, vm)
  617. ),
  618. TP_fast_assign(
  619. __entry->ctx = ctx;
  620. __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
  621. __entry->dev = ctx->i915->dev->primary->index;
  622. ),
  623. TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
  624. __entry->dev, __entry->ctx, __entry->vm)
  625. )
  626. DEFINE_EVENT(i915_context, i915_context_create,
  627. TP_PROTO(struct intel_context *ctx),
  628. TP_ARGS(ctx)
  629. );
  630. DEFINE_EVENT(i915_context, i915_context_free,
  631. TP_PROTO(struct intel_context *ctx),
  632. TP_ARGS(ctx)
  633. );
  634. /**
  635. * DOC: switch_mm tracepoint
  636. *
  637. * This tracepoint allows tracking of the mm switch, which is an important point
  638. * in the lifetime of the vm in the legacy submission path. This tracepoint is
  639. * called only if full ppgtt is enabled.
  640. */
  641. TRACE_EVENT(switch_mm,
  642. TP_PROTO(struct intel_engine_cs *ring, struct intel_context *to),
  643. TP_ARGS(ring, to),
  644. TP_STRUCT__entry(
  645. __field(u32, ring)
  646. __field(struct intel_context *, to)
  647. __field(struct i915_address_space *, vm)
  648. __field(u32, dev)
  649. ),
  650. TP_fast_assign(
  651. __entry->ring = ring->id;
  652. __entry->to = to;
  653. __entry->vm = to->ppgtt? &to->ppgtt->base : NULL;
  654. __entry->dev = ring->dev->primary->index;
  655. ),
  656. TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p",
  657. __entry->dev, __entry->ring, __entry->to, __entry->vm)
  658. );
  659. #endif /* _I915_TRACE_H_ */
  660. /* This part must be outside protection */
  661. #undef TRACE_INCLUDE_PATH
  662. #define TRACE_INCLUDE_PATH .
  663. #include <trace/define_trace.h>