@@ -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;
@@ -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;
}
@@ -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)
@@ -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),
@@ -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;
}