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_gem_object_bind
,
37 TP_PROTO(struct drm_i915_gem_object
*obj
, bool mappable
),
38 TP_ARGS(obj
, mappable
),
41 __field(struct drm_i915_gem_object
*, obj
)
44 __field(bool, mappable
)
49 __entry
->offset
= obj
->gtt_space
->start
;
50 __entry
->size
= obj
->gtt_space
->size
;
51 __entry
->mappable
= mappable
;
54 TP_printk("obj=%p, offset=%08x size=%x%s",
55 __entry
->obj
, __entry
->offset
, __entry
->size
,
56 __entry
->mappable
? ", mappable" : "")
59 TRACE_EVENT(i915_gem_object_unbind
,
60 TP_PROTO(struct drm_i915_gem_object
*obj
),
64 __field(struct drm_i915_gem_object
*, obj
)
71 __entry
->offset
= obj
->gtt_space
->start
;
72 __entry
->size
= obj
->gtt_space
->size
;
75 TP_printk("obj=%p, offset=%08x size=%x",
76 __entry
->obj
, __entry
->offset
, __entry
->size
)
79 TRACE_EVENT(i915_gem_object_change_domain
,
80 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 old_read
, u32 old_write
),
81 TP_ARGS(obj
, old_read
, old_write
),
84 __field(struct drm_i915_gem_object
*, obj
)
85 __field(u32
, read_domains
)
86 __field(u32
, write_domain
)
91 __entry
->read_domains
= obj
->base
.read_domains
| (old_read
<< 16);
92 __entry
->write_domain
= obj
->base
.write_domain
| (old_write
<< 16);
95 TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x",
97 __entry
->read_domains
>> 16,
98 __entry
->read_domains
& 0xffff,
99 __entry
->write_domain
>> 16,
100 __entry
->write_domain
& 0xffff)
103 TRACE_EVENT(i915_gem_object_pwrite
,
104 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 offset
, u32 len
),
105 TP_ARGS(obj
, offset
, len
),
108 __field(struct drm_i915_gem_object
*, obj
)
115 __entry
->offset
= offset
;
119 TP_printk("obj=%p, offset=%u, len=%u",
120 __entry
->obj
, __entry
->offset
, __entry
->len
)
123 TRACE_EVENT(i915_gem_object_pread
,
124 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 offset
, u32 len
),
125 TP_ARGS(obj
, offset
, len
),
128 __field(struct drm_i915_gem_object
*, obj
)
135 __entry
->offset
= offset
;
139 TP_printk("obj=%p, offset=%u, len=%u",
140 __entry
->obj
, __entry
->offset
, __entry
->len
)
143 TRACE_EVENT(i915_gem_object_fault
,
144 TP_PROTO(struct drm_i915_gem_object
*obj
, u32 index
, bool gtt
, bool write
),
145 TP_ARGS(obj
, index
, gtt
, write
),
148 __field(struct drm_i915_gem_object
*, obj
)
156 __entry
->index
= index
;
158 __entry
->write
= write
;
161 TP_printk("obj=%p, %s index=%u %s",
163 __entry
->gtt
? "GTT" : "CPU",
165 __entry
->write
? ", writable" : "")
168 DECLARE_EVENT_CLASS(i915_gem_object
,
169 TP_PROTO(struct drm_i915_gem_object
*obj
),
173 __field(struct drm_i915_gem_object
*, obj
)
180 TP_printk("obj=%p", __entry
->obj
)
183 DEFINE_EVENT(i915_gem_object
, i915_gem_object_clflush
,
184 TP_PROTO(struct drm_i915_gem_object
*obj
),
188 DEFINE_EVENT(i915_gem_object
, i915_gem_object_destroy
,
189 TP_PROTO(struct drm_i915_gem_object
*obj
),
193 TRACE_EVENT(i915_gem_evict
,
194 TP_PROTO(struct drm_device
*dev
, u32 size
, u32 align
, bool mappable
),
195 TP_ARGS(dev
, size
, align
, mappable
),
201 __field(bool, mappable
)
205 __entry
->dev
= dev
->primary
->index
;
206 __entry
->size
= size
;
207 __entry
->align
= align
;
208 __entry
->mappable
= mappable
;
211 TP_printk("dev=%d, size=%d, align=%d %s",
212 __entry
->dev
, __entry
->size
, __entry
->align
,
213 __entry
->mappable
? ", mappable" : "")
216 TRACE_EVENT(i915_gem_evict_everything
,
217 TP_PROTO(struct drm_device
*dev
, bool purgeable
),
218 TP_ARGS(dev
, purgeable
),
222 __field(bool, purgeable
)
226 __entry
->dev
= dev
->primary
->index
;
227 __entry
->purgeable
= purgeable
;
230 TP_printk("dev=%d%s",
232 __entry
->purgeable
? ", purgeable only" : "")
235 TRACE_EVENT(i915_gem_ring_dispatch
,
236 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
237 TP_ARGS(ring
, seqno
),
246 __entry
->dev
= ring
->dev
->primary
->index
;
247 __entry
->ring
= ring
->id
;
248 __entry
->seqno
= seqno
;
249 i915_trace_irq_get(ring
, seqno
);
252 TP_printk("dev=%u, ring=%u, seqno=%u",
253 __entry
->dev
, __entry
->ring
, __entry
->seqno
)
256 TRACE_EVENT(i915_gem_ring_flush
,
257 TP_PROTO(struct intel_ring_buffer
*ring
, u32 invalidate
, u32 flush
),
258 TP_ARGS(ring
, invalidate
, flush
),
263 __field(u32
, invalidate
)
268 __entry
->dev
= ring
->dev
->primary
->index
;
269 __entry
->ring
= ring
->id
;
270 __entry
->invalidate
= invalidate
;
271 __entry
->flush
= flush
;
274 TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
275 __entry
->dev
, __entry
->ring
,
276 __entry
->invalidate
, __entry
->flush
)
279 DECLARE_EVENT_CLASS(i915_gem_request
,
280 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
281 TP_ARGS(ring
, seqno
),
290 __entry
->dev
= ring
->dev
->primary
->index
;
291 __entry
->ring
= ring
->id
;
292 __entry
->seqno
= seqno
;
295 TP_printk("dev=%u, ring=%u, seqno=%u",
296 __entry
->dev
, __entry
->ring
, __entry
->seqno
)
299 DEFINE_EVENT(i915_gem_request
, i915_gem_request_add
,
300 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
304 DEFINE_EVENT(i915_gem_request
, i915_gem_request_complete
,
305 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
309 DEFINE_EVENT(i915_gem_request
, i915_gem_request_retire
,
310 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
314 TRACE_EVENT(i915_gem_request_wait_begin
,
315 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
316 TP_ARGS(ring
, seqno
),
322 __field(bool, blocking
)
325 /* NB: the blocking information is racy since mutex_is_locked
326 * doesn't check that the current thread holds the lock. The only
327 * other option would be to pass the boolean information of whether
328 * or not the class was blocking down through the stack which is
332 __entry
->dev
= ring
->dev
->primary
->index
;
333 __entry
->ring
= ring
->id
;
334 __entry
->seqno
= seqno
;
335 __entry
->blocking
= mutex_is_locked(&ring
->dev
->struct_mutex
);
338 TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
339 __entry
->dev
, __entry
->ring
, __entry
->seqno
,
340 __entry
->blocking
? "yes (NB)" : "no")
343 DEFINE_EVENT(i915_gem_request
, i915_gem_request_wait_end
,
344 TP_PROTO(struct intel_ring_buffer
*ring
, u32 seqno
),
348 DECLARE_EVENT_CLASS(i915_ring
,
349 TP_PROTO(struct intel_ring_buffer
*ring
),
358 __entry
->dev
= ring
->dev
->primary
->index
;
359 __entry
->ring
= ring
->id
;
362 TP_printk("dev=%u, ring=%u", __entry
->dev
, __entry
->ring
)
365 DEFINE_EVENT(i915_ring
, i915_ring_wait_begin
,
366 TP_PROTO(struct intel_ring_buffer
*ring
),
370 DEFINE_EVENT(i915_ring
, i915_ring_wait_end
,
371 TP_PROTO(struct intel_ring_buffer
*ring
),
375 TRACE_EVENT(i915_flip_request
,
376 TP_PROTO(int plane
, struct drm_i915_gem_object
*obj
),
382 __field(struct drm_i915_gem_object
*, obj
)
386 __entry
->plane
= plane
;
390 TP_printk("plane=%d, obj=%p", __entry
->plane
, __entry
->obj
)
393 TRACE_EVENT(i915_flip_complete
,
394 TP_PROTO(int plane
, struct drm_i915_gem_object
*obj
),
400 __field(struct drm_i915_gem_object
*, obj
)
404 __entry
->plane
= plane
;
408 TP_printk("plane=%d, obj=%p", __entry
->plane
, __entry
->obj
)
411 TRACE_EVENT(i915_reg_rw
,
412 TP_PROTO(bool write
, u32 reg
, u64 val
, int len
),
414 TP_ARGS(write
, reg
, val
, len
),
424 __entry
->val
= (u64
)val
;
426 __entry
->write
= write
;
430 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
431 __entry
->write
? "write" : "read",
432 __entry
->reg
, __entry
->len
,
433 (u32
)(__entry
->val
& 0xffffffff),
434 (u32
)(__entry
->val
>> 32))
437 #endif /* _I915_TRACE_H_ */
439 /* This part must be outside protection */
440 #undef TRACE_INCLUDE_PATH
441 #define TRACE_INCLUDE_PATH .
442 #include <trace/define_trace.h>