i915_trace.h 7.2 KB
Newer Older
C
Chris Wilson 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#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>

#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,

	    TP_PROTO(struct drm_gem_object *obj),

	    TP_ARGS(obj),

	    TP_STRUCT__entry(
			     __field(struct drm_gem_object *, obj)
			     __field(u32, size)
			     ),

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

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

TRACE_EVENT(i915_gem_object_bind,

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

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

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

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

54 55 56
	    TP_printk("obj=%p, gtt_offset=%08x%s",
		      __entry->obj, __entry->gtt_offset,
		      __entry->mappable ? ", mappable" : "")
C
Chris Wilson 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
);

TRACE_EVENT(i915_gem_object_change_domain,

	    TP_PROTO(struct drm_gem_object *obj, uint32_t old_read_domains, uint32_t old_write_domain),

	    TP_ARGS(obj, old_read_domains, old_write_domain),

	    TP_STRUCT__entry(
			     __field(struct drm_gem_object *, obj)
			     __field(u32, read_domains)
			     __field(u32, write_domain)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->read_domains = obj->read_domains | (old_read_domains << 16);
			   __entry->write_domain = obj->write_domain | (old_write_domain << 16);
			   ),

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

TRACE_EVENT(i915_gem_object_get_fence,

	    TP_PROTO(struct drm_gem_object *obj, int fence, int tiling_mode),

	    TP_ARGS(obj, fence, tiling_mode),

	    TP_STRUCT__entry(
			     __field(struct drm_gem_object *, obj)
			     __field(int, fence)
			     __field(int, tiling_mode)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   __entry->fence = fence;
			   __entry->tiling_mode = tiling_mode;
			   ),

	    TP_printk("obj=%p, fence=%d, tiling=%d",
		      __entry->obj, __entry->fence, __entry->tiling_mode)
);

104
DECLARE_EVENT_CLASS(i915_gem_object,
C
Chris Wilson 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

	    TP_PROTO(struct drm_gem_object *obj),

	    TP_ARGS(obj),

	    TP_STRUCT__entry(
			     __field(struct drm_gem_object *, obj)
			     ),

	    TP_fast_assign(
			   __entry->obj = obj;
			   ),

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

121 122 123 124 125 126 127
DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush,

	    TP_PROTO(struct drm_gem_object *obj),

	    TP_ARGS(obj)
);

128
DEFINE_EVENT(i915_gem_object, i915_gem_object_unbind,
C
Chris Wilson 已提交
129 130 131

	    TP_PROTO(struct drm_gem_object *obj),

132 133
	    TP_ARGS(obj)
);
C
Chris Wilson 已提交
134

135
DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
C
Chris Wilson 已提交
136

137
	    TP_PROTO(struct drm_gem_object *obj),
C
Chris Wilson 已提交
138

139
	    TP_ARGS(obj)
C
Chris Wilson 已提交
140 141 142 143 144 145 146 147 148 149 150
);

/* batch tracing */

TRACE_EVENT(i915_gem_request_submit,

	    TP_PROTO(struct drm_device *dev, u32 seqno),

	    TP_ARGS(dev, seqno),

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

	    TP_fast_assign(
156
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
157
			   __entry->seqno = seqno;
158
			   i915_trace_irq_get(dev, seqno);
C
Chris Wilson 已提交
159 160
			   ),

161
	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
C
Chris Wilson 已提交
162 163 164 165 166 167 168 169 170 171
);

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(
172
			     __field(u32, dev)
C
Chris Wilson 已提交
173 174 175 176 177 178
			     __field(u32, seqno)
			     __field(u32, flush_domains)
			     __field(u32, invalidate_domains)
			     ),

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

185
	    TP_printk("dev=%u, seqno=%u, flush=%04x, invalidate=%04x",
C
Chris Wilson 已提交
186 187 188 189
		      __entry->dev, __entry->seqno,
		      __entry->flush_domains, __entry->invalidate_domains)
);

190
DECLARE_EVENT_CLASS(i915_gem_request,
C
Chris Wilson 已提交
191 192 193 194 195 196

	    TP_PROTO(struct drm_device *dev, u32 seqno),

	    TP_ARGS(dev, seqno),

	    TP_STRUCT__entry(
197
			     __field(u32, dev)
C
Chris Wilson 已提交
198 199 200 201
			     __field(u32, seqno)
			     ),

	    TP_fast_assign(
202
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
203 204 205
			   __entry->seqno = seqno;
			   ),

206
	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
C
Chris Wilson 已提交
207 208
);

209
DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
C
Chris Wilson 已提交
210 211 212

	    TP_PROTO(struct drm_device *dev, u32 seqno),

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

216
DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
C
Chris Wilson 已提交
217 218 219

	    TP_PROTO(struct drm_device *dev, u32 seqno),

220
	    TP_ARGS(dev, seqno)
C
Chris Wilson 已提交
221 222
);

223
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
C
Chris Wilson 已提交
224 225 226

	    TP_PROTO(struct drm_device *dev, u32 seqno),

227 228
	    TP_ARGS(dev, seqno)
);
C
Chris Wilson 已提交
229

230
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
C
Chris Wilson 已提交
231

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

234
	    TP_ARGS(dev, seqno)
C
Chris Wilson 已提交
235 236
);

237
DECLARE_EVENT_CLASS(i915_ring,
C
Chris Wilson 已提交
238 239 240 241 242 243

	    TP_PROTO(struct drm_device *dev),

	    TP_ARGS(dev),

	    TP_STRUCT__entry(
244
			     __field(u32, dev)
C
Chris Wilson 已提交
245 246 247
			     ),

	    TP_fast_assign(
248
			   __entry->dev = dev->primary->index;
C
Chris Wilson 已提交
249 250
			   ),

251
	    TP_printk("dev=%u", __entry->dev)
C
Chris Wilson 已提交
252 253
);

254
DEFINE_EVENT(i915_ring, i915_ring_wait_begin,
C
Chris Wilson 已提交
255 256 257

	    TP_PROTO(struct drm_device *dev),

258 259
	    TP_ARGS(dev)
);
C
Chris Wilson 已提交
260

261
DEFINE_EVENT(i915_ring, i915_ring_wait_end,
C
Chris Wilson 已提交
262

263
	    TP_PROTO(struct drm_device *dev),
C
Chris Wilson 已提交
264

265
	    TP_ARGS(dev)
C
Chris Wilson 已提交
266 267
);

268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
TRACE_EVENT(i915_flip_request,
	    TP_PROTO(int plane, struct drm_gem_object *obj),

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
		    __field(struct drm_gem_object *, obj)
		    ),

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

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

TRACE_EVENT(i915_flip_complete,
	    TP_PROTO(int plane, struct drm_gem_object *obj),

	    TP_ARGS(plane, obj),

	    TP_STRUCT__entry(
		    __field(int, plane)
		    __field(struct drm_gem_object *, obj)
		    ),

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

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

304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
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 已提交
327 328 329 330
#endif /* _I915_TRACE_H_ */

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