On Fri, 18 Mar 2011 10:56:15 -0700, Jesse Barnes <jbar...@virtuousgeek.org> wrote: > Add trace points for when the GPU goes from idle to busy and vice-versa. > Also trace when we start to idle the GPU and when it finally does idle > (this could take awhile if the ring is full of commands). > > Signed-off-by: Jesse Barnes <jbar...@virtuousgeek.org> > --- > drivers/gpu/drm/i915/i915_drv.h | 4 +++ > drivers/gpu/drm/i915/i915_gem.c | 4 +++ > drivers/gpu/drm/i915/i915_irq.c | 5 ++++ > drivers/gpu/drm/i915/i915_trace.h | 35 > +++++++++++++++++++++++++++++++ > drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++++ > 5 files changed, 54 insertions(+), 0 deletions(-) > > 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); > + } > }
IRQ notifies should in fact be few and far between. I do not see how you actually detect when the gpu goes idle should we not be waiting on a request. So I think you need a pair of ring->irq_get/irq_put in and add tracepoints for each ring as opposed to device! You can then have a device busy which is the summation of active rings... -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx