Commit 2d29f7576d8a79e4effb79404e76ea911488a44e
Committed by
Greg Kroah-Hartman
1 parent
22d58715d7
Exists in
ti-linux-3.14.y
and in
2 other branches
drm/i915: fix display power sw state reporting
commit b8c000d9bf23e7c1155ef421f595d1cbc25262da upstream. Atm, we refcount both power domains and power wells and intel_display_power_enabled_sw() returns the power domain refcount. What the callers are really interested in though is the sw state of the underlying power wells. Due to this we will report incorrectly that a given power domain is off if its power wells were enabled via another power domain, for example POWER_DOMAIN_INIT which enables all power wells. As a fix return instead the state based on the refcount of all power wells included in the passed in power domain. References: https://bugs.freedesktop.org/show_bug.cgi?id=79505 References: https://bugs.freedesktop.org/show_bug.cgi?id=79038 Reported-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 16 additions and 1 deletions Side-by-side Diff
drivers/gpu/drm/i915/intel_pm.c
... | ... | @@ -5138,10 +5138,25 @@ |
5138 | 5138 | { |
5139 | 5139 | struct drm_i915_private *dev_priv = dev->dev_private; |
5140 | 5140 | struct i915_power_domains *power_domains; |
5141 | + struct i915_power_well *power_well; | |
5142 | + bool is_enabled; | |
5143 | + int i; | |
5141 | 5144 | |
5145 | + if (dev_priv->pm.suspended) | |
5146 | + return false; | |
5147 | + | |
5142 | 5148 | power_domains = &dev_priv->power_domains; |
5149 | + is_enabled = true; | |
5150 | + for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | |
5151 | + if (power_well->always_on) | |
5152 | + continue; | |
5143 | 5153 | |
5144 | - return power_domains->domain_use_count[domain]; | |
5154 | + if (!power_well->count) { | |
5155 | + is_enabled = false; | |
5156 | + break; | |
5157 | + } | |
5158 | + } | |
5159 | + return is_enabled; | |
5145 | 5160 | } |
5146 | 5161 | |
5147 | 5162 | bool intel_display_power_enabled(struct drm_device *dev, |