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