Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 1 | #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) |
| 2 | #define _I915_TRACE_H_ |
| 3 | |
| 4 | #include <linux/stringify.h> |
| 5 | #include <linux/types.h> |
| 6 | #include <linux/tracepoint.h> |
| 7 | |
| 8 | #include <drm/drmP.h> |
| 9 | |
| 10 | #undef TRACE_SYSTEM |
| 11 | #define TRACE_SYSTEM i915 |
| 12 | #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) |
| 13 | #define TRACE_INCLUDE_FILE i915_trace |
| 14 | |
| 15 | /* object tracking */ |
| 16 | |
| 17 | TRACE_EVENT(i915_gem_object_create, |
| 18 | |
| 19 | TP_PROTO(struct drm_gem_object *obj), |
| 20 | |
| 21 | TP_ARGS(obj), |
| 22 | |
| 23 | TP_STRUCT__entry( |
| 24 | __field(struct drm_gem_object *, obj) |
| 25 | __field(u32, size) |
| 26 | ), |
| 27 | |
| 28 | TP_fast_assign( |
| 29 | __entry->obj = obj; |
| 30 | __entry->size = obj->size; |
| 31 | ), |
| 32 | |
| 33 | TP_printk("obj=%p, size=%u", __entry->obj, __entry->size) |
| 34 | ); |
| 35 | |
| 36 | TRACE_EVENT(i915_gem_object_bind, |
| 37 | |
Daniel Vetter | ec57d26 | 2010-09-30 23:42:15 +0200 | [diff] [blame] | 38 | TP_PROTO(struct drm_gem_object *obj, u32 gtt_offset, bool mappable), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 39 | |
Daniel Vetter | ec57d26 | 2010-09-30 23:42:15 +0200 | [diff] [blame] | 40 | TP_ARGS(obj, gtt_offset, mappable), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 41 | |
| 42 | TP_STRUCT__entry( |
| 43 | __field(struct drm_gem_object *, obj) |
| 44 | __field(u32, gtt_offset) |
Daniel Vetter | ec57d26 | 2010-09-30 23:42:15 +0200 | [diff] [blame] | 45 | __field(bool, mappable) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 46 | ), |
| 47 | |
| 48 | TP_fast_assign( |
| 49 | __entry->obj = obj; |
| 50 | __entry->gtt_offset = gtt_offset; |
Daniel Vetter | ec57d26 | 2010-09-30 23:42:15 +0200 | [diff] [blame] | 51 | __entry->mappable = mappable; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 52 | ), |
| 53 | |
Daniel Vetter | ec57d26 | 2010-09-30 23:42:15 +0200 | [diff] [blame] | 54 | TP_printk("obj=%p, gtt_offset=%08x%s", |
| 55 | __entry->obj, __entry->gtt_offset, |
| 56 | __entry->mappable ? ", mappable" : "") |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 57 | ); |
| 58 | |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 59 | TRACE_EVENT(i915_gem_object_change_domain, |
| 60 | |
| 61 | TP_PROTO(struct drm_gem_object *obj, uint32_t old_read_domains, uint32_t old_write_domain), |
| 62 | |
| 63 | TP_ARGS(obj, old_read_domains, old_write_domain), |
| 64 | |
| 65 | TP_STRUCT__entry( |
| 66 | __field(struct drm_gem_object *, obj) |
| 67 | __field(u32, read_domains) |
| 68 | __field(u32, write_domain) |
| 69 | ), |
| 70 | |
| 71 | TP_fast_assign( |
| 72 | __entry->obj = obj; |
| 73 | __entry->read_domains = obj->read_domains | (old_read_domains << 16); |
| 74 | __entry->write_domain = obj->write_domain | (old_write_domain << 16); |
| 75 | ), |
| 76 | |
| 77 | TP_printk("obj=%p, read=%04x, write=%04x", |
| 78 | __entry->obj, |
| 79 | __entry->read_domains, __entry->write_domain) |
| 80 | ); |
| 81 | |
| 82 | TRACE_EVENT(i915_gem_object_get_fence, |
| 83 | |
| 84 | TP_PROTO(struct drm_gem_object *obj, int fence, int tiling_mode), |
| 85 | |
| 86 | TP_ARGS(obj, fence, tiling_mode), |
| 87 | |
| 88 | TP_STRUCT__entry( |
| 89 | __field(struct drm_gem_object *, obj) |
| 90 | __field(int, fence) |
| 91 | __field(int, tiling_mode) |
| 92 | ), |
| 93 | |
| 94 | TP_fast_assign( |
| 95 | __entry->obj = obj; |
| 96 | __entry->fence = fence; |
| 97 | __entry->tiling_mode = tiling_mode; |
| 98 | ), |
| 99 | |
| 100 | TP_printk("obj=%p, fence=%d, tiling=%d", |
| 101 | __entry->obj, __entry->fence, __entry->tiling_mode) |
| 102 | ); |
| 103 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 104 | DECLARE_EVENT_CLASS(i915_gem_object, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 105 | |
| 106 | TP_PROTO(struct drm_gem_object *obj), |
| 107 | |
| 108 | TP_ARGS(obj), |
| 109 | |
| 110 | TP_STRUCT__entry( |
| 111 | __field(struct drm_gem_object *, obj) |
| 112 | ), |
| 113 | |
| 114 | TP_fast_assign( |
| 115 | __entry->obj = obj; |
| 116 | ), |
| 117 | |
| 118 | TP_printk("obj=%p", __entry->obj) |
| 119 | ); |
| 120 | |
Li Zefan | f41275e | 2010-05-24 16:25:44 +0800 | [diff] [blame] | 121 | DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, |
| 122 | |
| 123 | TP_PROTO(struct drm_gem_object *obj), |
| 124 | |
| 125 | TP_ARGS(obj) |
| 126 | ); |
| 127 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 128 | DEFINE_EVENT(i915_gem_object, i915_gem_object_unbind, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 129 | |
| 130 | TP_PROTO(struct drm_gem_object *obj), |
| 131 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 132 | TP_ARGS(obj) |
| 133 | ); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 134 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 135 | DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 136 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 137 | TP_PROTO(struct drm_gem_object *obj), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 138 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 139 | TP_ARGS(obj) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 140 | ); |
| 141 | |
| 142 | /* batch tracing */ |
| 143 | |
| 144 | TRACE_EVENT(i915_gem_request_submit, |
| 145 | |
| 146 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 147 | |
| 148 | TP_ARGS(dev, seqno), |
| 149 | |
| 150 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 151 | __field(u32, dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 152 | __field(u32, seqno) |
| 153 | ), |
| 154 | |
| 155 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 156 | __entry->dev = dev->primary->index; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 157 | __entry->seqno = seqno; |
Chris Wilson | 9d34e5d | 2009-09-24 05:26:06 +0100 | [diff] [blame] | 158 | i915_trace_irq_get(dev, seqno); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 159 | ), |
| 160 | |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 161 | TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 162 | ); |
| 163 | |
| 164 | TRACE_EVENT(i915_gem_request_flush, |
| 165 | |
| 166 | TP_PROTO(struct drm_device *dev, u32 seqno, |
| 167 | u32 flush_domains, u32 invalidate_domains), |
| 168 | |
| 169 | TP_ARGS(dev, seqno, flush_domains, invalidate_domains), |
| 170 | |
| 171 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 172 | __field(u32, dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 173 | __field(u32, seqno) |
| 174 | __field(u32, flush_domains) |
| 175 | __field(u32, invalidate_domains) |
| 176 | ), |
| 177 | |
| 178 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 179 | __entry->dev = dev->primary->index; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 180 | __entry->seqno = seqno; |
| 181 | __entry->flush_domains = flush_domains; |
| 182 | __entry->invalidate_domains = invalidate_domains; |
| 183 | ), |
| 184 | |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 185 | TP_printk("dev=%u, seqno=%u, flush=%04x, invalidate=%04x", |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 186 | __entry->dev, __entry->seqno, |
| 187 | __entry->flush_domains, __entry->invalidate_domains) |
| 188 | ); |
| 189 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 190 | DECLARE_EVENT_CLASS(i915_gem_request, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 191 | |
| 192 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 193 | |
| 194 | TP_ARGS(dev, seqno), |
| 195 | |
| 196 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 197 | __field(u32, dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 198 | __field(u32, seqno) |
| 199 | ), |
| 200 | |
| 201 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 202 | __entry->dev = dev->primary->index; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 203 | __entry->seqno = seqno; |
| 204 | ), |
| 205 | |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 206 | TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 207 | ); |
| 208 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 209 | DEFINE_EVENT(i915_gem_request, i915_gem_request_complete, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 210 | |
| 211 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 212 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 213 | TP_ARGS(dev, seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 214 | ); |
| 215 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 216 | DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 217 | |
| 218 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 219 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 220 | TP_ARGS(dev, seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 221 | ); |
| 222 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 223 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 224 | |
| 225 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 226 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 227 | TP_ARGS(dev, seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 228 | ); |
| 229 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 230 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, |
| 231 | |
| 232 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| 233 | |
| 234 | TP_ARGS(dev, seqno) |
| 235 | ); |
| 236 | |
| 237 | DECLARE_EVENT_CLASS(i915_ring, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 238 | |
| 239 | TP_PROTO(struct drm_device *dev), |
| 240 | |
| 241 | TP_ARGS(dev), |
| 242 | |
| 243 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 244 | __field(u32, dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 245 | ), |
| 246 | |
| 247 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 248 | __entry->dev = dev->primary->index; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 249 | ), |
| 250 | |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 251 | TP_printk("dev=%u", __entry->dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 252 | ); |
| 253 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 254 | DEFINE_EVENT(i915_ring, i915_ring_wait_begin, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 255 | |
| 256 | TP_PROTO(struct drm_device *dev), |
| 257 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 258 | TP_ARGS(dev) |
| 259 | ); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 260 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 261 | DEFINE_EVENT(i915_ring, i915_ring_wait_end, |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 262 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 263 | TP_PROTO(struct drm_device *dev), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 264 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 265 | TP_ARGS(dev) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 266 | ); |
| 267 | |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 268 | TRACE_EVENT(i915_flip_request, |
| 269 | TP_PROTO(int plane, struct drm_gem_object *obj), |
| 270 | |
| 271 | TP_ARGS(plane, obj), |
| 272 | |
| 273 | TP_STRUCT__entry( |
| 274 | __field(int, plane) |
| 275 | __field(struct drm_gem_object *, obj) |
| 276 | ), |
| 277 | |
| 278 | TP_fast_assign( |
| 279 | __entry->plane = plane; |
| 280 | __entry->obj = obj; |
| 281 | ), |
| 282 | |
| 283 | TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) |
| 284 | ); |
| 285 | |
| 286 | TRACE_EVENT(i915_flip_complete, |
| 287 | TP_PROTO(int plane, struct drm_gem_object *obj), |
| 288 | |
| 289 | TP_ARGS(plane, obj), |
| 290 | |
| 291 | TP_STRUCT__entry( |
| 292 | __field(int, plane) |
| 293 | __field(struct drm_gem_object *, obj) |
| 294 | ), |
| 295 | |
| 296 | TP_fast_assign( |
| 297 | __entry->plane = plane; |
| 298 | __entry->obj = obj; |
| 299 | ), |
| 300 | |
| 301 | TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) |
| 302 | ); |
| 303 | |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame^] | 304 | TRACE_EVENT(i915_reg_rw, |
| 305 | TP_PROTO(int cmd, uint32_t reg, uint64_t val, int len), |
| 306 | |
| 307 | TP_ARGS(cmd, reg, val, len), |
| 308 | |
| 309 | TP_STRUCT__entry( |
| 310 | __field(int, cmd) |
| 311 | __field(uint32_t, reg) |
| 312 | __field(uint64_t, val) |
| 313 | __field(int, len) |
| 314 | ), |
| 315 | |
| 316 | TP_fast_assign( |
| 317 | __entry->cmd = cmd; |
| 318 | __entry->reg = reg; |
| 319 | __entry->val = (uint64_t)val; |
| 320 | __entry->len = len; |
| 321 | ), |
| 322 | |
| 323 | TP_printk("cmd=%c, reg=0x%x, val=0x%llx, len=%d", |
| 324 | __entry->cmd, __entry->reg, __entry->val, __entry->len) |
| 325 | ); |
| 326 | |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 327 | #endif /* _I915_TRACE_H_ */ |
| 328 | |
| 329 | /* This part must be outside protection */ |
| 330 | #undef TRACE_INCLUDE_PATH |
Peter Clifton | a7c5427 | 2010-05-03 13:24:41 +0100 | [diff] [blame] | 331 | #define TRACE_INCLUDE_PATH . |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 332 | #include <trace/define_trace.h> |