From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> A new trace point for tracking changes to gem object pin count. Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem.c | 6 ++++++ drivers/gpu/drm/i915/i915_trace.h | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f2f63ba..d4b76d9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3482,6 +3482,8 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, if (!obj->has_global_gtt_mapping && map_and_fenceable) i915_gem_gtt_bind_object(obj, obj->cache_level); + trace_i915_gem_object_pin_count(obj, obj->pin_count, obj->pin_count + 1); + obj->pin_count++; obj->pin_mappable |= map_and_fenceable; @@ -3491,6 +3493,8 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, void i915_gem_object_unpin(struct drm_i915_gem_object *obj) { + trace_i915_gem_object_pin_count(obj, obj->pin_count, obj->pin_count - 1); + BUG_ON(obj->pin_count == 0); BUG_ON(obj->gtt_space == NULL); @@ -3769,6 +3773,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj) if (obj->phys_obj) i915_gem_detach_phys_object(dev, obj); + trace_i915_gem_object_pin_count(obj, obj->pin_count, 0); + obj->pin_count = 0; if (WARN_ON(i915_gem_object_unbind(obj) == -ERESTARTSYS)) { bool was_interruptible; diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 3db4a68..44f8d40 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h @@ -16,6 +16,25 @@ /* object tracking */ +TRACE_EVENT(i915_gem_object_pin_count, + TP_PROTO(struct drm_i915_gem_object *obj, u32 pin_count_pre, u32 pin_count_post), + TP_ARGS(obj, pin_count_pre, pin_count_post), + + TP_STRUCT__entry( + __field(struct drm_i915_gem_object *, obj) + __field(u32, pin_count_pre) + __field(u32, pin_count_post) + ), + + TP_fast_assign( + __entry->obj = obj; + __entry->pin_count_pre = pin_count_pre; + __entry->pin_count_post = pin_count_post; + ), + + TP_printk("obj=%p, pin_count=%u->%u", __entry->obj, __entry->pin_count_pre, __entry->pin_count_post) +); + TRACE_EVENT(i915_gem_object_create, TP_PROTO(struct drm_i915_gem_object *obj), TP_ARGS(obj), -- 1.7.8.6 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel