diff mbox

drm/i915: Show RPS autotuning thresholds along with waitboost

Message ID 1471164763-6251-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Aug. 14, 2016, 8:52 a.m. UTC
For convenience when debugging user issues show the autotuning
RPS parameters in debugfs/i915_rps_boost_info.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rainer Hochecker <fernetmenta@kodi.tv>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 4ad2355f510a..d7c2064c28bd 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2340,6 +2340,16 @@  static int count_irq_waiters(struct drm_i915_private *i915)
 	return count;
 }
 
+static const char *rps_power_to_str(int power)
+{
+	switch (power) {
+	default: return "unknown";
+	case LOW_POWER: return "low power";
+	case BETWEEN: return "mixed";
+	case HIGH_POWER: return "high power";
+	}
+}
+
 static int i915_rps_boost_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = m->private;
@@ -2377,6 +2387,27 @@  static int i915_rps_boost_info(struct seq_file *m, void *data)
 	spin_unlock(&dev_priv->rps.client_lock);
 	mutex_unlock(&dev->filelist_mutex);
 
+	if (INTEL_GEN(dev_priv) >= 6) {
+		u32 rpupei, rpcurup;
+		u32 rpdownei, rpcurdown;
+
+		intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+		rpupei = I915_READ_FW(GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
+		rpcurup = I915_READ_FW(GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
+		rpdownei = I915_READ_FW(GEN6_RP_CUR_DOWN_EI) & GEN6_CURIAVG_MASK;
+		rpcurdown = I915_READ_FW(GEN6_RP_CUR_DOWN) & GEN6_CURBSYTAVG_MASK;
+		intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
+
+		seq_printf(m, "\nRPS Autotuning (current \"%s\" window):\n",
+			   rps_power_to_str(dev_priv->rps.power));
+		seq_printf(m, "  Avg. busy: %d%% [threshold %d%%]\n",
+			   100*rpcurup/rpupei,
+			   dev_priv->rps.up_threshold);
+		seq_printf(m, "  Avg. idle: %d%% [threshold %d%%]\n",
+			   100*rpcurdown/rpdownei,
+			   dev_priv->rps.down_threshold);
+	}
+
 	return 0;
 }