[Intel-gfx] [PATCH v2] drm/i915/pmu: Clear the previous sample value when parking

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 23 08:54:35 UTC 2017


When turning off the engines, and the pmu sampling, clear the previous
value as the current measurement should be 0.

v2: Use a for-loop

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 1071935bfa67..a35422c6672b 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -135,6 +135,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 
 void i915_pmu_gt_parked(struct drm_i915_private *i915)
 {
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+	int i;
+
 	if (!i915->pmu.base.event_init)
 		return;
 
@@ -145,6 +149,12 @@ void i915_pmu_gt_parked(struct drm_i915_private *i915)
 	 */
 	i915->pmu.timer_enabled = pmu_needs_timer(i915, false);
 	spin_unlock_irq(&i915->pmu.lock);
+
+	/* This is quite rough... We need to coordinate with the timer etc. */
+	for_each_engine(engine, i915, id) {
+		for (i = 0; i < ARRAY_SIZE(engine->pmu.sample); i++)
+			engine->pmu.sample[i].prev = 0;
+	}
 }
 
 static void __i915_pmu_maybe_start_timer(struct drm_i915_private *i915)
-- 
2.15.0



More information about the Intel-gfx mailing list