adreno_trace.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #if !defined(_ADRENO_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  14. #define _ADRENO_TRACE_H
  15. #undef TRACE_SYSTEM
  16. #define TRACE_SYSTEM kgsl
  17. #undef TRACE_INCLUDE_PATH
  18. #define TRACE_INCLUDE_PATH .
  19. #define TRACE_INCLUDE_FILE adreno_trace
  20. #include <linux/tracepoint.h>
  21. TRACE_EVENT(adreno_cmdbatch_queued,
  22. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, unsigned int queued),
  23. TP_ARGS(cmdbatch, queued),
  24. TP_STRUCT__entry(
  25. __field(unsigned int, id)
  26. __field(unsigned int, timestamp)
  27. __field(unsigned int, queued)
  28. __field(unsigned int, flags)
  29. ),
  30. TP_fast_assign(
  31. __entry->id = cmdbatch->context->id;
  32. __entry->timestamp = cmdbatch->timestamp;
  33. __entry->queued = queued;
  34. __entry->flags = cmdbatch->flags;
  35. ),
  36. TP_printk(
  37. "ctx=%u ts=%u queued=%u flags=%s",
  38. __entry->id, __entry->timestamp, __entry->queued,
  39. __entry->flags ? __print_flags(__entry->flags, "|",
  40. ADRENO_CMDBATCH_FLAGS) : "none"
  41. )
  42. );
  43. DECLARE_EVENT_CLASS(adreno_cmdbatch_template,
  44. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, int inflight),
  45. TP_ARGS(cmdbatch, inflight),
  46. TP_STRUCT__entry(
  47. __field(unsigned int, id)
  48. __field(unsigned int, timestamp)
  49. __field(int, inflight)
  50. __field(unsigned int, flags)
  51. ),
  52. TP_fast_assign(
  53. __entry->id = cmdbatch->context->id;
  54. __entry->timestamp = cmdbatch->timestamp;
  55. __entry->inflight = inflight;
  56. __entry->flags = cmdbatch->flags;
  57. ),
  58. TP_printk(
  59. "ctx=%u ts=%u inflight=%d flags=%s",
  60. __entry->id, __entry->timestamp,
  61. __entry->inflight,
  62. __entry->flags ? __print_flags(__entry->flags, "|",
  63. { KGSL_CMDBATCH_MARKER, "MARKER" }) : "none"
  64. )
  65. );
  66. DEFINE_EVENT(adreno_cmdbatch_template, adreno_cmdbatch_submitted,
  67. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, int inflight),
  68. TP_ARGS(cmdbatch, inflight)
  69. );
  70. TRACE_EVENT(adreno_cmdbatch_retired,
  71. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, int inflight),
  72. TP_ARGS(cmdbatch, inflight),
  73. TP_STRUCT__entry(
  74. __field(unsigned int, id)
  75. __field(unsigned int, timestamp)
  76. __field(int, inflight)
  77. __field(unsigned int, recovery)
  78. __field(unsigned int, flags)
  79. ),
  80. TP_fast_assign(
  81. __entry->id = cmdbatch->context->id;
  82. __entry->timestamp = cmdbatch->timestamp;
  83. __entry->inflight = inflight;
  84. __entry->recovery = cmdbatch->fault_recovery;
  85. __entry->flags = cmdbatch->flags;
  86. ),
  87. TP_printk(
  88. "ctx=%u ts=%u inflight=%d recovery=%s flags=%s",
  89. __entry->id, __entry->timestamp,
  90. __entry->inflight,
  91. __entry->recovery ?
  92. __print_flags(__entry->recovery, "|",
  93. ADRENO_FT_TYPES) : "none",
  94. __entry->flags ? __print_flags(__entry->flags, "|",
  95. { KGSL_CMDBATCH_MARKER, "MARKER" }) : "none"
  96. )
  97. );
  98. TRACE_EVENT(adreno_cmdbatch_fault,
  99. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, unsigned int fault),
  100. TP_ARGS(cmdbatch, fault),
  101. TP_STRUCT__entry(
  102. __field(unsigned int, id)
  103. __field(unsigned int, timestamp)
  104. __field(unsigned int, fault)
  105. ),
  106. TP_fast_assign(
  107. __entry->id = cmdbatch->context->id;
  108. __entry->timestamp = cmdbatch->timestamp;
  109. __entry->fault = fault;
  110. ),
  111. TP_printk(
  112. "ctx=%u ts=%u type=%s",
  113. __entry->id, __entry->timestamp,
  114. __print_symbolic(__entry->fault,
  115. { 0, "none" },
  116. { ADRENO_SOFT_FAULT, "soft" },
  117. { ADRENO_HARD_FAULT, "hard" },
  118. { ADRENO_TIMEOUT_FAULT, "timeout" })
  119. )
  120. );
  121. TRACE_EVENT(adreno_cmdbatch_recovery,
  122. TP_PROTO(struct kgsl_cmdbatch *cmdbatch, unsigned int action),
  123. TP_ARGS(cmdbatch, action),
  124. TP_STRUCT__entry(
  125. __field(unsigned int, id)
  126. __field(unsigned int, timestamp)
  127. __field(unsigned int, action)
  128. ),
  129. TP_fast_assign(
  130. __entry->id = cmdbatch->context->id;
  131. __entry->timestamp = cmdbatch->timestamp;
  132. __entry->action = action;
  133. ),
  134. TP_printk(
  135. "ctx=%u ts=%u action=%s",
  136. __entry->id, __entry->timestamp,
  137. __print_symbolic(__entry->action, ADRENO_FT_TYPES)
  138. )
  139. );
  140. DECLARE_EVENT_CLASS(adreno_drawctxt_template,
  141. TP_PROTO(struct adreno_context *drawctxt),
  142. TP_ARGS(drawctxt),
  143. TP_STRUCT__entry(
  144. __field(unsigned int, id)
  145. ),
  146. TP_fast_assign(
  147. __entry->id = drawctxt->base.id;
  148. ),
  149. TP_printk("ctx=%u", __entry->id)
  150. );
  151. DEFINE_EVENT(adreno_drawctxt_template, adreno_drawctxt_sleep,
  152. TP_PROTO(struct adreno_context *drawctxt),
  153. TP_ARGS(drawctxt)
  154. );
  155. DEFINE_EVENT(adreno_drawctxt_template, adreno_drawctxt_wake,
  156. TP_PROTO(struct adreno_context *drawctxt),
  157. TP_ARGS(drawctxt)
  158. );
  159. DEFINE_EVENT(adreno_drawctxt_template, dispatch_queue_context,
  160. TP_PROTO(struct adreno_context *drawctxt),
  161. TP_ARGS(drawctxt)
  162. );
  163. DEFINE_EVENT(adreno_drawctxt_template, adreno_drawctxt_invalidate,
  164. TP_PROTO(struct adreno_context *drawctxt),
  165. TP_ARGS(drawctxt)
  166. );
  167. TRACE_EVENT(adreno_drawctxt_wait_start,
  168. TP_PROTO(unsigned int id, unsigned int ts),
  169. TP_ARGS(id, ts),
  170. TP_STRUCT__entry(
  171. __field(unsigned int, id)
  172. __field(unsigned int, ts)
  173. ),
  174. TP_fast_assign(
  175. __entry->id = id;
  176. __entry->ts = ts;
  177. ),
  178. TP_printk(
  179. "ctx=%u ts=%u",
  180. __entry->id, __entry->ts
  181. )
  182. );
  183. TRACE_EVENT(adreno_drawctxt_wait_done,
  184. TP_PROTO(unsigned int id, unsigned int ts, int status),
  185. TP_ARGS(id, ts, status),
  186. TP_STRUCT__entry(
  187. __field(unsigned int, id)
  188. __field(unsigned int, ts)
  189. __field(int, status)
  190. ),
  191. TP_fast_assign(
  192. __entry->id = id;
  193. __entry->ts = ts;
  194. __entry->status = status;
  195. ),
  196. TP_printk(
  197. "ctx=%u ts=%u status=%d",
  198. __entry->id, __entry->ts, __entry->status
  199. )
  200. );
  201. TRACE_EVENT(adreno_drawctxt_switch,
  202. TP_PROTO(struct adreno_context *oldctx,
  203. struct adreno_context *newctx,
  204. unsigned int flags),
  205. TP_ARGS(oldctx, newctx, flags),
  206. TP_STRUCT__entry(
  207. __field(unsigned int, oldctx)
  208. __field(unsigned int, newctx)
  209. __field(unsigned int, flags)
  210. ),
  211. TP_fast_assign(
  212. __entry->oldctx = oldctx ? oldctx->base.id : 0;
  213. __entry->newctx = newctx ? newctx->base.id : 0;
  214. ),
  215. TP_printk(
  216. "oldctx=%u newctx=%u flags=%X",
  217. __entry->oldctx, __entry->newctx, flags
  218. )
  219. );
  220. TRACE_EVENT(adreno_gpu_fault,
  221. TP_PROTO(unsigned int ctx, unsigned int ts,
  222. unsigned int status, unsigned int rptr, unsigned int wptr,
  223. unsigned int ib1base, unsigned int ib1size,
  224. unsigned int ib2base, unsigned int ib2size),
  225. TP_ARGS(ctx, ts, status, rptr, wptr, ib1base, ib1size, ib2base,
  226. ib2size),
  227. TP_STRUCT__entry(
  228. __field(unsigned int, ctx)
  229. __field(unsigned int, ts)
  230. __field(unsigned int, status)
  231. __field(unsigned int, rptr)
  232. __field(unsigned int, wptr)
  233. __field(unsigned int, ib1base)
  234. __field(unsigned int, ib1size)
  235. __field(unsigned int, ib2base)
  236. __field(unsigned int, ib2size)
  237. ),
  238. TP_fast_assign(
  239. __entry->ctx = ctx;
  240. __entry->ts = ts;
  241. __entry->status = status;
  242. __entry->rptr = rptr;
  243. __entry->wptr = wptr;
  244. __entry->ib1base = ib1base;
  245. __entry->ib1size = ib1size;
  246. __entry->ib2base = ib2base;
  247. __entry->ib2size = ib2size;
  248. ),
  249. TP_printk("ctx=%d ts=%d status=%X RB=%X/%X IB1=%X/%X IB2=%X/%X",
  250. __entry->ctx, __entry->ts, __entry->status, __entry->wptr,
  251. __entry->rptr, __entry->ib1base, __entry->ib1size,
  252. __entry->ib2base, __entry->ib2size)
  253. );
  254. #endif /* _ADRENO_TRACE_H */
  255. /* This part must be outside protection */
  256. #include <trace/define_trace.h>