From patchwork Fri Mar 18 17:56:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 644601 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IIMCWD012117 for ; Fri, 18 Mar 2011 18:22:33 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 723879E7E8 for ; Fri, 18 Mar 2011 10:57:31 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cpoproxy1-pub.bluehost.com (cpoproxy1-pub.bluehost.com [69.89.21.11]) by gabe.freedesktop.org (Postfix) with SMTP id 22C729E8A7 for ; Fri, 18 Mar 2011 10:56:24 -0700 (PDT) Received: (qmail 30649 invoked by uid 0); 18 Mar 2011 17:56:24 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by cpoproxy1.bluehost.com with SMTP; 18 Mar 2011 17:56:24 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=virtuousgeek.org; h=Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:X-Identified-User; b=iokutfN2Mitu2lp8Ew5S/tkXoA2Qs9j62agCo5TwkZ1+SjZtDktUA0oPcLM9AhHXUcCmGpvoGhSDX6OmvPzjxdt7e/a4Mp55JCabNJHycQ+70lQGBLRQWlR0j27uagk8; Received: from c-67-174-193-198.hsd1.ca.comcast.net ([67.174.193.198] helo=jbarnes-hp6360) by box514.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Q0duR-0007y2-G4; Fri, 18 Mar 2011 11:56:23 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Mar 2011 10:56:15 -0700 Message-Id: <1300470975-2521-2-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1300470975-2521-1-git-send-email-jbarnes@virtuousgeek.org> References: <1300470975-2521-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.174.193.198 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 2/2] drm/i915: add idle/busy tracepoints X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 18:22:33 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c8a21ce..adff483 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -674,6 +674,10 @@ typedef struct drm_i915_private { int lvds_downclock; struct work_struct idle_work; struct timer_list idle_timer; + + bool gpu_busy; + unsigned long gpu_busy_start; + bool busy; u16 orig_clock; int child_dev_num; diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ac23dcf..18534d7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2208,6 +2208,8 @@ i915_gpu_idle(struct drm_device *dev) bool lists_empty; int ret, i; + trace_i915_gpu_idle_start(dev); + lists_empty = (list_empty(&dev_priv->mm.flushing_list) && list_empty(&dev_priv->mm.active_list)); if (lists_empty) @@ -2220,6 +2222,8 @@ i915_gpu_idle(struct drm_device *dev) return ret; } + trace_i915_gpu_idle_end(dev); + return 0; } diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 346dd85..0d3cc62 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -365,6 +365,11 @@ static void notify_ring(struct drm_device *dev, dev_priv->hangcheck_count = 0; mod_timer(&dev_priv->hangcheck_timer, jiffies + msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)); + + if (I915_READ_HEAD(ring) == I915_READ_TAIL(ring)) { + dev_priv->gpu_busy = false; + trace_i915_gpu_busy_end(dev_priv->dev); + } } static void gen6_pm_irq_handler(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index e102c76..1eb63a6 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h @@ -410,6 +410,41 @@ TRACE_EVENT(i915_reg_rw, (u32)(__entry->val >> 32)) ); +DECLARE_EVENT_CLASS(i915_gpu_global, + TP_PROTO(struct drm_device *dev), + TP_ARGS(dev), + + TP_STRUCT__entry( + __field(int, dev) + ), + + TP_fast_assign( + __entry->dev = dev->primary->index; + ), + + TP_printk("dev=%d", __entry->dev) +); + +DEFINE_EVENT(i915_gpu_global, i915_gpu_idle_start, + TP_PROTO(struct drm_device *dev), + TP_ARGS(dev) +); + +DEFINE_EVENT(i915_gpu_global, i915_gpu_idle_end, + TP_PROTO(struct drm_device *dev), + TP_ARGS(dev) +); + +DEFINE_EVENT(i915_gpu_global, i915_gpu_busy_start, + TP_PROTO(struct drm_device *dev), + TP_ARGS(dev) +); + +DEFINE_EVENT(i915_gpu_global, i915_gpu_busy_end, + TP_PROTO(struct drm_device *dev), + TP_ARGS(dev) +); + TRACE_EVENT(i915_pkg_power, TP_PROTO(unsigned long power), TP_ARGS(power), diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 789c478..530d9c3 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1089,6 +1089,12 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring, intel_ring_emit(ring, offset); intel_ring_advance(ring); + if (!dev_priv->gpu_busy) { + dev_priv->gpu_busy = true; + trace_i915_gpu_busy_start(ring->dev); + dev_priv->gpu_busy_start = jiffies; + } + return 0; }