From patchwork Fri Nov 16 14:22:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 1755351 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 3F169DF230 for ; Fri, 16 Nov 2012 14:32:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A7C9E5CE6 for ; Fri, 16 Nov 2012 06:32:29 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id B978F436DB; Fri, 16 Nov 2012 06:23:01 -0800 (PST) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 16 Nov 2012 06:23:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,265,1352102400"; d="scan'208";a="169200729" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by AZSMGA002.ch.intel.com with SMTP; 16 Nov 2012 06:22:58 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 16 Nov 2012 16:22:57 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 08/13] drm/i915: Add pin count trace point Date: Fri, 16 Nov 2012 16:22:20 +0200 Message-Id: <1353075745-30115-9-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> References: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä A new trace point for tracking changes to gem object pin count. Signed-off-by: Ville Syrjälä --- 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 5158461..0bfc8af 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3466,6 +3466,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; @@ -3475,6 +3477,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); @@ -3753,6 +3757,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),