Linux Audio

Check our new training course

Loading...
v4.6
 
  1#if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  2#define _I915_TRACE_H_
  3
  4#include <linux/stringify.h>
  5#include <linux/types.h>
  6#include <linux/tracepoint.h>
  7
  8#include <drm/drmP.h>
 
 
 
 
  9#include "i915_drv.h"
 10#include "intel_drv.h"
 11#include "intel_ringbuffer.h"
 12
 13#undef TRACE_SYSTEM
 14#define TRACE_SYSTEM i915
 15#define TRACE_INCLUDE_FILE i915_trace
 16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 17/* pipe updates */
 18
 19TRACE_EVENT(i915_pipe_update_start,
 20	    TP_PROTO(struct intel_crtc *crtc),
 21	    TP_ARGS(crtc),
 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);
 36			   __entry->min = crtc->debug.min_vbl;
 37			   __entry->max = crtc->debug.max_vbl;
 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
 45TRACE_EVENT(i915_pipe_update_vblank_evaded,
 46	    TP_PROTO(struct intel_crtc *crtc),
 47	    TP_ARGS(crtc),
 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;
 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;
 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
 70TRACE_EVENT(i915_pipe_update_end,
 71	    TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
 72	    TP_ARGS(crtc, frame, scanline_end),
 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;
 83			   __entry->scanline = scanline_end;
 84			   ),
 85
 86	    TP_printk("pipe %c, frame=%u, scanline=%u",
 87		      pipe_name(__entry->pipe), __entry->frame,
 88		      __entry->scanline)
 89);
 90
 91/* object tracking */
 92
 93TRACE_EVENT(i915_gem_object_create,
 94	    TP_PROTO(struct drm_i915_gem_object *obj),
 95	    TP_ARGS(obj),
 96
 97	    TP_STRUCT__entry(
 98			     __field(struct drm_i915_gem_object *, obj)
 99			     __field(u32, size)
100			     ),
101
102	    TP_fast_assign(
103			   __entry->obj = obj;
104			   __entry->size = obj->base.size;
105			   ),
106
107	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
108);
109
110TRACE_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
130TRACE_EVENT(i915_vma_bind,
131	    TP_PROTO(struct i915_vma *vma, unsigned flags),
132	    TP_ARGS(vma, flags),
133
134	    TP_STRUCT__entry(
135			     __field(struct drm_i915_gem_object *, obj)
136			     __field(struct i915_address_space *, vm)
137			     __field(u64, offset)
138			     __field(u32, size)
139			     __field(unsigned, flags)
140			     ),
141
142	    TP_fast_assign(
143			   __entry->obj = vma->obj;
144			   __entry->vm = vma->vm;
145			   __entry->offset = vma->node.start;
146			   __entry->size = vma->node.size;
147			   __entry->flags = flags;
148			   ),
149
150	    TP_printk("obj=%p, offset=%016llx size=%x%s vm=%p",
151		      __entry->obj, __entry->offset, __entry->size,
152		      __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
153		      __entry->vm)
154);
155
156TRACE_EVENT(i915_vma_unbind,
157	    TP_PROTO(struct i915_vma *vma),
158	    TP_ARGS(vma),
159
160	    TP_STRUCT__entry(
161			     __field(struct drm_i915_gem_object *, obj)
162			     __field(struct i915_address_space *, vm)
163			     __field(u64, offset)
164			     __field(u32, size)
165			     ),
166
167	    TP_fast_assign(
168			   __entry->obj = vma->obj;
169			   __entry->vm = vma->vm;
170			   __entry->offset = vma->node.start;
171			   __entry->size = vma->node.size;
172			   ),
173
174	    TP_printk("obj=%p, offset=%016llx size=%x vm=%p",
175		      __entry->obj, __entry->offset, __entry->size, __entry->vm)
176);
177
178TRACE_EVENT(i915_va_alloc,
179	TP_PROTO(struct i915_vma *vma),
180	TP_ARGS(vma),
181
182	TP_STRUCT__entry(
183		__field(struct i915_address_space *, vm)
184		__field(u64, start)
185		__field(u64, end)
186	),
187
188	TP_fast_assign(
189		__entry->vm = vma->vm;
190		__entry->start = vma->node.start;
191		__entry->end = vma->node.start + vma->node.size - 1;
192	),
193
194	TP_printk("vm=%p (%c), 0x%llx-0x%llx",
195		  __entry->vm, i915_is_ggtt(__entry->vm) ? 'G' : 'P',  __entry->start, __entry->end)
196);
197
198DECLARE_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),
201
202	TP_STRUCT__entry(
203		__field(struct i915_address_space *, vm)
204		__field(u32, px)
205		__field(u64, start)
206		__field(u64, end)
207	),
208
209	TP_fast_assign(
210		__entry->vm = vm;
211		__entry->px = px;
212		__entry->start = start;
213		__entry->end = ((start + (1ULL << px_shift)) & ~((1ULL << px_shift)-1)) - 1;
214	),
215
216	TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)",
217		  __entry->vm, __entry->px, __entry->start, __entry->end)
218);
219
220DEFINE_EVENT(i915_px_entry, i915_page_table_entry_alloc,
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
225DEFINE_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
233DEFINE_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
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
246DECLARE_EVENT_CLASS(i915_page_table_entry_update,
247	TP_PROTO(struct i915_address_space *vm, u32 pde,
248		 struct i915_page_table *pt, u32 first, u32 count, u32 bits),
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
276DEFINE_EVENT(i915_page_table_entry_update, i915_page_table_entry_map,
277	TP_PROTO(struct i915_address_space *vm, u32 pde,
278		 struct i915_page_table *pt, u32 first, u32 count, u32 bits),
279	TP_ARGS(vm, pde, pt, first, count, bits)
280);
281
282TRACE_EVENT(i915_gem_object_change_domain,
283	    TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write),
284	    TP_ARGS(obj, old_read, old_write),
285
286	    TP_STRUCT__entry(
287			     __field(struct drm_i915_gem_object *, obj)
288			     __field(u32, read_domains)
289			     __field(u32, write_domain)
290			     ),
291
292	    TP_fast_assign(
293			   __entry->obj = obj;
294			   __entry->read_domains = obj->base.read_domains | (old_read << 16);
295			   __entry->write_domain = obj->base.write_domain | (old_write << 16);
296			   ),
297
298	    TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
299		      __entry->obj,
300		      __entry->read_domains >> 16,
301		      __entry->read_domains & 0xffff,
302		      __entry->write_domain >> 16,
303		      __entry->write_domain & 0xffff)
304);
305
306TRACE_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
326TRACE_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
346TRACE_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" : "")
369);
370
371DECLARE_EVENT_CLASS(i915_gem_object,
372	    TP_PROTO(struct drm_i915_gem_object *obj),
373	    TP_ARGS(obj),
374
375	    TP_STRUCT__entry(
376			     __field(struct drm_i915_gem_object *, obj)
377			     ),
378
379	    TP_fast_assign(
380			   __entry->obj = obj;
381			   ),
382
383	    TP_printk("obj=%p", __entry->obj)
384);
385
386DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
387	     TP_PROTO(struct drm_i915_gem_object *obj),
388	     TP_ARGS(obj)
389);
390
391DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
392	    TP_PROTO(struct drm_i915_gem_object *obj),
393	    TP_ARGS(obj)
394);
395
396TRACE_EVENT(i915_gem_evict,
397	    TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags),
398	    TP_ARGS(dev, size, align, flags),
399
400	    TP_STRUCT__entry(
401			     __field(u32, dev)
402			     __field(u32, size)
403			     __field(u32, align)
404			     __field(unsigned, flags)
 
405			    ),
406
407	    TP_fast_assign(
408			   __entry->dev = dev->primary->index;
 
409			   __entry->size = size;
410			   __entry->align = align;
411			   __entry->flags = flags;
412			  ),
413
414	    TP_printk("dev=%d, size=%d, align=%d %s",
415		      __entry->dev, __entry->size, __entry->align,
416		      __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
417);
418
419TRACE_EVENT(i915_gem_evict_everything,
420	    TP_PROTO(struct drm_device *dev),
421	    TP_ARGS(dev),
422
423	    TP_STRUCT__entry(
424			     __field(u32, dev)
 
 
 
 
 
425			    ),
426
427	    TP_fast_assign(
428			   __entry->dev = dev->primary->index;
 
 
 
 
 
429			  ),
430
431	    TP_printk("dev=%d", __entry->dev)
 
 
 
432);
433
434TRACE_EVENT(i915_gem_evict_vm,
435	    TP_PROTO(struct i915_address_space *vm),
436	    TP_ARGS(vm),
437
438	    TP_STRUCT__entry(
439			     __field(u32, dev)
440			     __field(struct i915_address_space *, vm)
441			    ),
442
443	    TP_fast_assign(
444			   __entry->dev = vm->dev->primary->index;
445			   __entry->vm = vm;
446			  ),
447
448	    TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
449);
450
451TRACE_EVENT(i915_gem_ring_sync_to,
452	    TP_PROTO(struct drm_i915_gem_request *to_req,
453		     struct intel_engine_cs *from,
454		     struct drm_i915_gem_request *req),
455	    TP_ARGS(to_req, from, req),
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(
465			   __entry->dev = from->dev->primary->index;
466			   __entry->sync_from = from->id;
467			   __entry->sync_to = to_req->ring->id;
468			   __entry->seqno = i915_gem_request_get_seqno(req);
 
 
 
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
477TRACE_EVENT(i915_gem_ring_dispatch,
478	    TP_PROTO(struct drm_i915_gem_request *req, u32 flags),
479	    TP_ARGS(req, flags),
480
481	    TP_STRUCT__entry(
482			     __field(u32, dev)
483			     __field(u32, ring)
 
 
 
484			     __field(u32, seqno)
485			     __field(u32, flags)
486			     ),
487
488	    TP_fast_assign(
489			   struct intel_engine_cs *ring =
490						i915_gem_request_get_ring(req);
491			   __entry->dev = ring->dev->primary->index;
492			   __entry->ring = ring->id;
493			   __entry->seqno = i915_gem_request_get_seqno(req);
494			   __entry->flags = flags;
495			   i915_trace_irq_get(ring, req);
496			   ),
497
498	    TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
499		      __entry->dev, __entry->ring, __entry->seqno, __entry->flags)
 
500);
501
502TRACE_EVENT(i915_gem_ring_flush,
503	    TP_PROTO(struct drm_i915_gem_request *req, u32 invalidate, u32 flush),
504	    TP_ARGS(req, invalidate, flush),
505
506	    TP_STRUCT__entry(
507			     __field(u32, dev)
508			     __field(u32, ring)
509			     __field(u32, invalidate)
510			     __field(u32, flush)
511			     ),
512
513	    TP_fast_assign(
514			   __entry->dev = req->ring->dev->primary->index;
515			   __entry->ring = req->ring->id;
516			   __entry->invalidate = invalidate;
517			   __entry->flush = flush;
518			   ),
519
520	    TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
521		      __entry->dev, __entry->ring,
522		      __entry->invalidate, __entry->flush)
523);
524
525DECLARE_EVENT_CLASS(i915_gem_request,
526	    TP_PROTO(struct drm_i915_gem_request *req),
527	    TP_ARGS(req),
528
529	    TP_STRUCT__entry(
530			     __field(u32, dev)
531			     __field(u32, ring)
 
 
 
532			     __field(u32, seqno)
533			     ),
 
 
534
535	    TP_fast_assign(
536			   struct intel_engine_cs *ring =
537						i915_gem_request_get_ring(req);
538			   __entry->dev = ring->dev->primary->index;
539			   __entry->ring = ring->id;
540			   __entry->seqno = i915_gem_request_get_seqno(req);
541			   ),
542
543	    TP_printk("dev=%u, ring=%u, seqno=%u",
544		      __entry->dev, __entry->ring, __entry->seqno)
545);
546
547DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
548	    TP_PROTO(struct drm_i915_gem_request *req),
549	    TP_ARGS(req)
550);
551
552TRACE_EVENT(i915_gem_request_notify,
553	    TP_PROTO(struct intel_engine_cs *ring),
554	    TP_ARGS(ring),
555
556	    TP_STRUCT__entry(
557			     __field(u32, dev)
558			     __field(u32, ring)
 
 
 
559			     __field(u32, seqno)
560			     ),
 
561
562	    TP_fast_assign(
563			   __entry->dev = ring->dev->primary->index;
564			   __entry->ring = ring->id;
565			   __entry->seqno = ring->get_seqno(ring, false);
566			   ),
567
568	    TP_printk("dev=%u, ring=%u, seqno=%u",
569		      __entry->dev, __entry->ring, __entry->seqno)
570);
571
572DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
573	    TP_PROTO(struct drm_i915_gem_request *req),
574	    TP_ARGS(req)
575);
576
577DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
578	    TP_PROTO(struct drm_i915_gem_request *req),
579	    TP_ARGS(req)
580);
581
582TRACE_EVENT(i915_gem_request_wait_begin,
583	    TP_PROTO(struct drm_i915_gem_request *req),
584	    TP_ARGS(req),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
586	    TP_STRUCT__entry(
587			     __field(u32, dev)
588			     __field(u32, ring)
 
 
 
589			     __field(u32, seqno)
590			     __field(bool, blocking)
591			     ),
592
593	    /* NB: the blocking information is racy since mutex_is_locked
594	     * doesn't check that the current thread holds the lock. The only
595	     * other option would be to pass the boolean information of whether
596	     * or not the class was blocking down through the stack which is
597	     * less desirable.
598	     */
599	    TP_fast_assign(
600			   struct intel_engine_cs *ring =
601						i915_gem_request_get_ring(req);
602			   __entry->dev = ring->dev->primary->index;
603			   __entry->ring = ring->id;
604			   __entry->seqno = i915_gem_request_get_seqno(req);
605			   __entry->blocking =
606				     mutex_is_locked(&ring->dev->struct_mutex);
607			   ),
608
609	    TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
610		      __entry->dev, __entry->ring,
611		      __entry->seqno, __entry->blocking ?  "yes (NB)" : "no")
 
612);
613
614DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
615	    TP_PROTO(struct drm_i915_gem_request *req),
616	    TP_ARGS(req)
617);
618
619TRACE_EVENT(i915_flip_request,
620	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
621
622	    TP_ARGS(plane, obj),
623
624	    TP_STRUCT__entry(
625		    __field(int, plane)
626		    __field(struct drm_i915_gem_object *, obj)
627		    ),
628
629	    TP_fast_assign(
630		    __entry->plane = plane;
631		    __entry->obj = obj;
632		    ),
633
634	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
635);
636
637TRACE_EVENT(i915_flip_complete,
638	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
639
640	    TP_ARGS(plane, obj),
641
642	    TP_STRUCT__entry(
643		    __field(int, plane)
644		    __field(struct drm_i915_gem_object *, obj)
645		    ),
646
647	    TP_fast_assign(
648		    __entry->plane = plane;
649		    __entry->obj = obj;
650		    ),
651
652	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
653);
654
655TRACE_EVENT_CONDITION(i915_reg_rw,
656	TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
657
658	TP_ARGS(write, reg, val, len, trace),
659
660	TP_CONDITION(trace),
661
662	TP_STRUCT__entry(
663		__field(u64, val)
664		__field(u32, reg)
665		__field(u16, write)
666		__field(u16, len)
667		),
668
669	TP_fast_assign(
670		__entry->val = (u64)val;
671		__entry->reg = i915_mmio_reg_offset(reg);
672		__entry->write = write;
673		__entry->len = len;
674		),
675
676	TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
677		__entry->write ? "write" : "read",
678		__entry->reg, __entry->len,
679		(u32)(__entry->val & 0xffffffff),
680		(u32)(__entry->val >> 32))
681);
682
683TRACE_EVENT(intel_gpu_freq_change,
684	    TP_PROTO(u32 freq),
685	    TP_ARGS(freq),
686
687	    TP_STRUCT__entry(
688			     __field(u32, freq)
689			     ),
690
691	    TP_fast_assign(
692			   __entry->freq = freq;
693			   ),
694
695	    TP_printk("new_freq=%u", __entry->freq)
696);
697
698/**
699 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
700 *
701 * With full ppgtt enabled each process using drm will allocate at least one
702 * translation table. With these traces it is possible to keep track of the
703 * allocation and of the lifetime of the tables; this can be used during
704 * testing/debug to verify that we are not leaking ppgtts.
705 * These traces identify the ppgtt through the vm pointer, which is also printed
706 * by the i915_vma_bind and i915_vma_unbind tracepoints.
707 */
708DECLARE_EVENT_CLASS(i915_ppgtt,
709	TP_PROTO(struct i915_address_space *vm),
710	TP_ARGS(vm),
711
712	TP_STRUCT__entry(
713			__field(struct i915_address_space *, vm)
714			__field(u32, dev)
715	),
716
717	TP_fast_assign(
718			__entry->vm = vm;
719			__entry->dev = vm->dev->primary->index;
720	),
721
722	TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
723)
724
725DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
726	TP_PROTO(struct i915_address_space *vm),
727	TP_ARGS(vm)
728);
729
730DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
731	TP_PROTO(struct i915_address_space *vm),
732	TP_ARGS(vm)
733);
734
735/**
736 * DOC: i915_context_create and i915_context_free tracepoints
737 *
738 * These tracepoints are used to track creation and deletion of contexts.
739 * If full ppgtt is enabled, they also print the address of the vm assigned to
740 * the context.
741 */
742DECLARE_EVENT_CLASS(i915_context,
743	TP_PROTO(struct intel_context *ctx),
744	TP_ARGS(ctx),
745
746	TP_STRUCT__entry(
747			__field(u32, dev)
748			__field(struct intel_context *, ctx)
 
749			__field(struct i915_address_space *, vm)
750	),
751
752	TP_fast_assign(
 
753			__entry->ctx = ctx;
754			__entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
755			__entry->dev = ctx->i915->dev->primary->index;
756	),
757
758	TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
759		  __entry->dev, __entry->ctx, __entry->vm)
760)
761
762DEFINE_EVENT(i915_context, i915_context_create,
763	TP_PROTO(struct intel_context *ctx),
764	TP_ARGS(ctx)
765);
766
767DEFINE_EVENT(i915_context, i915_context_free,
768	TP_PROTO(struct intel_context *ctx),
769	TP_ARGS(ctx)
770);
771
772/**
773 * DOC: switch_mm tracepoint
774 *
775 * This tracepoint allows tracking of the mm switch, which is an important point
776 * in the lifetime of the vm in the legacy submission path. This tracepoint is
777 * called only if full ppgtt is enabled.
778 */
779TRACE_EVENT(switch_mm,
780	TP_PROTO(struct intel_engine_cs *ring, struct intel_context *to),
781
782	TP_ARGS(ring, to),
783
784	TP_STRUCT__entry(
785			__field(u32, ring)
786			__field(struct intel_context *, to)
787			__field(struct i915_address_space *, vm)
788			__field(u32, dev)
789	),
790
791	TP_fast_assign(
792			__entry->ring = ring->id;
793			__entry->to = to;
794			__entry->vm = to->ppgtt? &to->ppgtt->base : NULL;
795			__entry->dev = ring->dev->primary->index;
796	),
797
798	TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p",
799		  __entry->dev, __entry->ring, __entry->to, __entry->vm)
800);
801
802#endif /* _I915_TRACE_H_ */
803
804/* This part must be outside protection */
805#undef TRACE_INCLUDE_PATH
806#define TRACE_INCLUDE_PATH .
807#include <trace/define_trace.h>
v5.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  3#define _I915_TRACE_H_
  4
  5#include <linux/stringify.h>
  6#include <linux/types.h>
  7#include <linux/tracepoint.h>
  8
  9#include <drm/drm_drv.h>
 10
 11#include "display/intel_display_types.h"
 12#include "gt/intel_engine.h"
 13
 14#include "i915_drv.h"
 15#include "i915_irq.h"
 
 16
 17#undef TRACE_SYSTEM
 18#define TRACE_SYSTEM i915
 19#define TRACE_INCLUDE_FILE i915_trace
 20
 21/* watermark/fifo updates */
 22
 23TRACE_EVENT(intel_pipe_enable,
 24	    TP_PROTO(struct intel_crtc *crtc),
 25	    TP_ARGS(crtc),
 26
 27	    TP_STRUCT__entry(
 28			     __array(u32, frame, 3)
 29			     __array(u32, scanline, 3)
 30			     __field(enum pipe, pipe)
 31			     ),
 32	    TP_fast_assign(
 33			   struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 34			   struct intel_crtc *it__;
 35			   for_each_intel_crtc(&dev_priv->drm, it__) {
 36				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
 37				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
 38			   }
 39			   __entry->pipe = crtc->pipe;
 40			   ),
 41
 42	    TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
 43		      pipe_name(__entry->pipe),
 44		      __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
 45		      __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
 46		      __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
 47);
 48
 49TRACE_EVENT(intel_pipe_disable,
 50	    TP_PROTO(struct intel_crtc *crtc),
 51	    TP_ARGS(crtc),
 52
 53	    TP_STRUCT__entry(
 54			     __array(u32, frame, 3)
 55			     __array(u32, scanline, 3)
 56			     __field(enum pipe, pipe)
 57			     ),
 58
 59	    TP_fast_assign(
 60			   struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 61			   struct intel_crtc *it__;
 62			   for_each_intel_crtc(&dev_priv->drm, it__) {
 63				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
 64				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
 65			   }
 66			   __entry->pipe = crtc->pipe;
 67			   ),
 68
 69	    TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
 70		      pipe_name(__entry->pipe),
 71		      __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
 72		      __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
 73		      __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
 74);
 75
 76TRACE_EVENT(intel_pipe_crc,
 77	    TP_PROTO(struct intel_crtc *crtc, const u32 *crcs),
 78	    TP_ARGS(crtc, crcs),
 79
 80	    TP_STRUCT__entry(
 81			     __field(enum pipe, pipe)
 82			     __field(u32, frame)
 83			     __field(u32, scanline)
 84			     __array(u32, crcs, 5)
 85			     ),
 86
 87	    TP_fast_assign(
 88			   __entry->pipe = crtc->pipe;
 89			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
 90			   __entry->scanline = intel_get_crtc_scanline(crtc);
 91			   memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
 92			   ),
 93
 94	    TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
 95		      pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
 96		      __entry->crcs[0], __entry->crcs[1], __entry->crcs[2],
 97		      __entry->crcs[3], __entry->crcs[4])
 98);
 99
100TRACE_EVENT(intel_cpu_fifo_underrun,
101	    TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
102	    TP_ARGS(dev_priv, pipe),
103
104	    TP_STRUCT__entry(
105			     __field(enum pipe, pipe)
106			     __field(u32, frame)
107			     __field(u32, scanline)
108			     ),
109
110	    TP_fast_assign(
111			    struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
112			   __entry->pipe = pipe;
113			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
114			   __entry->scanline = intel_get_crtc_scanline(crtc);
115			   ),
116
117	    TP_printk("pipe %c, frame=%u, scanline=%u",
118		      pipe_name(__entry->pipe),
119		      __entry->frame, __entry->scanline)
120);
121
122TRACE_EVENT(intel_pch_fifo_underrun,
123	    TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pch_transcoder),
124	    TP_ARGS(dev_priv, pch_transcoder),
125
126	    TP_STRUCT__entry(
127			     __field(enum pipe, pipe)
128			     __field(u32, frame)
129			     __field(u32, scanline)
130			     ),
131
132	    TP_fast_assign(
133			   enum pipe pipe = pch_transcoder;
134			   struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
135			   __entry->pipe = pipe;
136			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
137			   __entry->scanline = intel_get_crtc_scanline(crtc);
138			   ),
139
140	    TP_printk("pch transcoder %c, frame=%u, scanline=%u",
141		      pipe_name(__entry->pipe),
142		      __entry->frame, __entry->scanline)
143);
144
145TRACE_EVENT(intel_memory_cxsr,
146	    TP_PROTO(struct drm_i915_private *dev_priv, bool old, bool new),
147	    TP_ARGS(dev_priv, old, new),
148
149	    TP_STRUCT__entry(
150			     __array(u32, frame, 3)
151			     __array(u32, scanline, 3)
152			     __field(bool, old)
153			     __field(bool, new)
154			     ),
155
156	    TP_fast_assign(
157			   struct intel_crtc *crtc;
158			   for_each_intel_crtc(&dev_priv->drm, crtc) {
159				   __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
160				   __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
161			   }
162			   __entry->old = old;
163			   __entry->new = new;
164			   ),
165
166	    TP_printk("%s->%s, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
167		      onoff(__entry->old), onoff(__entry->new),
168		      __entry->frame[PIPE_A], __entry->scanline[PIPE_A],
169		      __entry->frame[PIPE_B], __entry->scanline[PIPE_B],
170		      __entry->frame[PIPE_C], __entry->scanline[PIPE_C])
171);
172
173TRACE_EVENT(g4x_wm,
174	    TP_PROTO(struct intel_crtc *crtc, const struct g4x_wm_values *wm),
175	    TP_ARGS(crtc, wm),
176
177	    TP_STRUCT__entry(
178			     __field(enum pipe, pipe)
179			     __field(u32, frame)
180			     __field(u32, scanline)
181			     __field(u16, primary)
182			     __field(u16, sprite)
183			     __field(u16, cursor)
184			     __field(u16, sr_plane)
185			     __field(u16, sr_cursor)
186			     __field(u16, sr_fbc)
187			     __field(u16, hpll_plane)
188			     __field(u16, hpll_cursor)
189			     __field(u16, hpll_fbc)
190			     __field(bool, cxsr)
191			     __field(bool, hpll)
192			     __field(bool, fbc)
193			     ),
194
195	    TP_fast_assign(
196			   __entry->pipe = crtc->pipe;
197			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
198			   __entry->scanline = intel_get_crtc_scanline(crtc);
199			   __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
200			   __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
201			   __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
202			   __entry->sr_plane = wm->sr.plane;
203			   __entry->sr_cursor = wm->sr.cursor;
204			   __entry->sr_fbc = wm->sr.fbc;
205			   __entry->hpll_plane = wm->hpll.plane;
206			   __entry->hpll_cursor = wm->hpll.cursor;
207			   __entry->hpll_fbc = wm->hpll.fbc;
208			   __entry->cxsr = wm->cxsr;
209			   __entry->hpll = wm->hpll_en;
210			   __entry->fbc = wm->fbc_en;
211			   ),
212
213	    TP_printk("pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
214		      pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
215		      __entry->primary, __entry->sprite, __entry->cursor,
216		      yesno(__entry->cxsr), __entry->sr_plane, __entry->sr_cursor, __entry->sr_fbc,
217		      yesno(__entry->hpll), __entry->hpll_plane, __entry->hpll_cursor, __entry->hpll_fbc,
218		      yesno(__entry->fbc))
219);
220
221TRACE_EVENT(vlv_wm,
222	    TP_PROTO(struct intel_crtc *crtc, const struct vlv_wm_values *wm),
223	    TP_ARGS(crtc, wm),
224
225	    TP_STRUCT__entry(
226			     __field(enum pipe, pipe)
227			     __field(u32, frame)
228			     __field(u32, scanline)
229			     __field(u32, level)
230			     __field(u32, cxsr)
231			     __field(u32, primary)
232			     __field(u32, sprite0)
233			     __field(u32, sprite1)
234			     __field(u32, cursor)
235			     __field(u32, sr_plane)
236			     __field(u32, sr_cursor)
237			     ),
238
239	    TP_fast_assign(
240			   __entry->pipe = crtc->pipe;
241			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
242			   __entry->scanline = intel_get_crtc_scanline(crtc);
243			   __entry->level = wm->level;
244			   __entry->cxsr = wm->cxsr;
245			   __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
246			   __entry->sprite0 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
247			   __entry->sprite1 = wm->pipe[crtc->pipe].plane[PLANE_SPRITE1];
248			   __entry->cursor = wm->pipe[crtc->pipe].plane[PLANE_CURSOR];
249			   __entry->sr_plane = wm->sr.plane;
250			   __entry->sr_cursor = wm->sr.cursor;
251			   ),
252
253	    TP_printk("pipe %c, frame=%u, scanline=%u, level=%d, cxsr=%d, wm %d/%d/%d/%d, sr %d/%d",
254		      pipe_name(__entry->pipe), __entry->frame,
255		      __entry->scanline, __entry->level, __entry->cxsr,
256		      __entry->primary, __entry->sprite0, __entry->sprite1, __entry->cursor,
257		      __entry->sr_plane, __entry->sr_cursor)
258);
259
260TRACE_EVENT(vlv_fifo_size,
261	    TP_PROTO(struct intel_crtc *crtc, u32 sprite0_start, u32 sprite1_start, u32 fifo_size),
262	    TP_ARGS(crtc, sprite0_start, sprite1_start, fifo_size),
263
264	    TP_STRUCT__entry(
265			     __field(enum pipe, pipe)
266			     __field(u32, frame)
267			     __field(u32, scanline)
268			     __field(u32, sprite0_start)
269			     __field(u32, sprite1_start)
270			     __field(u32, fifo_size)
271			     ),
272
273	    TP_fast_assign(
274			   __entry->pipe = crtc->pipe;
275			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
276			   __entry->scanline = intel_get_crtc_scanline(crtc);
277			   __entry->sprite0_start = sprite0_start;
278			   __entry->sprite1_start = sprite1_start;
279			   __entry->fifo_size = fifo_size;
280			   ),
281
282	    TP_printk("pipe %c, frame=%u, scanline=%u, %d/%d/%d",
283		      pipe_name(__entry->pipe), __entry->frame,
284		      __entry->scanline, __entry->sprite0_start,
285		      __entry->sprite1_start, __entry->fifo_size)
286);
287
288/* plane updates */
289
290TRACE_EVENT(intel_update_plane,
291	    TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
292	    TP_ARGS(plane, crtc),
293
294	    TP_STRUCT__entry(
295			     __field(enum pipe, pipe)
296			     __field(u32, frame)
297			     __field(u32, scanline)
298			     __array(int, src, 4)
299			     __array(int, dst, 4)
300			     __string(name, plane->name)
301			     ),
302
303	    TP_fast_assign(
304			   __assign_str(name, plane->name);
305			   __entry->pipe = crtc->pipe;
306			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
307			   __entry->scanline = intel_get_crtc_scanline(crtc);
308			   memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
309			   memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
310			   ),
311
312	    TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
313		      pipe_name(__entry->pipe), __get_str(name),
314		      __entry->frame, __entry->scanline,
315		      DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
316		      DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
317);
318
319TRACE_EVENT(intel_disable_plane,
320	    TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
321	    TP_ARGS(plane, crtc),
322
323	    TP_STRUCT__entry(
324			     __field(enum pipe, pipe)
325			     __field(u32, frame)
326			     __field(u32, scanline)
327			     __string(name, plane->name)
328			     ),
329
330	    TP_fast_assign(
331			   __assign_str(name, plane->name);
332			   __entry->pipe = crtc->pipe;
333			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
334			   __entry->scanline = intel_get_crtc_scanline(crtc);
335			   ),
336
337	    TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
338		      pipe_name(__entry->pipe), __get_str(name),
339		      __entry->frame, __entry->scanline)
340);
341
342/* pipe updates */
343
344TRACE_EVENT(i915_pipe_update_start,
345	    TP_PROTO(struct intel_crtc *crtc),
346	    TP_ARGS(crtc),
347
348	    TP_STRUCT__entry(
349			     __field(enum pipe, pipe)
350			     __field(u32, frame)
351			     __field(u32, scanline)
352			     __field(u32, min)
353			     __field(u32, max)
354			     ),
355
356	    TP_fast_assign(
357			   __entry->pipe = crtc->pipe;
358			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
 
359			   __entry->scanline = intel_get_crtc_scanline(crtc);
360			   __entry->min = crtc->debug.min_vbl;
361			   __entry->max = crtc->debug.max_vbl;
362			   ),
363
364	    TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
365		      pipe_name(__entry->pipe), __entry->frame,
366		       __entry->scanline, __entry->min, __entry->max)
367);
368
369TRACE_EVENT(i915_pipe_update_vblank_evaded,
370	    TP_PROTO(struct intel_crtc *crtc),
371	    TP_ARGS(crtc),
372
373	    TP_STRUCT__entry(
374			     __field(enum pipe, pipe)
375			     __field(u32, frame)
376			     __field(u32, scanline)
377			     __field(u32, min)
378			     __field(u32, max)
379			     ),
380
381	    TP_fast_assign(
382			   __entry->pipe = crtc->pipe;
383			   __entry->frame = crtc->debug.start_vbl_count;
384			   __entry->scanline = crtc->debug.scanline_start;
385			   __entry->min = crtc->debug.min_vbl;
386			   __entry->max = crtc->debug.max_vbl;
387			   ),
388
389	    TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u",
390		      pipe_name(__entry->pipe), __entry->frame,
391		       __entry->scanline, __entry->min, __entry->max)
392);
393
394TRACE_EVENT(i915_pipe_update_end,
395	    TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end),
396	    TP_ARGS(crtc, frame, scanline_end),
397
398	    TP_STRUCT__entry(
399			     __field(enum pipe, pipe)
400			     __field(u32, frame)
401			     __field(u32, scanline)
402			     ),
403
404	    TP_fast_assign(
405			   __entry->pipe = crtc->pipe;
406			   __entry->frame = frame;
407			   __entry->scanline = scanline_end;
408			   ),
409
410	    TP_printk("pipe %c, frame=%u, scanline=%u",
411		      pipe_name(__entry->pipe), __entry->frame,
412		      __entry->scanline)
413);
414
415/* object tracking */
416
417TRACE_EVENT(i915_gem_object_create,
418	    TP_PROTO(struct drm_i915_gem_object *obj),
419	    TP_ARGS(obj),
420
421	    TP_STRUCT__entry(
422			     __field(struct drm_i915_gem_object *, obj)
423			     __field(u64, size)
424			     ),
425
426	    TP_fast_assign(
427			   __entry->obj = obj;
428			   __entry->size = obj->base.size;
429			   ),
430
431	    TP_printk("obj=%p, size=0x%llx", __entry->obj, __entry->size)
432);
433
434TRACE_EVENT(i915_gem_shrink,
435	    TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags),
436	    TP_ARGS(i915, target, flags),
437
438	    TP_STRUCT__entry(
439			     __field(int, dev)
440			     __field(unsigned long, target)
441			     __field(unsigned, flags)
442			     ),
443
444	    TP_fast_assign(
445			   __entry->dev = i915->drm.primary->index;
446			   __entry->target = target;
447			   __entry->flags = flags;
448			   ),
449
450	    TP_printk("dev=%d, target=%lu, flags=%x",
451		      __entry->dev, __entry->target, __entry->flags)
452);
453
454TRACE_EVENT(i915_vma_bind,
455	    TP_PROTO(struct i915_vma *vma, unsigned flags),
456	    TP_ARGS(vma, flags),
457
458	    TP_STRUCT__entry(
459			     __field(struct drm_i915_gem_object *, obj)
460			     __field(struct i915_address_space *, vm)
461			     __field(u64, offset)
462			     __field(u64, size)
463			     __field(unsigned, flags)
464			     ),
465
466	    TP_fast_assign(
467			   __entry->obj = vma->obj;
468			   __entry->vm = vma->vm;
469			   __entry->offset = vma->node.start;
470			   __entry->size = vma->node.size;
471			   __entry->flags = flags;
472			   ),
473
474	    TP_printk("obj=%p, offset=0x%016llx size=0x%llx%s vm=%p",
475		      __entry->obj, __entry->offset, __entry->size,
476		      __entry->flags & PIN_MAPPABLE ? ", mappable" : "",
477		      __entry->vm)
478);
479
480TRACE_EVENT(i915_vma_unbind,
481	    TP_PROTO(struct i915_vma *vma),
482	    TP_ARGS(vma),
483
484	    TP_STRUCT__entry(
485			     __field(struct drm_i915_gem_object *, obj)
486			     __field(struct i915_address_space *, vm)
487			     __field(u64, offset)
488			     __field(u64, size)
489			     ),
490
491	    TP_fast_assign(
492			   __entry->obj = vma->obj;
493			   __entry->vm = vma->vm;
494			   __entry->offset = vma->node.start;
495			   __entry->size = vma->node.size;
496			   ),
497
498	    TP_printk("obj=%p, offset=0x%016llx size=0x%llx vm=%p",
499		      __entry->obj, __entry->offset, __entry->size, __entry->vm)
500);
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502TRACE_EVENT(i915_gem_object_pwrite,
503	    TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
504	    TP_ARGS(obj, offset, len),
505
506	    TP_STRUCT__entry(
507			     __field(struct drm_i915_gem_object *, obj)
508			     __field(u64, offset)
509			     __field(u64, len)
510			     ),
511
512	    TP_fast_assign(
513			   __entry->obj = obj;
514			   __entry->offset = offset;
515			   __entry->len = len;
516			   ),
517
518	    TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
519		      __entry->obj, __entry->offset, __entry->len)
520);
521
522TRACE_EVENT(i915_gem_object_pread,
523	    TP_PROTO(struct drm_i915_gem_object *obj, u64 offset, u64 len),
524	    TP_ARGS(obj, offset, len),
525
526	    TP_STRUCT__entry(
527			     __field(struct drm_i915_gem_object *, obj)
528			     __field(u64, offset)
529			     __field(u64, len)
530			     ),
531
532	    TP_fast_assign(
533			   __entry->obj = obj;
534			   __entry->offset = offset;
535			   __entry->len = len;
536			   ),
537
538	    TP_printk("obj=%p, offset=0x%llx, len=0x%llx",
539		      __entry->obj, __entry->offset, __entry->len)
540);
541
542TRACE_EVENT(i915_gem_object_fault,
543	    TP_PROTO(struct drm_i915_gem_object *obj, u64 index, bool gtt, bool write),
544	    TP_ARGS(obj, index, gtt, write),
545
546	    TP_STRUCT__entry(
547			     __field(struct drm_i915_gem_object *, obj)
548			     __field(u64, index)
549			     __field(bool, gtt)
550			     __field(bool, write)
551			     ),
552
553	    TP_fast_assign(
554			   __entry->obj = obj;
555			   __entry->index = index;
556			   __entry->gtt = gtt;
557			   __entry->write = write;
558			   ),
559
560	    TP_printk("obj=%p, %s index=%llu %s",
561		      __entry->obj,
562		      __entry->gtt ? "GTT" : "CPU",
563		      __entry->index,
564		      __entry->write ? ", writable" : "")
565);
566
567DECLARE_EVENT_CLASS(i915_gem_object,
568	    TP_PROTO(struct drm_i915_gem_object *obj),
569	    TP_ARGS(obj),
570
571	    TP_STRUCT__entry(
572			     __field(struct drm_i915_gem_object *, obj)
573			     ),
574
575	    TP_fast_assign(
576			   __entry->obj = obj;
577			   ),
578
579	    TP_printk("obj=%p", __entry->obj)
580);
581
582DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
583	     TP_PROTO(struct drm_i915_gem_object *obj),
584	     TP_ARGS(obj)
585);
586
587DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
588	    TP_PROTO(struct drm_i915_gem_object *obj),
589	    TP_ARGS(obj)
590);
591
592TRACE_EVENT(i915_gem_evict,
593	    TP_PROTO(struct i915_address_space *vm, u64 size, u64 align, unsigned int flags),
594	    TP_ARGS(vm, size, align, flags),
595
596	    TP_STRUCT__entry(
597			     __field(u32, dev)
598			     __field(struct i915_address_space *, vm)
599			     __field(u64, size)
600			     __field(u64, align)
601			     __field(unsigned int, flags)
602			    ),
603
604	    TP_fast_assign(
605			   __entry->dev = vm->i915->drm.primary->index;
606			   __entry->vm = vm;
607			   __entry->size = size;
608			   __entry->align = align;
609			   __entry->flags = flags;
610			  ),
611
612	    TP_printk("dev=%d, vm=%p, size=0x%llx, align=0x%llx %s",
613		      __entry->dev, __entry->vm, __entry->size, __entry->align,
614		      __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
615);
616
617TRACE_EVENT(i915_gem_evict_node,
618	    TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags),
619	    TP_ARGS(vm, node, flags),
620
621	    TP_STRUCT__entry(
622			     __field(u32, dev)
623			     __field(struct i915_address_space *, vm)
624			     __field(u64, start)
625			     __field(u64, size)
626			     __field(unsigned long, color)
627			     __field(unsigned int, flags)
628			    ),
629
630	    TP_fast_assign(
631			   __entry->dev = vm->i915->drm.primary->index;
632			   __entry->vm = vm;
633			   __entry->start = node->start;
634			   __entry->size = node->size;
635			   __entry->color = node->color;
636			   __entry->flags = flags;
637			  ),
638
639	    TP_printk("dev=%d, vm=%p, start=0x%llx size=0x%llx, color=0x%lx, flags=%x",
640		      __entry->dev, __entry->vm,
641		      __entry->start, __entry->size,
642		      __entry->color, __entry->flags)
643);
644
645TRACE_EVENT(i915_gem_evict_vm,
646	    TP_PROTO(struct i915_address_space *vm),
647	    TP_ARGS(vm),
648
649	    TP_STRUCT__entry(
650			     __field(u32, dev)
651			     __field(struct i915_address_space *, vm)
652			    ),
653
654	    TP_fast_assign(
655			   __entry->dev = vm->i915->drm.primary->index;
656			   __entry->vm = vm;
657			  ),
658
659	    TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm)
660);
661
662TRACE_EVENT(i915_request_queue,
663	    TP_PROTO(struct i915_request *rq, u32 flags),
664	    TP_ARGS(rq, flags),
 
 
665
666	    TP_STRUCT__entry(
667			     __field(u32, dev)
668			     __field(u32, hw_id)
669			     __field(u64, ctx)
670			     __field(u16, class)
671			     __field(u16, instance)
672			     __field(u32, seqno)
673			     __field(u32, flags)
674			     ),
675
676	    TP_fast_assign(
677			   __entry->dev = rq->i915->drm.primary->index;
678			   __entry->hw_id = rq->gem_context->hw_id;
679			   __entry->class = rq->engine->uabi_class;
680			   __entry->instance = rq->engine->uabi_instance;
681			   __entry->ctx = rq->fence.context;
682			   __entry->seqno = rq->fence.seqno;
683			   __entry->flags = flags;
684			   ),
685
686	    TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, flags=0x%x",
687		      __entry->dev, __entry->class, __entry->instance,
688		      __entry->hw_id, __entry->ctx, __entry->seqno,
689		      __entry->flags)
690);
691
692DECLARE_EVENT_CLASS(i915_request,
693	    TP_PROTO(struct i915_request *rq),
694	    TP_ARGS(rq),
695
696	    TP_STRUCT__entry(
697			     __field(u32, dev)
698			     __field(u32, hw_id)
699			     __field(u64, ctx)
700			     __field(u16, class)
701			     __field(u16, instance)
702			     __field(u32, seqno)
 
703			     ),
704
705	    TP_fast_assign(
706			   __entry->dev = rq->i915->drm.primary->index;
707			   __entry->hw_id = rq->gem_context->hw_id;
708			   __entry->class = rq->engine->uabi_class;
709			   __entry->instance = rq->engine->uabi_instance;
710			   __entry->ctx = rq->fence.context;
711			   __entry->seqno = rq->fence.seqno;
 
712			   ),
713
714	    TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u",
715		      __entry->dev, __entry->class, __entry->instance,
716		      __entry->hw_id, __entry->ctx, __entry->seqno)
717);
718
719DEFINE_EVENT(i915_request, i915_request_add,
720	    TP_PROTO(struct i915_request *rq),
721	    TP_ARGS(rq)
722);
 
 
 
 
 
 
723
724#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
725DEFINE_EVENT(i915_request, i915_request_submit,
726	     TP_PROTO(struct i915_request *rq),
727	     TP_ARGS(rq)
728);
 
729
730DEFINE_EVENT(i915_request, i915_request_execute,
731	     TP_PROTO(struct i915_request *rq),
732	     TP_ARGS(rq)
733);
734
735TRACE_EVENT(i915_request_in,
736	    TP_PROTO(struct i915_request *rq, unsigned int port),
737	    TP_ARGS(rq, port),
738
739	    TP_STRUCT__entry(
740			     __field(u32, dev)
741			     __field(u32, hw_id)
742			     __field(u64, ctx)
743			     __field(u16, class)
744			     __field(u16, instance)
745			     __field(u32, seqno)
746			     __field(u32, port)
747			     __field(u32, prio)
748			    ),
749
750	    TP_fast_assign(
751			   __entry->dev = rq->i915->drm.primary->index;
752			   __entry->hw_id = rq->gem_context->hw_id;
753			   __entry->class = rq->engine->uabi_class;
754			   __entry->instance = rq->engine->uabi_instance;
755			   __entry->ctx = rq->fence.context;
756			   __entry->seqno = rq->fence.seqno;
757			   __entry->prio = rq->sched.attr.priority;
758			   __entry->port = port;
759			   ),
760
761	    TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, prio=%u, port=%u",
762		      __entry->dev, __entry->class, __entry->instance,
763		      __entry->hw_id, __entry->ctx, __entry->seqno,
764		      __entry->prio, __entry->port)
765);
766
767TRACE_EVENT(i915_request_out,
768	    TP_PROTO(struct i915_request *rq),
769	    TP_ARGS(rq),
770
771	    TP_STRUCT__entry(
772			     __field(u32, dev)
773			     __field(u32, hw_id)
774			     __field(u64, ctx)
775			     __field(u16, class)
776			     __field(u16, instance)
777			     __field(u32, seqno)
778			     __field(u32, completed)
779			    ),
780
781	    TP_fast_assign(
782			   __entry->dev = rq->i915->drm.primary->index;
783			   __entry->hw_id = rq->gem_context->hw_id;
784			   __entry->class = rq->engine->uabi_class;
785			   __entry->instance = rq->engine->uabi_instance;
786			   __entry->ctx = rq->fence.context;
787			   __entry->seqno = rq->fence.seqno;
788			   __entry->completed = i915_request_completed(rq);
789			   ),
790
791		    TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, completed?=%u",
792			      __entry->dev, __entry->class, __entry->instance,
793			      __entry->hw_id, __entry->ctx, __entry->seqno,
794			      __entry->completed)
795);
796
797#else
798#if !defined(TRACE_HEADER_MULTI_READ)
799static inline void
800trace_i915_request_submit(struct i915_request *rq)
801{
802}
803
804static inline void
805trace_i915_request_execute(struct i915_request *rq)
806{
807}
808
809static inline void
810trace_i915_request_in(struct i915_request *rq, unsigned int port)
811{
812}
813
814static inline void
815trace_i915_request_out(struct i915_request *rq)
816{
817}
818#endif
819#endif
820
821DEFINE_EVENT(i915_request, i915_request_retire,
822	    TP_PROTO(struct i915_request *rq),
823	    TP_ARGS(rq)
824);
825
826TRACE_EVENT(i915_request_wait_begin,
827	    TP_PROTO(struct i915_request *rq, unsigned int flags),
828	    TP_ARGS(rq, flags),
829
830	    TP_STRUCT__entry(
831			     __field(u32, dev)
832			     __field(u32, hw_id)
833			     __field(u64, ctx)
834			     __field(u16, class)
835			     __field(u16, instance)
836			     __field(u32, seqno)
837			     __field(unsigned int, flags)
838			     ),
839
840	    /* NB: the blocking information is racy since mutex_is_locked
841	     * doesn't check that the current thread holds the lock. The only
842	     * other option would be to pass the boolean information of whether
843	     * or not the class was blocking down through the stack which is
844	     * less desirable.
845	     */
846	    TP_fast_assign(
847			   __entry->dev = rq->i915->drm.primary->index;
848			   __entry->hw_id = rq->gem_context->hw_id;
849			   __entry->class = rq->engine->uabi_class;
850			   __entry->instance = rq->engine->uabi_instance;
851			   __entry->ctx = rq->fence.context;
852			   __entry->seqno = rq->fence.seqno;
853			   __entry->flags = flags;
854			   ),
855
856	    TP_printk("dev=%u, engine=%u:%u, hw_id=%u, ctx=%llu, seqno=%u, flags=0x%x",
857		      __entry->dev, __entry->class, __entry->instance,
858		      __entry->hw_id, __entry->ctx, __entry->seqno,
859		      __entry->flags)
860);
861
862DEFINE_EVENT(i915_request, i915_request_wait_end,
863	    TP_PROTO(struct i915_request *rq),
864	    TP_ARGS(rq)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
865);
866
867TRACE_EVENT_CONDITION(i915_reg_rw,
868	TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
869
870	TP_ARGS(write, reg, val, len, trace),
871
872	TP_CONDITION(trace),
873
874	TP_STRUCT__entry(
875		__field(u64, val)
876		__field(u32, reg)
877		__field(u16, write)
878		__field(u16, len)
879		),
880
881	TP_fast_assign(
882		__entry->val = (u64)val;
883		__entry->reg = i915_mmio_reg_offset(reg);
884		__entry->write = write;
885		__entry->len = len;
886		),
887
888	TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
889		__entry->write ? "write" : "read",
890		__entry->reg, __entry->len,
891		(u32)(__entry->val & 0xffffffff),
892		(u32)(__entry->val >> 32))
893);
894
895TRACE_EVENT(intel_gpu_freq_change,
896	    TP_PROTO(u32 freq),
897	    TP_ARGS(freq),
898
899	    TP_STRUCT__entry(
900			     __field(u32, freq)
901			     ),
902
903	    TP_fast_assign(
904			   __entry->freq = freq;
905			   ),
906
907	    TP_printk("new_freq=%u", __entry->freq)
908);
909
910/**
911 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
912 *
913 * With full ppgtt enabled each process using drm will allocate at least one
914 * translation table. With these traces it is possible to keep track of the
915 * allocation and of the lifetime of the tables; this can be used during
916 * testing/debug to verify that we are not leaking ppgtts.
917 * These traces identify the ppgtt through the vm pointer, which is also printed
918 * by the i915_vma_bind and i915_vma_unbind tracepoints.
919 */
920DECLARE_EVENT_CLASS(i915_ppgtt,
921	TP_PROTO(struct i915_address_space *vm),
922	TP_ARGS(vm),
923
924	TP_STRUCT__entry(
925			__field(struct i915_address_space *, vm)
926			__field(u32, dev)
927	),
928
929	TP_fast_assign(
930			__entry->vm = vm;
931			__entry->dev = vm->i915->drm.primary->index;
932	),
933
934	TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
935)
936
937DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
938	TP_PROTO(struct i915_address_space *vm),
939	TP_ARGS(vm)
940);
941
942DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
943	TP_PROTO(struct i915_address_space *vm),
944	TP_ARGS(vm)
945);
946
947/**
948 * DOC: i915_context_create and i915_context_free tracepoints
949 *
950 * These tracepoints are used to track creation and deletion of contexts.
951 * If full ppgtt is enabled, they also print the address of the vm assigned to
952 * the context.
953 */
954DECLARE_EVENT_CLASS(i915_context,
955	TP_PROTO(struct i915_gem_context *ctx),
956	TP_ARGS(ctx),
957
958	TP_STRUCT__entry(
959			__field(u32, dev)
960			__field(struct i915_gem_context *, ctx)
961			__field(u32, hw_id)
962			__field(struct i915_address_space *, vm)
963	),
964
965	TP_fast_assign(
966			__entry->dev = ctx->i915->drm.primary->index;
967			__entry->ctx = ctx;
968			__entry->hw_id = ctx->hw_id;
969			__entry->vm = ctx->vm;
970	),
971
972	TP_printk("dev=%u, ctx=%p, ctx_vm=%p, hw_id=%u",
973		  __entry->dev, __entry->ctx, __entry->vm, __entry->hw_id)
974)
975
976DEFINE_EVENT(i915_context, i915_context_create,
977	TP_PROTO(struct i915_gem_context *ctx),
978	TP_ARGS(ctx)
979);
980
981DEFINE_EVENT(i915_context, i915_context_free,
982	TP_PROTO(struct i915_gem_context *ctx),
983	TP_ARGS(ctx)
984);
985
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
986#endif /* _I915_TRACE_H_ */
987
988/* This part must be outside protection */
989#undef TRACE_INCLUDE_PATH
990#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915
991#include <trace/define_trace.h>