Commit 6efdf354 authored by Imre Deak's avatar Imre Deak Committed by Daniel Vetter

drm/i915: enable only the needed power domains during modeset

So far the modeset code enabled all power domains if it needed any. It
wasn't a problem since HW generations so far only had one always-on
power well and one dynamic power well that can be enabled/disabled. For
domains powered by always-on power wells (panel fitter on pipe A and the
eDP transcoder) we didn't do anything, for all other domains we just
enabled the single dynamic power well.

Future HW generations will change this, as they add multiple dynamic
power wells. Support for these will be added later, this patch prepares
for those by making sure we only enable the required domains.

Note that after this change on HSW we'll enable all power domains even
if it was the domain for the panel fitter on pipe A or the eDP
transcoder. This isn't a problem since the power domain framework
already checks if the domain is on an always-on power well and doesn't
do anything in this case.
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4f074129
...@@ -6557,21 +6557,57 @@ static void hsw_package_c8_gpu_busy(struct drm_i915_private *dev_priv) ...@@ -6557,21 +6557,57 @@ static void hsw_package_c8_gpu_busy(struct drm_i915_private *dev_priv)
} }
} }
#define for_each_power_domain(domain, mask) \
for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \
if ((1 << (domain)) & (mask))
static unsigned long get_pipe_power_domains(struct drm_device *dev,
enum pipe pipe, bool pfit_enabled)
{
unsigned long mask;
enum transcoder transcoder;
transcoder = intel_pipe_to_cpu_transcoder(dev->dev_private, pipe);
mask = BIT(POWER_DOMAIN_PIPE(pipe));
mask |= BIT(POWER_DOMAIN_TRANSCODER(transcoder));
if (pfit_enabled)
mask |= BIT(POWER_DOMAIN_PIPE_PANEL_FITTER(pipe));
return mask;
}
static void modeset_update_power_wells(struct drm_device *dev) static void modeset_update_power_wells(struct drm_device *dev)
{ {
bool enable = false; unsigned long pipe_domains[I915_MAX_PIPES] = { 0, };
struct intel_crtc *crtc; struct intel_crtc *crtc;
/*
* First get all needed power domains, then put all unneeded, to avoid
* any unnecessary toggling of the power wells.
*/
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
enum intel_display_power_domain domain;
if (!crtc->base.enabled) if (!crtc->base.enabled)
continue; continue;
if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.enabled || pipe_domains[crtc->pipe] = get_pipe_power_domains(dev,
crtc->config.cpu_transcoder != TRANSCODER_EDP) crtc->pipe,
enable = true; crtc->config.pch_pfit.enabled);
for_each_power_domain(domain, pipe_domains[crtc->pipe])
intel_display_power_get(dev, domain);
} }
intel_set_power_well(dev, enable); list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
enum intel_display_power_domain domain;
for_each_power_domain(domain, crtc->enabled_power_domains)
intel_display_power_put(dev, domain);
crtc->enabled_power_domains = pipe_domains[crtc->pipe];
}
} }
static void haswell_modeset_global_resources(struct drm_device *dev) static void haswell_modeset_global_resources(struct drm_device *dev)
......
...@@ -326,6 +326,7 @@ struct intel_crtc { ...@@ -326,6 +326,7 @@ struct intel_crtc {
* some outputs connected to this crtc. * some outputs connected to this crtc.
*/ */
bool active; bool active;
unsigned long enabled_power_domains;
bool eld_vld; bool eld_vld;
bool primary_enabled; /* is the primary plane (partially) visible? */ bool primary_enabled; /* is the primary plane (partially) visible? */
bool lowfreq_avail; bool lowfreq_avail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment