xref: /linux/drivers/gpu/drm/i915/i915_trace.h (revision d39d0ed196aa1685bb24771e92f78633c66ac9cb)
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 
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM i915
12 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
13 #define TRACE_INCLUDE_FILE i915_trace
14 
15 /* object tracking */
16 
17 TRACE_EVENT(i915_gem_object_create,
18 
19 	    TP_PROTO(struct drm_gem_object *obj),
20 
21 	    TP_ARGS(obj),
22 
23 	    TP_STRUCT__entry(
24 			     __field(struct drm_gem_object *, obj)
25 			     __field(u32, size)
26 			     ),
27 
28 	    TP_fast_assign(
29 			   __entry->obj = obj;
30 			   __entry->size = obj->size;
31 			   ),
32 
33 	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
34 );
35 
36 TRACE_EVENT(i915_gem_object_bind,
37 
38 	    TP_PROTO(struct drm_gem_object *obj, u32 gtt_offset),
39 
40 	    TP_ARGS(obj, gtt_offset),
41 
42 	    TP_STRUCT__entry(
43 			     __field(struct drm_gem_object *, obj)
44 			     __field(u32, gtt_offset)
45 			     ),
46 
47 	    TP_fast_assign(
48 			   __entry->obj = obj;
49 			   __entry->gtt_offset = gtt_offset;
50 			   ),
51 
52 	    TP_printk("obj=%p, gtt_offset=%08x",
53 		      __entry->obj, __entry->gtt_offset)
54 );
55 
56 TRACE_EVENT(i915_gem_object_change_domain,
57 
58 	    TP_PROTO(struct drm_gem_object *obj, uint32_t old_read_domains, uint32_t old_write_domain),
59 
60 	    TP_ARGS(obj, old_read_domains, old_write_domain),
61 
62 	    TP_STRUCT__entry(
63 			     __field(struct drm_gem_object *, obj)
64 			     __field(u32, read_domains)
65 			     __field(u32, write_domain)
66 			     ),
67 
68 	    TP_fast_assign(
69 			   __entry->obj = obj;
70 			   __entry->read_domains = obj->read_domains | (old_read_domains << 16);
71 			   __entry->write_domain = obj->write_domain | (old_write_domain << 16);
72 			   ),
73 
74 	    TP_printk("obj=%p, read=%04x, write=%04x",
75 		      __entry->obj,
76 		      __entry->read_domains, __entry->write_domain)
77 );
78 
79 TRACE_EVENT(i915_gem_object_get_fence,
80 
81 	    TP_PROTO(struct drm_gem_object *obj, int fence, int tiling_mode),
82 
83 	    TP_ARGS(obj, fence, tiling_mode),
84 
85 	    TP_STRUCT__entry(
86 			     __field(struct drm_gem_object *, obj)
87 			     __field(int, fence)
88 			     __field(int, tiling_mode)
89 			     ),
90 
91 	    TP_fast_assign(
92 			   __entry->obj = obj;
93 			   __entry->fence = fence;
94 			   __entry->tiling_mode = tiling_mode;
95 			   ),
96 
97 	    TP_printk("obj=%p, fence=%d, tiling=%d",
98 		      __entry->obj, __entry->fence, __entry->tiling_mode)
99 );
100 
101 DECLARE_EVENT_CLASS(i915_gem_object,
102 
103 	    TP_PROTO(struct drm_gem_object *obj),
104 
105 	    TP_ARGS(obj),
106 
107 	    TP_STRUCT__entry(
108 			     __field(struct drm_gem_object *, obj)
109 			     ),
110 
111 	    TP_fast_assign(
112 			   __entry->obj = obj;
113 			   ),
114 
115 	    TP_printk("obj=%p", __entry->obj)
116 );
117 
118 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,
119 
120 	    TP_PROTO(struct drm_gem_object *obj),
121 
122 	    TP_ARGS(obj)
123 );
124 
125 DEFINE_EVENT(i915_gem_object, i915_gem_object_unbind,
126 
127 	    TP_PROTO(struct drm_gem_object *obj),
128 
129 	    TP_ARGS(obj)
130 );
131 
132 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
133 
134 	    TP_PROTO(struct drm_gem_object *obj),
135 
136 	    TP_ARGS(obj)
137 );
138 
139 /* batch tracing */
140 
141 TRACE_EVENT(i915_gem_request_submit,
142 
143 	    TP_PROTO(struct drm_device *dev, u32 seqno),
144 
145 	    TP_ARGS(dev, seqno),
146 
147 	    TP_STRUCT__entry(
148 			     __field(u32, dev)
149 			     __field(u32, seqno)
150 			     ),
151 
152 	    TP_fast_assign(
153 			   __entry->dev = dev->primary->index;
154 			   __entry->seqno = seqno;
155 			   i915_trace_irq_get(dev, seqno);
156 			   ),
157 
158 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
159 );
160 
161 TRACE_EVENT(i915_gem_request_flush,
162 
163 	    TP_PROTO(struct drm_device *dev, u32 seqno,
164 		     u32 flush_domains, u32 invalidate_domains),
165 
166 	    TP_ARGS(dev, seqno, flush_domains, invalidate_domains),
167 
168 	    TP_STRUCT__entry(
169 			     __field(u32, dev)
170 			     __field(u32, seqno)
171 			     __field(u32, flush_domains)
172 			     __field(u32, invalidate_domains)
173 			     ),
174 
175 	    TP_fast_assign(
176 			   __entry->dev = dev->primary->index;
177 			   __entry->seqno = seqno;
178 			   __entry->flush_domains = flush_domains;
179 			   __entry->invalidate_domains = invalidate_domains;
180 			   ),
181 
182 	    TP_printk("dev=%u, seqno=%u, flush=%04x, invalidate=%04x",
183 		      __entry->dev, __entry->seqno,
184 		      __entry->flush_domains, __entry->invalidate_domains)
185 );
186 
187 DECLARE_EVENT_CLASS(i915_gem_request,
188 
189 	    TP_PROTO(struct drm_device *dev, u32 seqno),
190 
191 	    TP_ARGS(dev, seqno),
192 
193 	    TP_STRUCT__entry(
194 			     __field(u32, dev)
195 			     __field(u32, seqno)
196 			     ),
197 
198 	    TP_fast_assign(
199 			   __entry->dev = dev->primary->index;
200 			   __entry->seqno = seqno;
201 			   ),
202 
203 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
204 );
205 
206 DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
207 
208 	    TP_PROTO(struct drm_device *dev, u32 seqno),
209 
210 	    TP_ARGS(dev, seqno)
211 );
212 
213 DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
214 
215 	    TP_PROTO(struct drm_device *dev, u32 seqno),
216 
217 	    TP_ARGS(dev, seqno)
218 );
219 
220 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
221 
222 	    TP_PROTO(struct drm_device *dev, u32 seqno),
223 
224 	    TP_ARGS(dev, seqno)
225 );
226 
227 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
228 
229 	    TP_PROTO(struct drm_device *dev, u32 seqno),
230 
231 	    TP_ARGS(dev, seqno)
232 );
233 
234 DECLARE_EVENT_CLASS(i915_ring,
235 
236 	    TP_PROTO(struct drm_device *dev),
237 
238 	    TP_ARGS(dev),
239 
240 	    TP_STRUCT__entry(
241 			     __field(u32, dev)
242 			     ),
243 
244 	    TP_fast_assign(
245 			   __entry->dev = dev->primary->index;
246 			   ),
247 
248 	    TP_printk("dev=%u", __entry->dev)
249 );
250 
251 DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
252 
253 	    TP_PROTO(struct drm_device *dev),
254 
255 	    TP_ARGS(dev)
256 );
257 
258 DEFINE_EVENT(i915_ring, i915_ring_wait_end,
259 
260 	    TP_PROTO(struct drm_device *dev),
261 
262 	    TP_ARGS(dev)
263 );
264 
265 TRACE_EVENT(i915_flip_request,
266 	    TP_PROTO(int plane, struct drm_gem_object *obj),
267 
268 	    TP_ARGS(plane, obj),
269 
270 	    TP_STRUCT__entry(
271 		    __field(int, plane)
272 		    __field(struct drm_gem_object *, obj)
273 		    ),
274 
275 	    TP_fast_assign(
276 		    __entry->plane = plane;
277 		    __entry->obj = obj;
278 		    ),
279 
280 	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
281 );
282 
283 TRACE_EVENT(i915_flip_complete,
284 	    TP_PROTO(int plane, struct drm_gem_object *obj),
285 
286 	    TP_ARGS(plane, obj),
287 
288 	    TP_STRUCT__entry(
289 		    __field(int, plane)
290 		    __field(struct drm_gem_object *, obj)
291 		    ),
292 
293 	    TP_fast_assign(
294 		    __entry->plane = plane;
295 		    __entry->obj = obj;
296 		    ),
297 
298 	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
299 );
300 
301 #endif /* _I915_TRACE_H_ */
302 
303 /* This part must be outside protection */
304 #undef TRACE_INCLUDE_PATH
305 #define TRACE_INCLUDE_PATH .
306 #include <trace/define_trace.h>
307