Suggested by Daniel. Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_pm.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index e81e7de..21ccf89 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5338,6 +5338,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv, hsw_enable_package_c8(dev_priv); } +static void check_power_well_state(struct drm_i915_private *dev_priv, + struct i915_power_well *power_well) +{ + bool enabled; + + if (!power_well->ops->is_enabled) + return; + + enabled = power_well->ops->is_enabled(dev_priv, power_well); + + if (enabled != (power_well->count > 0 || !i915.disable_power_well)) { + DRM_ERROR("state mismatch for '%s' (hw state %d use-count %d disable_power_well %d\n", + power_well->name, enabled, power_well->count, + i915.disable_power_well); + WARN_ON(1); + } +} + void intel_display_power_get(struct drm_i915_private *dev_priv, enum intel_display_power_domain domain) { @@ -5349,9 +5367,14 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, mutex_lock(&power_domains->lock); - for_each_power_well(i, power_well, BIT(domain), power_domains) - if (!power_well->count++ && power_well->ops->enable) + for_each_power_well(i, power_well, BIT(domain), power_domains) { + if (!power_well->count++ && power_well->ops->enable) { + DRM_DEBUG_KMS("enabling %s\n", power_well->name); power_well->ops->enable(dev_priv, power_well); + } + + check_power_well_state(dev_priv, power_well); + } power_domains->domain_use_count[domain]++; @@ -5376,8 +5399,12 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, WARN_ON(!power_well->count); if (!--power_well->count && power_well->ops->disable && - i915.disable_power_well) + i915.disable_power_well) { + DRM_DEBUG_KMS("disabling %s\n", power_well->name); power_well->ops->disable(dev_priv, power_well); + } + + check_power_well_state(dev_priv, power_well); } mutex_unlock(&power_domains->lock); -- 1.8.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx