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> |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 9 | #include "i915_drv.h" |
Ville Syrjälä | 25ef284 | 2014-04-29 13:35:48 +0300 | [diff] [blame] | 10 | #include "intel_drv.h" |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 11 | #include "intel_ringbuffer.h" |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 12 | |
| 13 | #undef TRACE_SYSTEM |
| 14 | #define TRACE_SYSTEM i915 |
| 15 | #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) |
| 16 | #define TRACE_INCLUDE_FILE i915_trace |
| 17 | |
Ville Syrjälä | 25ef284 | 2014-04-29 13:35:48 +0300 | [diff] [blame] | 18 | /* pipe updates */ |
| 19 | |
| 20 | TRACE_EVENT(i915_pipe_update_start, |
| 21 | TP_PROTO(struct intel_crtc *crtc, u32 min, u32 max), |
| 22 | TP_ARGS(crtc, min, max), |
| 23 | |
| 24 | TP_STRUCT__entry( |
| 25 | __field(enum pipe, pipe) |
| 26 | __field(u32, frame) |
| 27 | __field(u32, scanline) |
| 28 | __field(u32, min) |
| 29 | __field(u32, max) |
| 30 | ), |
| 31 | |
| 32 | TP_fast_assign( |
| 33 | __entry->pipe = crtc->pipe; |
| 34 | __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, |
| 35 | crtc->pipe); |
| 36 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 37 | __entry->min = min; |
| 38 | __entry->max = max; |
| 39 | ), |
| 40 | |
| 41 | TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", |
| 42 | pipe_name(__entry->pipe), __entry->frame, |
| 43 | __entry->scanline, __entry->min, __entry->max) |
| 44 | ); |
| 45 | |
| 46 | TRACE_EVENT(i915_pipe_update_vblank_evaded, |
| 47 | TP_PROTO(struct intel_crtc *crtc, u32 min, u32 max, u32 frame), |
| 48 | TP_ARGS(crtc, min, max, frame), |
| 49 | |
| 50 | TP_STRUCT__entry( |
| 51 | __field(enum pipe, pipe) |
| 52 | __field(u32, frame) |
| 53 | __field(u32, scanline) |
| 54 | __field(u32, min) |
| 55 | __field(u32, max) |
| 56 | ), |
| 57 | |
| 58 | TP_fast_assign( |
| 59 | __entry->pipe = crtc->pipe; |
| 60 | __entry->frame = frame; |
| 61 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 62 | __entry->min = min; |
| 63 | __entry->max = max; |
| 64 | ), |
| 65 | |
| 66 | TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", |
| 67 | pipe_name(__entry->pipe), __entry->frame, |
| 68 | __entry->scanline, __entry->min, __entry->max) |
| 69 | ); |
| 70 | |
| 71 | TRACE_EVENT(i915_pipe_update_end, |
| 72 | TP_PROTO(struct intel_crtc *crtc, u32 frame), |
| 73 | TP_ARGS(crtc, frame), |
| 74 | |
| 75 | TP_STRUCT__entry( |
| 76 | __field(enum pipe, pipe) |
| 77 | __field(u32, frame) |
| 78 | __field(u32, scanline) |
| 79 | ), |
| 80 | |
| 81 | TP_fast_assign( |
| 82 | __entry->pipe = crtc->pipe; |
| 83 | __entry->frame = frame; |
| 84 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 85 | ), |
| 86 | |
| 87 | TP_printk("pipe %c, frame=%u, scanline=%u", |
| 88 | pipe_name(__entry->pipe), __entry->frame, |
| 89 | __entry->scanline) |
| 90 | ); |
| 91 | |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 92 | /* object tracking */ |
| 93 | |
| 94 | TRACE_EVENT(i915_gem_object_create, |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 95 | TP_PROTO(struct drm_i915_gem_object *obj), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 96 | TP_ARGS(obj), |
| 97 | |
| 98 | TP_STRUCT__entry( |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 99 | __field(struct drm_i915_gem_object *, obj) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 100 | __field(u32, size) |
| 101 | ), |
| 102 | |
| 103 | TP_fast_assign( |
| 104 | __entry->obj = obj; |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 105 | __entry->size = obj->base.size; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 106 | ), |
| 107 | |
| 108 | TP_printk("obj=%p, size=%u", __entry->obj, __entry->size) |
| 109 | ); |
| 110 | |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 111 | TRACE_EVENT(i915_vma_bind, |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 112 | TP_PROTO(struct i915_vma *vma, unsigned flags), |
| 113 | TP_ARGS(vma, flags), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 114 | |
| 115 | TP_STRUCT__entry( |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 116 | __field(struct drm_i915_gem_object *, obj) |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 117 | __field(struct i915_address_space *, vm) |
Ben Widawsky | 3393871 | 2015-01-22 17:01:23 +0000 | [diff] [blame] | 118 | __field(u64, offset) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 119 | __field(u32, size) |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 120 | __field(unsigned, flags) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 121 | ), |
| 122 | |
| 123 | TP_fast_assign( |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 124 | __entry->obj = vma->obj; |
| 125 | __entry->vm = vma->vm; |
| 126 | __entry->offset = vma->node.start; |
| 127 | __entry->size = vma->node.size; |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 128 | __entry->flags = flags; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 129 | ), |
| 130 | |
Ben Widawsky | 3393871 | 2015-01-22 17:01:23 +0000 | [diff] [blame] | 131 | TP_printk("obj=%p, offset=%016llx size=%x%s vm=%p", |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 132 | __entry->obj, __entry->offset, __entry->size, |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 133 | __entry->flags & PIN_MAPPABLE ? ", mappable" : "", |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 134 | __entry->vm) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 135 | ); |
| 136 | |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 137 | TRACE_EVENT(i915_vma_unbind, |
| 138 | TP_PROTO(struct i915_vma *vma), |
| 139 | TP_ARGS(vma), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 140 | |
| 141 | TP_STRUCT__entry( |
| 142 | __field(struct drm_i915_gem_object *, obj) |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 143 | __field(struct i915_address_space *, vm) |
Ben Widawsky | 3393871 | 2015-01-22 17:01:23 +0000 | [diff] [blame] | 144 | __field(u64, offset) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 145 | __field(u32, size) |
| 146 | ), |
| 147 | |
| 148 | TP_fast_assign( |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 149 | __entry->obj = vma->obj; |
| 150 | __entry->vm = vma->vm; |
| 151 | __entry->offset = vma->node.start; |
| 152 | __entry->size = vma->node.size; |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 153 | ), |
| 154 | |
Ben Widawsky | 3393871 | 2015-01-22 17:01:23 +0000 | [diff] [blame] | 155 | TP_printk("obj=%p, offset=%016llx size=%x vm=%p", |
Ben Widawsky | 07fe0b1 | 2013-07-31 17:00:10 -0700 | [diff] [blame] | 156 | __entry->obj, __entry->offset, __entry->size, __entry->vm) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 157 | ); |
| 158 | |
Michel Thierry | 72744cb | 2015-03-24 15:46:23 +0000 | [diff] [blame] | 159 | #define VM_TO_TRACE_NAME(vm) \ |
| 160 | (i915_is_ggtt(vm) ? "G" : \ |
| 161 | "P") |
| 162 | |
| 163 | DECLARE_EVENT_CLASS(i915_va, |
| 164 | TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name), |
| 165 | TP_ARGS(vm, start, length, name), |
| 166 | |
| 167 | TP_STRUCT__entry( |
| 168 | __field(struct i915_address_space *, vm) |
| 169 | __field(u64, start) |
| 170 | __field(u64, end) |
| 171 | __string(name, name) |
| 172 | ), |
| 173 | |
| 174 | TP_fast_assign( |
| 175 | __entry->vm = vm; |
| 176 | __entry->start = start; |
| 177 | __entry->end = start + length - 1; |
| 178 | __assign_str(name, name); |
| 179 | ), |
| 180 | |
| 181 | TP_printk("vm=%p (%s), 0x%llx-0x%llx", |
| 182 | __entry->vm, __get_str(name), __entry->start, __entry->end) |
| 183 | ); |
| 184 | |
| 185 | DEFINE_EVENT(i915_va, i915_va_alloc, |
| 186 | TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name), |
| 187 | TP_ARGS(vm, start, length, name) |
| 188 | ); |
| 189 | |
| 190 | DECLARE_EVENT_CLASS(i915_page_table_entry, |
| 191 | TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift), |
| 192 | TP_ARGS(vm, pde, start, pde_shift), |
| 193 | |
| 194 | TP_STRUCT__entry( |
| 195 | __field(struct i915_address_space *, vm) |
| 196 | __field(u32, pde) |
| 197 | __field(u64, start) |
| 198 | __field(u64, end) |
| 199 | ), |
| 200 | |
| 201 | TP_fast_assign( |
| 202 | __entry->vm = vm; |
| 203 | __entry->pde = pde; |
| 204 | __entry->start = start; |
| 205 | __entry->end = ((start + (1ULL << pde_shift)) & ~((1ULL << pde_shift)-1)) - 1; |
| 206 | ), |
| 207 | |
| 208 | TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)", |
| 209 | __entry->vm, __entry->pde, __entry->start, __entry->end) |
| 210 | ); |
| 211 | |
| 212 | DEFINE_EVENT(i915_page_table_entry, i915_page_table_entry_alloc, |
| 213 | TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift), |
| 214 | TP_ARGS(vm, pde, start, pde_shift) |
| 215 | ); |
| 216 | |
| 217 | /* Avoid extra math because we only support two sizes. The format is defined by |
| 218 | * bitmap_scnprintf. Each 32 bits is 8 HEX digits followed by comma */ |
| 219 | #define TRACE_PT_SIZE(bits) \ |
| 220 | ((((bits) == 1024) ? 288 : 144) + 1) |
| 221 | |
| 222 | DECLARE_EVENT_CLASS(i915_page_table_entry_update, |
| 223 | TP_PROTO(struct i915_address_space *vm, u32 pde, |
| 224 | struct i915_page_table_entry *pt, u32 first, u32 count, u32 bits), |
| 225 | TP_ARGS(vm, pde, pt, first, count, bits), |
| 226 | |
| 227 | TP_STRUCT__entry( |
| 228 | __field(struct i915_address_space *, vm) |
| 229 | __field(u32, pde) |
| 230 | __field(u32, first) |
| 231 | __field(u32, last) |
| 232 | __dynamic_array(char, cur_ptes, TRACE_PT_SIZE(bits)) |
| 233 | ), |
| 234 | |
| 235 | TP_fast_assign( |
| 236 | __entry->vm = vm; |
| 237 | __entry->pde = pde; |
| 238 | __entry->first = first; |
| 239 | __entry->last = first + count - 1; |
| 240 | scnprintf(__get_str(cur_ptes), |
| 241 | TRACE_PT_SIZE(bits), |
| 242 | "%*pb", |
| 243 | bits, |
| 244 | pt->used_ptes); |
| 245 | ), |
| 246 | |
| 247 | TP_printk("vm=%p, pde=%d, updating %u:%u\t%s", |
| 248 | __entry->vm, __entry->pde, __entry->last, __entry->first, |
| 249 | __get_str(cur_ptes)) |
| 250 | ); |
| 251 | |
| 252 | DEFINE_EVENT(i915_page_table_entry_update, i915_page_table_entry_map, |
| 253 | TP_PROTO(struct i915_address_space *vm, u32 pde, |
| 254 | struct i915_page_table_entry *pt, u32 first, u32 count, u32 bits), |
| 255 | TP_ARGS(vm, pde, pt, first, count, bits) |
| 256 | ); |
| 257 | |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 258 | TRACE_EVENT(i915_gem_object_change_domain, |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 259 | TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write), |
| 260 | TP_ARGS(obj, old_read, old_write), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 261 | |
| 262 | TP_STRUCT__entry( |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 263 | __field(struct drm_i915_gem_object *, obj) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 264 | __field(u32, read_domains) |
| 265 | __field(u32, write_domain) |
| 266 | ), |
| 267 | |
| 268 | TP_fast_assign( |
| 269 | __entry->obj = obj; |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 270 | __entry->read_domains = obj->base.read_domains | (old_read << 16); |
| 271 | __entry->write_domain = obj->base.write_domain | (old_write << 16); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 272 | ), |
| 273 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 274 | TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x", |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 275 | __entry->obj, |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 276 | __entry->read_domains >> 16, |
| 277 | __entry->read_domains & 0xffff, |
| 278 | __entry->write_domain >> 16, |
| 279 | __entry->write_domain & 0xffff) |
| 280 | ); |
| 281 | |
| 282 | TRACE_EVENT(i915_gem_object_pwrite, |
| 283 | TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), |
| 284 | TP_ARGS(obj, offset, len), |
| 285 | |
| 286 | TP_STRUCT__entry( |
| 287 | __field(struct drm_i915_gem_object *, obj) |
| 288 | __field(u32, offset) |
| 289 | __field(u32, len) |
| 290 | ), |
| 291 | |
| 292 | TP_fast_assign( |
| 293 | __entry->obj = obj; |
| 294 | __entry->offset = offset; |
| 295 | __entry->len = len; |
| 296 | ), |
| 297 | |
| 298 | TP_printk("obj=%p, offset=%u, len=%u", |
| 299 | __entry->obj, __entry->offset, __entry->len) |
| 300 | ); |
| 301 | |
| 302 | TRACE_EVENT(i915_gem_object_pread, |
| 303 | TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), |
| 304 | TP_ARGS(obj, offset, len), |
| 305 | |
| 306 | TP_STRUCT__entry( |
| 307 | __field(struct drm_i915_gem_object *, obj) |
| 308 | __field(u32, offset) |
| 309 | __field(u32, len) |
| 310 | ), |
| 311 | |
| 312 | TP_fast_assign( |
| 313 | __entry->obj = obj; |
| 314 | __entry->offset = offset; |
| 315 | __entry->len = len; |
| 316 | ), |
| 317 | |
| 318 | TP_printk("obj=%p, offset=%u, len=%u", |
| 319 | __entry->obj, __entry->offset, __entry->len) |
| 320 | ); |
| 321 | |
| 322 | TRACE_EVENT(i915_gem_object_fault, |
| 323 | TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write), |
| 324 | TP_ARGS(obj, index, gtt, write), |
| 325 | |
| 326 | TP_STRUCT__entry( |
| 327 | __field(struct drm_i915_gem_object *, obj) |
| 328 | __field(u32, index) |
| 329 | __field(bool, gtt) |
| 330 | __field(bool, write) |
| 331 | ), |
| 332 | |
| 333 | TP_fast_assign( |
| 334 | __entry->obj = obj; |
| 335 | __entry->index = index; |
| 336 | __entry->gtt = gtt; |
| 337 | __entry->write = write; |
| 338 | ), |
| 339 | |
| 340 | TP_printk("obj=%p, %s index=%u %s", |
| 341 | __entry->obj, |
| 342 | __entry->gtt ? "GTT" : "CPU", |
| 343 | __entry->index, |
| 344 | __entry->write ? ", writable" : "") |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 345 | ); |
| 346 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 347 | DECLARE_EVENT_CLASS(i915_gem_object, |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 348 | TP_PROTO(struct drm_i915_gem_object *obj), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 349 | TP_ARGS(obj), |
| 350 | |
| 351 | TP_STRUCT__entry( |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 352 | __field(struct drm_i915_gem_object *, obj) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 353 | ), |
| 354 | |
| 355 | TP_fast_assign( |
| 356 | __entry->obj = obj; |
| 357 | ), |
| 358 | |
| 359 | TP_printk("obj=%p", __entry->obj) |
| 360 | ); |
| 361 | |
Li Zefan | f41275e | 2010-05-24 16:25:44 +0800 | [diff] [blame] | 362 | DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 363 | TP_PROTO(struct drm_i915_gem_object *obj), |
| 364 | TP_ARGS(obj) |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 365 | ); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 366 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 367 | DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 368 | TP_PROTO(struct drm_i915_gem_object *obj), |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 369 | TP_ARGS(obj) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 370 | ); |
| 371 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 372 | TRACE_EVENT(i915_gem_evict, |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 373 | TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags), |
| 374 | TP_ARGS(dev, size, align, flags), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 375 | |
| 376 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 377 | __field(u32, dev) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 378 | __field(u32, size) |
| 379 | __field(u32, align) |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 380 | __field(unsigned, flags) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 381 | ), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 382 | |
| 383 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 384 | __entry->dev = dev->primary->index; |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 385 | __entry->size = size; |
| 386 | __entry->align = align; |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 387 | __entry->flags = flags; |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 388 | ), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 389 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 390 | TP_printk("dev=%d, size=%d, align=%d %s", |
| 391 | __entry->dev, __entry->size, __entry->align, |
Daniel Vetter | 1ec9e26 | 2014-02-14 14:01:11 +0100 | [diff] [blame] | 392 | __entry->flags & PIN_MAPPABLE ? ", mappable" : "") |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 393 | ); |
| 394 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 395 | TRACE_EVENT(i915_gem_evict_everything, |
Chris Wilson | 6c085a7 | 2012-08-20 11:40:46 +0200 | [diff] [blame] | 396 | TP_PROTO(struct drm_device *dev), |
| 397 | TP_ARGS(dev), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 398 | |
| 399 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 400 | __field(u32, dev) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 401 | ), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 402 | |
| 403 | TP_fast_assign( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 404 | __entry->dev = dev->primary->index; |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 405 | ), |
| 406 | |
Chris Wilson | 6c085a7 | 2012-08-20 11:40:46 +0200 | [diff] [blame] | 407 | TP_printk("dev=%d", __entry->dev) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 408 | ); |
| 409 | |
Ben Widawsky | bcccff8 | 2013-09-24 09:57:56 -0700 | [diff] [blame] | 410 | TRACE_EVENT(i915_gem_evict_vm, |
| 411 | TP_PROTO(struct i915_address_space *vm), |
| 412 | TP_ARGS(vm), |
| 413 | |
| 414 | TP_STRUCT__entry( |
Steven Rostedt | 9297ebf | 2014-03-18 11:27:37 -0400 | [diff] [blame] | 415 | __field(u32, dev) |
Ben Widawsky | bcccff8 | 2013-09-24 09:57:56 -0700 | [diff] [blame] | 416 | __field(struct i915_address_space *, vm) |
| 417 | ), |
| 418 | |
| 419 | TP_fast_assign( |
Steven Rostedt | 9297ebf | 2014-03-18 11:27:37 -0400 | [diff] [blame] | 420 | __entry->dev = vm->dev->primary->index; |
Ben Widawsky | bcccff8 | 2013-09-24 09:57:56 -0700 | [diff] [blame] | 421 | __entry->vm = vm; |
| 422 | ), |
| 423 | |
Steven Rostedt | 9297ebf | 2014-03-18 11:27:37 -0400 | [diff] [blame] | 424 | TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm) |
Ben Widawsky | bcccff8 | 2013-09-24 09:57:56 -0700 | [diff] [blame] | 425 | ); |
| 426 | |
Chris Wilson | b52b89d | 2013-09-25 11:43:28 +0100 | [diff] [blame] | 427 | TRACE_EVENT(i915_gem_ring_sync_to, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 428 | TP_PROTO(struct intel_engine_cs *from, |
| 429 | struct intel_engine_cs *to, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 430 | struct drm_i915_gem_request *req), |
| 431 | TP_ARGS(from, to, req), |
Chris Wilson | b52b89d | 2013-09-25 11:43:28 +0100 | [diff] [blame] | 432 | |
| 433 | TP_STRUCT__entry( |
| 434 | __field(u32, dev) |
| 435 | __field(u32, sync_from) |
| 436 | __field(u32, sync_to) |
| 437 | __field(u32, seqno) |
| 438 | ), |
| 439 | |
| 440 | TP_fast_assign( |
| 441 | __entry->dev = from->dev->primary->index; |
| 442 | __entry->sync_from = from->id; |
| 443 | __entry->sync_to = to->id; |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 444 | __entry->seqno = i915_gem_request_get_seqno(req); |
Chris Wilson | b52b89d | 2013-09-25 11:43:28 +0100 | [diff] [blame] | 445 | ), |
| 446 | |
| 447 | TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u", |
| 448 | __entry->dev, |
| 449 | __entry->sync_from, __entry->sync_to, |
| 450 | __entry->seqno) |
| 451 | ); |
| 452 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 453 | TRACE_EVENT(i915_gem_ring_dispatch, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 454 | TP_PROTO(struct drm_i915_gem_request *req, u32 flags), |
| 455 | TP_ARGS(req, flags), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 456 | |
| 457 | TP_STRUCT__entry( |
| 458 | __field(u32, dev) |
| 459 | __field(u32, ring) |
| 460 | __field(u32, seqno) |
Chris Wilson | d7d4eed | 2012-10-17 12:09:54 +0100 | [diff] [blame] | 461 | __field(u32, flags) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 462 | ), |
| 463 | |
| 464 | TP_fast_assign( |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 465 | struct intel_engine_cs *ring = |
| 466 | i915_gem_request_get_ring(req); |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 467 | __entry->dev = ring->dev->primary->index; |
| 468 | __entry->ring = ring->id; |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 469 | __entry->seqno = i915_gem_request_get_seqno(req); |
Chris Wilson | d7d4eed | 2012-10-17 12:09:54 +0100 | [diff] [blame] | 470 | __entry->flags = flags; |
John Harrison | 581c26e8 | 2014-11-24 18:49:39 +0000 | [diff] [blame] | 471 | i915_trace_irq_get(ring, req); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 472 | ), |
| 473 | |
Chris Wilson | d7d4eed | 2012-10-17 12:09:54 +0100 | [diff] [blame] | 474 | TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x", |
| 475 | __entry->dev, __entry->ring, __entry->seqno, __entry->flags) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 476 | ); |
| 477 | |
| 478 | TRACE_EVENT(i915_gem_ring_flush, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 479 | TP_PROTO(struct intel_engine_cs *ring, u32 invalidate, u32 flush), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 480 | TP_ARGS(ring, invalidate, flush), |
| 481 | |
| 482 | TP_STRUCT__entry( |
| 483 | __field(u32, dev) |
| 484 | __field(u32, ring) |
| 485 | __field(u32, invalidate) |
| 486 | __field(u32, flush) |
| 487 | ), |
| 488 | |
| 489 | TP_fast_assign( |
| 490 | __entry->dev = ring->dev->primary->index; |
| 491 | __entry->ring = ring->id; |
| 492 | __entry->invalidate = invalidate; |
| 493 | __entry->flush = flush; |
| 494 | ), |
| 495 | |
| 496 | TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x", |
| 497 | __entry->dev, __entry->ring, |
| 498 | __entry->invalidate, __entry->flush) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 499 | ); |
| 500 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 501 | DECLARE_EVENT_CLASS(i915_gem_request, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 502 | TP_PROTO(struct drm_i915_gem_request *req), |
| 503 | TP_ARGS(req), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 504 | |
| 505 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 506 | __field(u32, dev) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 507 | __field(u32, ring) |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 508 | __field(u32, uniq) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 509 | __field(u32, seqno) |
| 510 | ), |
| 511 | |
| 512 | TP_fast_assign( |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 513 | struct intel_engine_cs *ring = |
| 514 | i915_gem_request_get_ring(req); |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 515 | __entry->dev = ring->dev->primary->index; |
| 516 | __entry->ring = ring->id; |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 517 | __entry->uniq = req ? req->uniq : 0; |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 518 | __entry->seqno = i915_gem_request_get_seqno(req); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 519 | ), |
| 520 | |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 521 | TP_printk("dev=%u, ring=%u, uniq=%u, seqno=%u", |
| 522 | __entry->dev, __entry->ring, __entry->uniq, |
| 523 | __entry->seqno) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 524 | ); |
| 525 | |
| 526 | DEFINE_EVENT(i915_gem_request, i915_gem_request_add, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 527 | TP_PROTO(struct drm_i915_gem_request *req), |
| 528 | TP_ARGS(req) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 529 | ); |
| 530 | |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 531 | TRACE_EVENT(i915_gem_request_notify, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 532 | TP_PROTO(struct intel_engine_cs *ring), |
Chris Wilson | 814e9b5 | 2013-09-23 17:33:19 -0300 | [diff] [blame] | 533 | TP_ARGS(ring), |
| 534 | |
| 535 | TP_STRUCT__entry( |
| 536 | __field(u32, dev) |
| 537 | __field(u32, ring) |
| 538 | __field(u32, seqno) |
| 539 | ), |
| 540 | |
| 541 | TP_fast_assign( |
| 542 | __entry->dev = ring->dev->primary->index; |
| 543 | __entry->ring = ring->id; |
| 544 | __entry->seqno = ring->get_seqno(ring, false); |
| 545 | ), |
| 546 | |
| 547 | TP_printk("dev=%u, ring=%u, seqno=%u", |
| 548 | __entry->dev, __entry->ring, __entry->seqno) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 549 | ); |
| 550 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 551 | DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 552 | TP_PROTO(struct drm_i915_gem_request *req), |
| 553 | TP_ARGS(req) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 554 | ); |
| 555 | |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 556 | DEFINE_EVENT(i915_gem_request, i915_gem_request_complete, |
| 557 | TP_PROTO(struct drm_i915_gem_request *req), |
| 558 | TP_ARGS(req) |
| 559 | ); |
| 560 | |
Ben Widawsky | f3fd376 | 2012-05-24 15:03:09 -0700 | [diff] [blame] | 561 | TRACE_EVENT(i915_gem_request_wait_begin, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 562 | TP_PROTO(struct drm_i915_gem_request *req), |
| 563 | TP_ARGS(req), |
Ben Widawsky | f3fd376 | 2012-05-24 15:03:09 -0700 | [diff] [blame] | 564 | |
| 565 | TP_STRUCT__entry( |
| 566 | __field(u32, dev) |
| 567 | __field(u32, ring) |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 568 | __field(u32, uniq) |
Ben Widawsky | f3fd376 | 2012-05-24 15:03:09 -0700 | [diff] [blame] | 569 | __field(u32, seqno) |
| 570 | __field(bool, blocking) |
| 571 | ), |
| 572 | |
| 573 | /* NB: the blocking information is racy since mutex_is_locked |
| 574 | * doesn't check that the current thread holds the lock. The only |
| 575 | * other option would be to pass the boolean information of whether |
| 576 | * or not the class was blocking down through the stack which is |
| 577 | * less desirable. |
| 578 | */ |
| 579 | TP_fast_assign( |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 580 | struct intel_engine_cs *ring = |
| 581 | i915_gem_request_get_ring(req); |
Ben Widawsky | f3fd376 | 2012-05-24 15:03:09 -0700 | [diff] [blame] | 582 | __entry->dev = ring->dev->primary->index; |
| 583 | __entry->ring = ring->id; |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 584 | __entry->uniq = req ? req->uniq : 0; |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 585 | __entry->seqno = i915_gem_request_get_seqno(req); |
| 586 | __entry->blocking = |
| 587 | mutex_is_locked(&ring->dev->struct_mutex); |
Ben Widawsky | f3fd376 | 2012-05-24 15:03:09 -0700 | [diff] [blame] | 588 | ), |
| 589 | |
John Harrison | bcfcc8b | 2014-12-05 13:49:36 +0000 | [diff] [blame] | 590 | TP_printk("dev=%u, ring=%u, uniq=%u, seqno=%u, blocking=%s", |
| 591 | __entry->dev, __entry->ring, __entry->uniq, |
| 592 | __entry->seqno, __entry->blocking ? "yes (NB)" : "no") |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 593 | ); |
| 594 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 595 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, |
John Harrison | 74328ee | 2014-11-24 18:49:38 +0000 | [diff] [blame] | 596 | TP_PROTO(struct drm_i915_gem_request *req), |
| 597 | TP_ARGS(req) |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 598 | ); |
| 599 | |
| 600 | DECLARE_EVENT_CLASS(i915_ring, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 601 | TP_PROTO(struct intel_engine_cs *ring), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 602 | TP_ARGS(ring), |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 603 | |
| 604 | TP_STRUCT__entry( |
Chris Wilson | 4f49be5 | 2009-09-24 00:23:33 +0100 | [diff] [blame] | 605 | __field(u32, dev) |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 606 | __field(u32, ring) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 607 | ), |
| 608 | |
| 609 | TP_fast_assign( |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 610 | __entry->dev = ring->dev->primary->index; |
| 611 | __entry->ring = ring->id; |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 612 | ), |
| 613 | |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 614 | TP_printk("dev=%u, ring=%u", __entry->dev, __entry->ring) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 615 | ); |
| 616 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 617 | DEFINE_EVENT(i915_ring, i915_ring_wait_begin, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 618 | TP_PROTO(struct intel_engine_cs *ring), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 619 | TP_ARGS(ring) |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 620 | ); |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 621 | |
Li Zefan | 903cf20 | 2010-03-11 16:41:45 +0800 | [diff] [blame] | 622 | DEFINE_EVENT(i915_ring, i915_ring_wait_end, |
Oscar Mateo | a4872ba | 2014-05-22 14:13:33 +0100 | [diff] [blame] | 623 | TP_PROTO(struct intel_engine_cs *ring), |
Chris Wilson | db53a30 | 2011-02-03 11:57:46 +0000 | [diff] [blame] | 624 | TP_ARGS(ring) |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 625 | ); |
| 626 | |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 627 | TRACE_EVENT(i915_flip_request, |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 628 | TP_PROTO(int plane, struct drm_i915_gem_object *obj), |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 629 | |
| 630 | TP_ARGS(plane, obj), |
| 631 | |
| 632 | TP_STRUCT__entry( |
| 633 | __field(int, plane) |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 634 | __field(struct drm_i915_gem_object *, obj) |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 635 | ), |
| 636 | |
| 637 | TP_fast_assign( |
| 638 | __entry->plane = plane; |
| 639 | __entry->obj = obj; |
| 640 | ), |
| 641 | |
| 642 | TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) |
| 643 | ); |
| 644 | |
| 645 | TRACE_EVENT(i915_flip_complete, |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 646 | TP_PROTO(int plane, struct drm_i915_gem_object *obj), |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 647 | |
| 648 | TP_ARGS(plane, obj), |
| 649 | |
| 650 | TP_STRUCT__entry( |
| 651 | __field(int, plane) |
Chris Wilson | 05394f3 | 2010-11-08 19:18:58 +0000 | [diff] [blame] | 652 | __field(struct drm_i915_gem_object *, obj) |
Jesse Barnes | e5510fa | 2010-07-01 16:48:37 -0700 | [diff] [blame] | 653 | ), |
| 654 | |
| 655 | TP_fast_assign( |
| 656 | __entry->plane = plane; |
| 657 | __entry->obj = obj; |
| 658 | ), |
| 659 | |
| 660 | TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) |
| 661 | ); |
| 662 | |
Chris Wilson | ed71f1b | 2013-07-19 20:36:56 +0100 | [diff] [blame] | 663 | TRACE_EVENT_CONDITION(i915_reg_rw, |
| 664 | TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace), |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame] | 665 | |
Chris Wilson | ed71f1b | 2013-07-19 20:36:56 +0100 | [diff] [blame] | 666 | TP_ARGS(write, reg, val, len, trace), |
| 667 | |
| 668 | TP_CONDITION(trace), |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame] | 669 | |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 670 | TP_STRUCT__entry( |
| 671 | __field(u64, val) |
| 672 | __field(u32, reg) |
| 673 | __field(u16, write) |
| 674 | __field(u16, len) |
| 675 | ), |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame] | 676 | |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 677 | TP_fast_assign( |
| 678 | __entry->val = (u64)val; |
| 679 | __entry->reg = reg; |
| 680 | __entry->write = write; |
| 681 | __entry->len = len; |
| 682 | ), |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame] | 683 | |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 684 | TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)", |
| 685 | __entry->write ? "write" : "read", |
| 686 | __entry->reg, __entry->len, |
| 687 | (u32)(__entry->val & 0xffffffff), |
| 688 | (u32)(__entry->val >> 32)) |
Yuanhan Liu | ba4f01a | 2010-11-08 17:09:41 +0800 | [diff] [blame] | 689 | ); |
| 690 | |
Daniel Vetter | be2cde9a | 2012-08-30 13:26:48 +0200 | [diff] [blame] | 691 | TRACE_EVENT(intel_gpu_freq_change, |
| 692 | TP_PROTO(u32 freq), |
| 693 | TP_ARGS(freq), |
| 694 | |
| 695 | TP_STRUCT__entry( |
| 696 | __field(u32, freq) |
| 697 | ), |
| 698 | |
| 699 | TP_fast_assign( |
| 700 | __entry->freq = freq; |
| 701 | ), |
| 702 | |
| 703 | TP_printk("new_freq=%u", __entry->freq) |
| 704 | ); |
| 705 | |
Daniele Ceraolo Spurio | 198c974 | 2014-11-10 13:44:31 +0000 | [diff] [blame] | 706 | /** |
| 707 | * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints |
| 708 | * |
| 709 | * With full ppgtt enabled each process using drm will allocate at least one |
| 710 | * translation table. With these traces it is possible to keep track of the |
| 711 | * allocation and of the lifetime of the tables; this can be used during |
| 712 | * testing/debug to verify that we are not leaking ppgtts. |
| 713 | * These traces identify the ppgtt through the vm pointer, which is also printed |
| 714 | * by the i915_vma_bind and i915_vma_unbind tracepoints. |
| 715 | */ |
| 716 | DECLARE_EVENT_CLASS(i915_ppgtt, |
| 717 | TP_PROTO(struct i915_address_space *vm), |
| 718 | TP_ARGS(vm), |
| 719 | |
| 720 | TP_STRUCT__entry( |
| 721 | __field(struct i915_address_space *, vm) |
| 722 | __field(u32, dev) |
| 723 | ), |
| 724 | |
| 725 | TP_fast_assign( |
| 726 | __entry->vm = vm; |
| 727 | __entry->dev = vm->dev->primary->index; |
| 728 | ), |
| 729 | |
| 730 | TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm) |
| 731 | ) |
| 732 | |
| 733 | DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create, |
| 734 | TP_PROTO(struct i915_address_space *vm), |
| 735 | TP_ARGS(vm) |
| 736 | ); |
| 737 | |
| 738 | DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, |
| 739 | TP_PROTO(struct i915_address_space *vm), |
| 740 | TP_ARGS(vm) |
| 741 | ); |
| 742 | |
| 743 | /** |
| 744 | * DOC: i915_context_create and i915_context_free tracepoints |
| 745 | * |
| 746 | * These tracepoints are used to track creation and deletion of contexts. |
| 747 | * If full ppgtt is enabled, they also print the address of the vm assigned to |
| 748 | * the context. |
| 749 | */ |
| 750 | DECLARE_EVENT_CLASS(i915_context, |
| 751 | TP_PROTO(struct intel_context *ctx), |
| 752 | TP_ARGS(ctx), |
| 753 | |
| 754 | TP_STRUCT__entry( |
| 755 | __field(u32, dev) |
| 756 | __field(struct intel_context *, ctx) |
| 757 | __field(struct i915_address_space *, vm) |
| 758 | ), |
| 759 | |
| 760 | TP_fast_assign( |
| 761 | __entry->ctx = ctx; |
| 762 | __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; |
| 763 | __entry->dev = ctx->file_priv->dev_priv->dev->primary->index; |
| 764 | ), |
| 765 | |
| 766 | TP_printk("dev=%u, ctx=%p, ctx_vm=%p", |
| 767 | __entry->dev, __entry->ctx, __entry->vm) |
| 768 | ) |
| 769 | |
| 770 | DEFINE_EVENT(i915_context, i915_context_create, |
| 771 | TP_PROTO(struct intel_context *ctx), |
| 772 | TP_ARGS(ctx) |
| 773 | ); |
| 774 | |
| 775 | DEFINE_EVENT(i915_context, i915_context_free, |
| 776 | TP_PROTO(struct intel_context *ctx), |
| 777 | TP_ARGS(ctx) |
| 778 | ); |
| 779 | |
| 780 | /** |
| 781 | * DOC: switch_mm tracepoint |
| 782 | * |
| 783 | * This tracepoint allows tracking of the mm switch, which is an important point |
| 784 | * in the lifetime of the vm in the legacy submission path. This tracepoint is |
| 785 | * called only if full ppgtt is enabled. |
| 786 | */ |
| 787 | TRACE_EVENT(switch_mm, |
| 788 | TP_PROTO(struct intel_engine_cs *ring, struct intel_context *to), |
| 789 | |
| 790 | TP_ARGS(ring, to), |
| 791 | |
| 792 | TP_STRUCT__entry( |
| 793 | __field(u32, ring) |
| 794 | __field(struct intel_context *, to) |
| 795 | __field(struct i915_address_space *, vm) |
| 796 | __field(u32, dev) |
| 797 | ), |
| 798 | |
| 799 | TP_fast_assign( |
| 800 | __entry->ring = ring->id; |
| 801 | __entry->to = to; |
| 802 | __entry->vm = to->ppgtt? &to->ppgtt->base : NULL; |
| 803 | __entry->dev = ring->dev->primary->index; |
| 804 | ), |
| 805 | |
| 806 | TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p", |
| 807 | __entry->dev, __entry->ring, __entry->to, __entry->vm) |
| 808 | ); |
| 809 | |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 810 | #endif /* _I915_TRACE_H_ */ |
| 811 | |
| 812 | /* This part must be outside protection */ |
| 813 | #undef TRACE_INCLUDE_PATH |
Peter Clifton | a7c5427 | 2010-05-03 13:24:41 +0100 | [diff] [blame] | 814 | #define TRACE_INCLUDE_PATH . |
Chris Wilson | 1c5d22f | 2009-08-25 11:15:50 +0100 | [diff] [blame] | 815 | #include <trace/define_trace.h> |