i915_trace.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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_ringbuffer.h"
  9. #undef TRACE_SYSTEM
  10. #define TRACE_SYSTEM i915
  11. #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
  12. #define TRACE_INCLUDE_FILE i915_trace
  13. /* object tracking */
  14. TRACE_EVENT(i915_gem_object_create,
  15. TP_PROTO(struct drm_i915_gem_object *obj),
  16. TP_ARGS(obj),
  17. TP_STRUCT__entry(
  18. __field(struct drm_i915_gem_object *, obj)
  19. __field(u32, size)
  20. ),
  21. TP_fast_assign(
  22. __entry->obj = obj;
  23. __entry->size = obj->base.size;
  24. ),
  25. TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
  26. );
  27. TRACE_EVENT(i915_gem_object_bind,
  28. TP_PROTO(struct drm_i915_gem_object *obj, bool mappable),
  29. TP_ARGS(obj, mappable),
  30. TP_STRUCT__entry(
  31. __field(struct drm_i915_gem_object *, obj)
  32. __field(u32, offset)
  33. __field(u32, size)
  34. __field(bool, mappable)
  35. ),
  36. TP_fast_assign(
  37. __entry->obj = obj;
  38. __entry->offset = obj->gtt_space->start;
  39. __entry->size = obj->gtt_space->size;
  40. __entry->mappable = mappable;
  41. ),
  42. TP_printk("obj=%p, offset=%08x size=%x%s",
  43. __entry->obj, __entry->offset, __entry->size,
  44. __entry->mappable ? ", mappable" : "")
  45. );
  46. TRACE_EVENT(i915_gem_object_unbind,
  47. TP_PROTO(struct drm_i915_gem_object *obj),
  48. TP_ARGS(obj),
  49. TP_STRUCT__entry(
  50. __field(struct drm_i915_gem_object *, obj)
  51. __field(u32, offset)
  52. __field(u32, size)
  53. ),
  54. TP_fast_assign(
  55. __entry->obj = obj;
  56. __entry->offset = obj->gtt_space->start;
  57. __entry->size = obj->gtt_space->size;
  58. ),
  59. TP_printk("obj=%p, offset=%08x size=%x",
  60. __entry->obj, __entry->offset, __entry->size)
  61. );
  62. TRACE_EVENT(i915_gem_object_change_domain,
  63. TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write),
  64. TP_ARGS(obj, old_read, old_write),
  65. TP_STRUCT__entry(
  66. __field(struct drm_i915_gem_object *, obj)
  67. __field(u32, read_domains)
  68. __field(u32, write_domain)
  69. ),
  70. TP_fast_assign(
  71. __entry->obj = obj;
  72. __entry->read_domains = obj->base.read_domains | (old_read << 16);
  73. __entry->write_domain = obj->base.write_domain | (old_write << 16);
  74. ),
  75. TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
  76. __entry->obj,
  77. __entry->read_domains >> 16,
  78. __entry->read_domains & 0xffff,
  79. __entry->write_domain >> 16,
  80. __entry->write_domain & 0xffff)
  81. );
  82. TRACE_EVENT(i915_gem_object_pwrite,
  83. TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
  84. TP_ARGS(obj, offset, len),
  85. TP_STRUCT__entry(
  86. __field(struct drm_i915_gem_object *, obj)
  87. __field(u32, offset)
  88. __field(u32, len)
  89. ),
  90. TP_fast_assign(
  91. __entry->obj = obj;
  92. __entry->offset = offset;
  93. __entry->len = len;
  94. ),
  95. TP_printk("obj=%p, offset=%u, len=%u",
  96. __entry->obj, __entry->offset, __entry->len)
  97. );
  98. TRACE_EVENT(i915_gem_object_pread,
  99. TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len),
  100. TP_ARGS(obj, offset, len),
  101. TP_STRUCT__entry(
  102. __field(struct drm_i915_gem_object *, obj)
  103. __field(u32, offset)
  104. __field(u32, len)
  105. ),
  106. TP_fast_assign(
  107. __entry->obj = obj;
  108. __entry->offset = offset;
  109. __entry->len = len;
  110. ),
  111. TP_printk("obj=%p, offset=%u, len=%u",
  112. __entry->obj, __entry->offset, __entry->len)
  113. );
  114. TRACE_EVENT(i915_gem_object_fault,
  115. TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write),
  116. TP_ARGS(obj, index, gtt, write),
  117. TP_STRUCT__entry(
  118. __field(struct drm_i915_gem_object *, obj)
  119. __field(u32, index)
  120. __field(bool, gtt)
  121. __field(bool, write)
  122. ),
  123. TP_fast_assign(
  124. __entry->obj = obj;
  125. __entry->index = index;
  126. __entry->gtt = gtt;
  127. __entry->write = write;
  128. ),
  129. TP_printk("obj=%p, %s index=%u %s",
  130. __entry->obj,
  131. __entry->gtt ? "GTT" : "CPU",
  132. __entry->index,
  133. __entry->write ? ", writable" : "")
  134. );
  135. DECLARE_EVENT_CLASS(i915_gem_object,
  136. TP_PROTO(struct drm_i915_gem_object *obj),
  137. TP_ARGS(obj),
  138. TP_STRUCT__entry(
  139. __field(struct drm_i915_gem_object *, obj)
  140. ),
  141. TP_fast_assign(
  142. __entry->obj = obj;
  143. ),
  144. TP_printk("obj=%p", __entry->obj)
  145. );
  146. DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
  147. TP_PROTO(struct drm_i915_gem_object *obj),
  148. TP_ARGS(obj)
  149. );
  150. DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
  151. TP_PROTO(struct drm_i915_gem_object *obj),
  152. TP_ARGS(obj)
  153. );
  154. TRACE_EVENT(i915_gem_evict,
  155. TP_PROTO(struct drm_device *dev, u32 size, u32 align, bool mappable),
  156. TP_ARGS(dev, size, align, mappable),
  157. TP_STRUCT__entry(
  158. __field(u32, dev)
  159. __field(u32, size)
  160. __field(u32, align)
  161. __field(bool, mappable)
  162. ),
  163. TP_fast_assign(
  164. __entry->dev = dev->primary->index;
  165. __entry->size = size;
  166. __entry->align = align;
  167. __entry->mappable = mappable;
  168. ),
  169. TP_printk("dev=%d, size=%d, align=%d %s",
  170. __entry->dev, __entry->size, __entry->align,
  171. __entry->mappable ? ", mappable" : "")
  172. );
  173. TRACE_EVENT(i915_gem_evict_everything,
  174. TP_PROTO(struct drm_device *dev, bool purgeable),
  175. TP_ARGS(dev, purgeable),
  176. TP_STRUCT__entry(
  177. __field(u32, dev)
  178. __field(bool, purgeable)
  179. ),
  180. TP_fast_assign(
  181. __entry->dev = dev->primary->index;
  182. __entry->purgeable = purgeable;
  183. ),
  184. TP_printk("dev=%d%s",
  185. __entry->dev,
  186. __entry->purgeable ? ", purgeable only" : "")
  187. );
  188. TRACE_EVENT(i915_gem_ring_dispatch,
  189. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  190. TP_ARGS(ring, seqno),
  191. TP_STRUCT__entry(
  192. __field(u32, dev)
  193. __field(u32, ring)
  194. __field(u32, seqno)
  195. ),
  196. TP_fast_assign(
  197. __entry->dev = ring->dev->primary->index;
  198. __entry->ring = ring->id;
  199. __entry->seqno = seqno;
  200. i915_trace_irq_get(ring, seqno);
  201. ),
  202. TP_printk("dev=%u, ring=%u, seqno=%u",
  203. __entry->dev, __entry->ring, __entry->seqno)
  204. );
  205. TRACE_EVENT(i915_gem_ring_flush,
  206. TP_PROTO(struct intel_ring_buffer *ring, u32 invalidate, u32 flush),
  207. TP_ARGS(ring, invalidate, flush),
  208. TP_STRUCT__entry(
  209. __field(u32, dev)
  210. __field(u32, ring)
  211. __field(u32, invalidate)
  212. __field(u32, flush)
  213. ),
  214. TP_fast_assign(
  215. __entry->dev = ring->dev->primary->index;
  216. __entry->ring = ring->id;
  217. __entry->invalidate = invalidate;
  218. __entry->flush = flush;
  219. ),
  220. TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
  221. __entry->dev, __entry->ring,
  222. __entry->invalidate, __entry->flush)
  223. );
  224. DECLARE_EVENT_CLASS(i915_gem_request,
  225. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  226. TP_ARGS(ring, seqno),
  227. TP_STRUCT__entry(
  228. __field(u32, dev)
  229. __field(u32, ring)
  230. __field(u32, seqno)
  231. ),
  232. TP_fast_assign(
  233. __entry->dev = ring->dev->primary->index;
  234. __entry->ring = ring->id;
  235. __entry->seqno = seqno;
  236. ),
  237. TP_printk("dev=%u, ring=%u, seqno=%u",
  238. __entry->dev, __entry->ring, __entry->seqno)
  239. );
  240. DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
  241. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  242. TP_ARGS(ring, seqno)
  243. );
  244. DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
  245. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  246. TP_ARGS(ring, seqno)
  247. );
  248. DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
  249. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  250. TP_ARGS(ring, seqno)
  251. );
  252. DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
  253. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  254. TP_ARGS(ring, seqno)
  255. );
  256. DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
  257. TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
  258. TP_ARGS(ring, seqno)
  259. );
  260. DECLARE_EVENT_CLASS(i915_ring,
  261. TP_PROTO(struct intel_ring_buffer *ring),
  262. TP_ARGS(ring),
  263. TP_STRUCT__entry(
  264. __field(u32, dev)
  265. __field(u32, ring)
  266. ),
  267. TP_fast_assign(
  268. __entry->dev = ring->dev->primary->index;
  269. __entry->ring = ring->id;
  270. ),
  271. TP_printk("dev=%u, ring=%u", __entry->dev, __entry->ring)
  272. );
  273. DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
  274. TP_PROTO(struct intel_ring_buffer *ring),
  275. TP_ARGS(ring)
  276. );
  277. DEFINE_EVENT(i915_ring, i915_ring_wait_end,
  278. TP_PROTO(struct intel_ring_buffer *ring),
  279. TP_ARGS(ring)
  280. );
  281. TRACE_EVENT(i915_flip_request,
  282. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  283. TP_ARGS(plane, obj),
  284. TP_STRUCT__entry(
  285. __field(int, plane)
  286. __field(struct drm_i915_gem_object *, obj)
  287. ),
  288. TP_fast_assign(
  289. __entry->plane = plane;
  290. __entry->obj = obj;
  291. ),
  292. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  293. );
  294. TRACE_EVENT(i915_flip_complete,
  295. TP_PROTO(int plane, struct drm_i915_gem_object *obj),
  296. TP_ARGS(plane, obj),
  297. TP_STRUCT__entry(
  298. __field(int, plane)
  299. __field(struct drm_i915_gem_object *, obj)
  300. ),
  301. TP_fast_assign(
  302. __entry->plane = plane;
  303. __entry->obj = obj;
  304. ),
  305. TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
  306. );
  307. TRACE_EVENT(i915_reg_rw,
  308. TP_PROTO(bool write, u32 reg, u64 val, int len),
  309. TP_ARGS(write, reg, val, len),
  310. TP_STRUCT__entry(
  311. __field(u64, val)
  312. __field(u32, reg)
  313. __field(u16, write)
  314. __field(u16, len)
  315. ),
  316. TP_fast_assign(
  317. __entry->val = (u64)val;
  318. __entry->reg = reg;
  319. __entry->write = write;
  320. __entry->len = len;
  321. ),
  322. TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
  323. __entry->write ? "write" : "read",
  324. __entry->reg, __entry->len,
  325. (u32)(__entry->val & 0xffffffff),
  326. (u32)(__entry->val >> 32))
  327. );
  328. #endif /* _I915_TRACE_H_ */
  329. /* This part must be outside protection */
  330. #undef TRACE_INCLUDE_PATH
  331. #define TRACE_INCLUDE_PATH .
  332. #include <trace/define_trace.h>