1 #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/stringify.h>
5 #include <linux/types.h>
6 #include <linux/tracepoint.h>
10 #include "intel_ringbuffer.h"
13 #define TRACE_SYSTEM i915
14 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
15 #define TRACE_INCLUDE_FILE i915_trace
19 TRACE_EVENT(i915_gem_object_create
,
20 TP_PROTO(struct drm_i915_gem_object
*obj
),
24 __field(struct drm_i915_gem_object
*, obj
)
30 __entry
->size
= obj
->base
.size
;
33 TP_printk("obj=%p, size=%u", __entry
->obj
, __entry
->size
)
36 TRACE_EVENT(i915_vma_bind
,
37 TP_PROTO(struct i915_vma
*vma
, bool mappable
),
38 TP_ARGS(vma
, mappable
),
41 __field(struct drm_i915_gem_object
*, obj
)
42 __field(struct i915_address_space
*, vm
)
45 __field(bool, mappable
)
49 __entry
->obj
= vma
->obj
;
50 __entry
->vm
= vma
->vm
;
51 __entry
->offset
= vma
->node
.start
;
52 __entry
->size
= vma
->node
.size
;
53 __entry
->mappable
= mappable
;
56 TP_printk("obj=%p, offset=%08x size=%x%s vm=%p",
57 __entry
->obj
, __entry
->offset
, __entry
->size
,
58 __entry
->mappable
? ", mappable" : "",
62 TRACE_EVENT(i915_vma_unbind
,
63 TP_PROTO(struct i915_vma
*vma
),
67 __field(struct drm_i915_gem_object
*, obj
)
68 __field(struct i915_address_space
*, vm
)
74 __entry
->obj
= vma
->obj
;
75 __entry
->vm
= vma
->vm
;
76 __entry
->offset
= vma
->node
.start
;
77 __entry
->size
= vma
->node
.size
;
80 TP_printk("obj=%p, offset=%08x size=%x vm=%p",
81 __entry
->obj
, __entry
->offset
, __entry
->size
, __entry
->vm
)
84 TRACE_EVENT(i915_gem_object_change_domain
,
85 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 old_read
, u32 old_write
),
86 TP_ARGS(obj
, old_read
, old_write
),
89 __field(struct drm_i915_gem_object
*, obj
)
90 __field(u32
, read_domains
)
91 __field(u32
, write_domain
)
96 __entry
->read_domains
= obj
->base
.read_domains
| (old_read
<< 16);
97 __entry
->write_domain
= obj
->base
.write_domain
| (old_write
<< 16);
100 TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
102 __entry
->read_domains
>> 16,
103 __entry
->read_domains
& 0xffff,
104 __entry
->write_domain
>> 16,
105 __entry
->write_domain
& 0xffff)
108 TRACE_EVENT(i915_gem_object_pwrite
,
109 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 offset
, u32 len
),
110 TP_ARGS(obj
, offset
, len
),
113 __field(struct drm_i915_gem_object
*, obj
)
120 __entry
->offset
= offset
;
124 TP_printk("obj=%p, offset=%u, len=%u",
125 __entry
->obj
, __entry
->offset
, __entry
->len
)
128 TRACE_EVENT(i915_gem_object_pread
,
129 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 offset
, u32 len
),
130 TP_ARGS(obj
, offset
, len
),
133 __field(struct drm_i915_gem_object
*, obj
)
140 __entry
->offset
= offset
;
144 TP_printk("obj=%p, offset=%u, len=%u",
145 __entry
->obj
, __entry
->offset
, __entry
->len
)
148 TRACE_EVENT(i915_gem_object_fault
,
149 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 index
, bool gtt
, bool write
),
150 TP_ARGS(obj
, index
, gtt
, write
),
153 __field(struct drm_i915_gem_object
*, obj
)
161 __entry
->index
= index
;
163 __entry
->write
= write
;
166 TP_printk("obj=%p, %s index=%u %s",
168 __entry
->gtt
? "GTT" : "CPU",
170 __entry
->write
? ", writable" : "")
173 DECLARE_EVENT_CLASS(i915_gem_object
,
174 TP_PROTO(struct drm_i915_gem_object
*obj
),
178 __field(struct drm_i915_gem_object
*, obj
)
185 TP_printk("obj=%p", __entry
->obj
)
188 DEFINE_EVENT(i915_gem_object
, i915_gem_object_clflush
,
189 TP_PROTO(struct drm_i915_gem_object
*obj
),
193 DEFINE_EVENT(i915_gem_object
, i915_gem_object_destroy
,
194 TP_PROTO(struct drm_i915_gem_object
*obj
),
198 TRACE_EVENT(i915_gem_evict
,
199 TP_PROTO(struct drm_device
*dev
, u32 size
, u32 align
, bool mappable
),
200 TP_ARGS(dev
, size
, align
, mappable
),
206 __field(bool, mappable
)
210 __entry
->dev
= dev
->primary
->index
;
211 __entry
->size
= size
;
212 __entry
->align
= align
;
213 __entry
->mappable
= mappable
;
216 TP_printk("dev=%d, size=%d, align=%d %s",
217 __entry
->dev
, __entry
->size
, __entry
->align
,
218 __entry
->mappable
? ", mappable" : "")
221 TRACE_EVENT(i915_gem_evict_everything
,
222 TP_PROTO(struct drm_device
*dev
),
230 __entry
->dev
= dev
->primary
->index
;
233 TP_printk("dev=%d", __entry
->dev
)
236 TRACE_EVENT(i915_gem_ring_dispatch
,
237 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
, u32 flags
),
238 TP_ARGS(ring
, seqno
, flags
),
248 __entry
->dev
= ring
->dev
->primary
->index
;
249 __entry
->ring
= ring
->id
;
250 __entry
->seqno
= seqno
;
251 __entry
->flags
= flags
;
252 i915_trace_irq_get(ring
, seqno
);
255 TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
256 __entry
->dev
, __entry
->ring
, __entry
->seqno
, __entry
->flags
)
259 TRACE_EVENT(i915_gem_ring_flush
,
260 TP_PROTO(struct intel_ring_buffer
*ring
, u32 invalidate
, u32 flush
),
261 TP_ARGS(ring
, invalidate
, flush
),
266 __field(u32
, invalidate
)
271 __entry
->dev
= ring
->dev
->primary
->index
;
272 __entry
->ring
= ring
->id
;
273 __entry
->invalidate
= invalidate
;
274 __entry
->flush
= flush
;
277 TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
278 __entry
->dev
, __entry
->ring
,
279 __entry
->invalidate
, __entry
->flush
)
282 DECLARE_EVENT_CLASS(i915_gem_request
,
283 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
284 TP_ARGS(ring
, seqno
),
293 __entry
->dev
= ring
->dev
->primary
->index
;
294 __entry
->ring
= ring
->id
;
295 __entry
->seqno
= seqno
;
298 TP_printk("dev=%u, ring=%u, seqno=%u",
299 __entry
->dev
, __entry
->ring
, __entry
->seqno
)
302 DEFINE_EVENT(i915_gem_request
, i915_gem_request_add
,
303 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
307 DEFINE_EVENT(i915_gem_request
, i915_gem_request_complete
,
308 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
312 DEFINE_EVENT(i915_gem_request
, i915_gem_request_retire
,
313 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
317 TRACE_EVENT(i915_gem_request_wait_begin
,
318 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
319 TP_ARGS(ring
, seqno
),
325 __field(bool, blocking
)
328 /* NB: the blocking information is racy since mutex_is_locked
329 * doesn't check that the current thread holds the lock. The only
330 * other option would be to pass the boolean information of whether
331 * or not the class was blocking down through the stack which is
335 __entry
->dev
= ring
->dev
->primary
->index
;
336 __entry
->ring
= ring
->id
;
337 __entry
->seqno
= seqno
;
338 __entry
->blocking
= mutex_is_locked(&ring
->dev
->struct_mutex
);
341 TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
342 __entry
->dev
, __entry
->ring
, __entry
->seqno
,
343 __entry
->blocking
? "yes (NB)" : "no")
346 DEFINE_EVENT(i915_gem_request
, i915_gem_request_wait_end
,
347 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
351 DECLARE_EVENT_CLASS(i915_ring
,
352 TP_PROTO(struct intel_ring_buffer
*ring
),
361 __entry
->dev
= ring
->dev
->primary
->index
;
362 __entry
->ring
= ring
->id
;
365 TP_printk("dev=%u, ring=%u", __entry
->dev
, __entry
->ring
)
368 DEFINE_EVENT(i915_ring
, i915_ring_wait_begin
,
369 TP_PROTO(struct intel_ring_buffer
*ring
),
373 DEFINE_EVENT(i915_ring
, i915_ring_wait_end
,
374 TP_PROTO(struct intel_ring_buffer
*ring
),
378 TRACE_EVENT(i915_flip_request
,
379 TP_PROTO(int plane
, struct drm_i915_gem_object
*obj
),
385 __field(struct drm_i915_gem_object
*, obj
)
389 __entry
->plane
= plane
;
393 TP_printk("plane=%d, obj=%p", __entry
->plane
, __entry
->obj
)
396 TRACE_EVENT(i915_flip_complete
,
397 TP_PROTO(int plane
, struct drm_i915_gem_object
*obj
),
403 __field(struct drm_i915_gem_object
*, obj
)
407 __entry
->plane
= plane
;
411 TP_printk("plane=%d, obj=%p", __entry
->plane
, __entry
->obj
)
414 TRACE_EVENT_CONDITION(i915_reg_rw
,
415 TP_PROTO(bool write
, u32 reg
, u64 val
, int len
, bool trace
),
417 TP_ARGS(write
, reg
, val
, len
, trace
),
429 __entry
->val
= (u64
)val
;
431 __entry
->write
= write
;
435 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
436 __entry
->write
? "write" : "read",
437 __entry
->reg
, __entry
->len
,
438 (u32
)(__entry
->val
& 0xffffffff),
439 (u32
)(__entry
->val
>> 32))
442 TRACE_EVENT(intel_gpu_freq_change
,
451 __entry
->freq
= freq
;
454 TP_printk("new_freq=%u", __entry
->freq
)
457 #endif /* _I915_TRACE_H_ */
459 /* This part must be outside protection */
460 #undef TRACE_INCLUDE_PATH
461 #define TRACE_INCLUDE_PATH .
462 #include <trace/define_trace.h>