i915_trace.h 6.8 KB
Newer Older
C
Chris Wilson 已提交
1 2 3 4 5 6 7 8
#if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _I915_TRACE_H_

#include <linux/stringify.h>
#include <linux/types.h>
#include <linux/tracepoint.h>

#include <drm/drmP.h>
9
#include "i915_drv.h"
C
Chris Wilson 已提交
10 11 12 13 14 15 16 17 18 19

#undef TRACE_SYSTEM
#define TRACE_SYSTEM i915
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE i915_trace

/* object tracking */

TRACE_EVENT(i915_gem_object_create,

20
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
21 22 23 24

	    TP_ARGS(obj),

	    TP_STRUCT__entry(
25
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
26 27 28 29 30
			     __field(u32, size)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
31
			   __entry->size = obj->base.size;
C
Chris Wilson 已提交
32 33 34 35 36 37 38
			   ),

	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
);

TRACE_EVENT(i915_gem_object_bind,

39
	    TP_PROTO(struct drm_i915_gem_object *obj, u32 gtt_offset, bool mappable),
C
Chris Wilson 已提交
40

41
	    TP_ARGS(obj, gtt_offset, mappable),
C
Chris Wilson 已提交
42 43

	    TP_STRUCT__entry(
44
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
45
			     __field(u32, gtt_offset)
46
			     __field(bool, mappable)
C
Chris Wilson 已提交
47 48 49 50 51
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->gtt_offset = gtt_offset;
52
			   __entry->mappable = mappable;
C
Chris Wilson 已提交
53 54
			   ),

55 56 57
	    TP_printk("obj=%p, gtt_offset=%08x%s",
		      __entry->obj, __entry->gtt_offset,
		      __entry->mappable ? ", mappable" : "")
C
Chris Wilson 已提交
58 59 60 61
);

TRACE_EVENT(i915_gem_object_change_domain,

62
	    TP_PROTO(struct drm_i915_gem_object *obj, uint32_t old_read_domains, uint32_t old_write_domain),
C
Chris Wilson 已提交
63 64 65 66

	    TP_ARGS(obj, old_read_domains, old_write_domain),

	    TP_STRUCT__entry(
67
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
68 69 70 71 72 73
			     __field(u32, read_domains)
			     __field(u32, write_domain)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
74 75
			   __entry->read_domains = obj->base.read_domains | (old_read_domains << 16);
			   __entry->write_domain = obj->base.write_domain | (old_write_domain << 16);
C
Chris Wilson 已提交
76 77 78 79 80 81 82
			   ),

	    TP_printk("obj=%p, read=%04x, write=%04x",
		      __entry->obj,
		      __entry->read_domains, __entry->write_domain)
);

83
DECLARE_EVENT_CLASS(i915_gem_object,
C
Chris Wilson 已提交
84

85
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
86 87 88 89

	    TP_ARGS(obj),

	    TP_STRUCT__entry(
90
			     __field(struct drm_i915_gem_object *, obj)
C
Chris Wilson 已提交
91 92 93 94 95 96 97 98 99
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   ),

	    TP_printk("obj=%p", __entry->obj)
);

100 101
DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,

102
	    TP_PROTO(struct drm_i915_gem_object *obj),
103 104 105 106

	    TP_ARGS(obj)
);

107
DEFINE_EVENT(i915_gem_object, i915_gem_object_unbind,
C
Chris Wilson 已提交
108

109
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
110

111 112
	    TP_ARGS(obj)
);
C
Chris Wilson 已提交
113

114
DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
C
Chris Wilson 已提交
115

116
	    TP_PROTO(struct drm_i915_gem_object *obj),
C
Chris Wilson 已提交
117

118
	    TP_ARGS(obj)
C
Chris Wilson 已提交
119 120 121 122 123 124 125 126 127 128 129
);

/* batch tracing */

TRACE_EVENT(i915_gem_request_submit,

	    TP_PROTO(struct drm_device *dev, u32 seqno),

	    TP_ARGS(dev, seqno),

	    TP_STRUCT__entry(
130
			     __field(u32, dev)
C
Chris Wilson 已提交
131 132 133 134
			     __field(u32, seqno)
			     ),

	    TP_fast_assign(
135
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
136
			   __entry->seqno = seqno;
137
			   i915_trace_irq_get(dev, seqno);
C
Chris Wilson 已提交
138 139
			   ),

140
	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
C
Chris Wilson 已提交
141 142 143 144 145 146 147 148 149 150
);

TRACE_EVENT(i915_gem_request_flush,

	    TP_PROTO(struct drm_device *dev, u32 seqno,
		     u32 flush_domains, u32 invalidate_domains),

	    TP_ARGS(dev, seqno, flush_domains, invalidate_domains),

	    TP_STRUCT__entry(
151
			     __field(u32, dev)
C
Chris Wilson 已提交
152 153 154 155 156 157
			     __field(u32, seqno)
			     __field(u32, flush_domains)
			     __field(u32, invalidate_domains)
			     ),

	    TP_fast_assign(
158
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
159 160 161 162 163
			   __entry->seqno = seqno;
			   __entry->flush_domains = flush_domains;
			   __entry->invalidate_domains = invalidate_domains;
			   ),

164
	    TP_printk("dev=%u, seqno=%u, flush=%04x, invalidate=%04x",
C
Chris Wilson 已提交
165 166 167 168
		      __entry->dev, __entry->seqno,
		      __entry->flush_domains, __entry->invalidate_domains)
);

169
DECLARE_EVENT_CLASS(i915_gem_request,
C
Chris Wilson 已提交
170 171 172 173 174 175

	    TP_PROTO(struct drm_device *dev, u32 seqno),

	    TP_ARGS(dev, seqno),

	    TP_STRUCT__entry(
176
			     __field(u32, dev)
C
Chris Wilson 已提交
177 178 179 180
			     __field(u32, seqno)
			     ),

	    TP_fast_assign(
181
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
182 183 184
			   __entry->seqno = seqno;
			   ),

185
	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
C
Chris Wilson 已提交
186 187
);

188
DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
C
Chris Wilson 已提交
189 190 191

	    TP_PROTO(struct drm_device *dev, u32 seqno),

192
	    TP_ARGS(dev, seqno)
C
Chris Wilson 已提交
193 194
);

195
DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
C
Chris Wilson 已提交
196 197 198

	    TP_PROTO(struct drm_device *dev, u32 seqno),

199
	    TP_ARGS(dev, seqno)
C
Chris Wilson 已提交
200 201
);

202
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
C
Chris Wilson 已提交
203 204 205

	    TP_PROTO(struct drm_device *dev, u32 seqno),

206 207
	    TP_ARGS(dev, seqno)
);
C
Chris Wilson 已提交
208

209
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
C
Chris Wilson 已提交
210

211
	    TP_PROTO(struct drm_device *dev, u32 seqno),
C
Chris Wilson 已提交
212

213
	    TP_ARGS(dev, seqno)
C
Chris Wilson 已提交
214 215
);

216
DECLARE_EVENT_CLASS(i915_ring,
C
Chris Wilson 已提交
217 218 219 220 221 222

	    TP_PROTO(struct drm_device *dev),

	    TP_ARGS(dev),

	    TP_STRUCT__entry(
223
			     __field(u32, dev)
C
Chris Wilson 已提交
224 225 226
			     ),

	    TP_fast_assign(
227
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
228 229
			   ),

230
	    TP_printk("dev=%u", __entry->dev)
C
Chris Wilson 已提交
231 232
);

233
DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
C
Chris Wilson 已提交
234 235 236

	    TP_PROTO(struct drm_device *dev),

237 238
	    TP_ARGS(dev)
);
C
Chris Wilson 已提交
239

240
DEFINE_EVENT(i915_ring, i915_ring_wait_end,
C
Chris Wilson 已提交
241

242
	    TP_PROTO(struct drm_device *dev),
C
Chris Wilson 已提交
243

244
	    TP_ARGS(dev)
C
Chris Wilson 已提交
245 246
);

247
TRACE_EVENT(i915_flip_request,
248
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
249 250 251 252 253

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
254
		    __field(struct drm_i915_gem_object *, obj)
255 256 257 258 259 260 261 262 263 264 265
		    ),

	    TP_fast_assign(
		    __entry->plane = plane;
		    __entry->obj = obj;
		    ),

	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
);

TRACE_EVENT(i915_flip_complete,
266
	    TP_PROTO(int plane, struct drm_i915_gem_object *obj),
267 268 269 270 271

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
272
		    __field(struct drm_i915_gem_object *, obj)
273 274 275 276 277 278 279 280 281 282
		    ),

	    TP_fast_assign(
		    __entry->plane = plane;
		    __entry->obj = obj;
		    ),

	    TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
);

283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
TRACE_EVENT(i915_reg_rw,
           TP_PROTO(int cmd, uint32_t reg, uint64_t val, int len),

           TP_ARGS(cmd, reg, val, len),

           TP_STRUCT__entry(
                   __field(int, cmd)
                   __field(uint32_t, reg)
                   __field(uint64_t, val)
                   __field(int, len)
                   ),

           TP_fast_assign(
                   __entry->cmd = cmd;
                   __entry->reg = reg;
                   __entry->val = (uint64_t)val;
                   __entry->len = len;
                   ),

           TP_printk("cmd=%c, reg=0x%x, val=0x%llx, len=%d",
                     __entry->cmd, __entry->reg, __entry->val, __entry->len)
);

C
Chris Wilson 已提交
306 307 308 309
#endif /* _I915_TRACE_H_ */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
P
Peter Clifton 已提交
310
#define TRACE_INCLUDE_PATH .
C
Chris Wilson 已提交
311
#include <trace/define_trace.h>