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