[PATCH 07/25] drm/i915: context trace events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 04, 2012 at 02:42:47PM -0700, Ben Widawsky wrote:
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>

I'll punt on that one because I've punted on the obj->context_id patch,
too. Imo we could switch the context_switch tracepoint to object pointers
for both to and from (and maybe keep to->id for convenience).
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c |    4 +++
>  drivers/gpu/drm/i915/i915_trace.h       |   55 +++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index aabe7d9..388cf62 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -130,6 +130,8 @@ static void do_destroy(struct i915_hw_context *ctx)
>  	else
>  		BUG_ON(ctx != dev_priv->ring[RCS].default_context);
>  
> +	trace_i915_context_destroy(ctx);
> +
>  	drm_gem_object_unreference(&ctx->obj->base);
>  	kfree(ctx);
>  }
> @@ -185,6 +187,7 @@ again:
>  
>  out:
>  	(*ctx_out)->obj->context_id = (*ctx_out)->id;
> +	trace_i915_context_create(*ctx_out);
>  	return 0;
>  
>  err_out:
> @@ -398,6 +401,7 @@ static int do_switch(struct drm_i915_gem_object *from_obj,
>  	ring->last_context_obj = to->obj;
>  	to->is_initialized = true;
>  
> +	trace_i915_context_switch(from_obj, to);
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index fe90b3a..6d8412c 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -434,6 +434,61 @@ TRACE_EVENT(i915_reg_rw,
>  		(u32)(__entry->val >> 32))
>  );
>  
> +/* Context tracking */
> +TRACE_EVENT(i915_context_create,
> +	    TP_PROTO(struct i915_hw_context *ctx),
> +	    TP_ARGS(ctx),
> +
> +	    TP_STRUCT__entry(
> +			     __field(struct i915_hw_context *, ctx)
> +			     __field(u32, id)
> +			     __field(struct drm_i915_gem_object *, obj)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __entry->ctx = ctx;
> +			   __entry->id = ctx->id;
> +			   __entry->obj = ctx->obj;
> +			   ),
> +
> +	    TP_printk("ctx=%p, id=%u, obj=%p",
> +		      __entry->ctx, __entry->id, __entry->obj)
> +);
> +
> +TRACE_EVENT(i915_context_destroy,
> +	    TP_PROTO(struct i915_hw_context *ctx),
> +	    TP_ARGS(ctx),
> +
> +	    TP_STRUCT__entry(
> +			     __field(struct i915_hw_context *, ctx)
> +			     __field(u32, id)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __entry->ctx = ctx;
> +			   __entry->id = ctx->id;
> +			   ),
> +
> +	    TP_printk("ctx=%p, id=%u", __entry->ctx, __entry->id)
> +);
> +
> +TRACE_EVENT(i915_context_switch,
> +	    TP_PROTO(struct drm_i915_gem_object *from, struct i915_hw_context *to),
> +	    TP_ARGS(from, to),
> +
> +	    TP_STRUCT__entry(
> +			     __field(int, from)
> +			     __field(int, to)
> +			    ),
> +
> +	    TP_fast_assign(
> +			   __entry->from = from->context_id;
> +			   __entry->to = to->id;
> +			   ),
> +
> +	    TP_printk("context switch from %d to %d",
> +		      __entry->from, __entry->to)
> +);
>  #endif /* _I915_TRACE_H_ */
>  
>  /* This part must be outside protection */
> -- 
> 1.7.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux