Dynamic power wells support
Subsystems (2)
cover Dynamic power wells support
From: Paulo Zanoni <[email protected]>
Hi
Daniel recently sent a patch to support disabling the power well, but when reviewing it I discovered that our code to enable/disable the power well - not part of Daniel's patch, only used by it - is broken. So I created a patch to fix this problem and then ported Daniel's patch to be on top of the fix.
With this, we are finally capable of correctly disabling/enabling the power well, but we are also uncovering a huge problem: we now get tons of "unclaimed register" errors, because we read/write the registers inside the "power down well" even when they're not being used.
I think we can try to apply patch 01 now, but before applying patch 02 we should probably try to get rid of all those "unclaimed register" messages that it brings. This will certainly not be a small task. I can volunteer myself to do this, but considering my TODO list I will certainly not be able to address this problem before January. The first step is certainly to avoid callingivb_disable_plane: this alone will already remove most of the error messages.
Comments? Volunteers?
Thanks,
Paulo
Daniel Vetter (1):
drm/i915: dynamic Haswell display power well support
Paulo Zanoni (1):
drm/i915: fix intel_init_power_wells
drivers/gpu/drm/i915/i915_reg.h | 8 ++--- drivers/gpu/drm/i915/intel_ddi.c | 8 ++++- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_pm.c | 70 +++++++++++++++++++++++++++--------- 5 files changed, 98 insertions(+), 27 deletions(-)
Signature · 1 line
1.7.11.7
PATCH 1/2 drm/i915: fix intel_init_power_wells
From: Paulo Zanoni <[email protected]>
The current code was wrong in many different ways, so this is a full rewrite. We don't have "different power wells for different parts of the GPU", we have a single power well, but we have multiple registers that can be used to request enabling/disabling the power well. So let's be a good citizen and only use the register we're suppose to use, except when we're loading the driver, where we clear the request made by the BIOS.
If any of the registers is requesting the power well to be enabled, it will be enabled. If none of the registers is requesting the power well to be enabled, it will be disabled.
For now we're just forcing the power well to be enabled, but in the next commits we'll change this.
--- drivers/gpu/drm/i915/i915_reg.h | 8 ++--- drivers/gpu/drm/i915/intel_display.c | 5 +-- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 70 +++++++++++++++++++++++++++--------- 4 files changed, 59 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -4
@@ -4414,10 +4414,10 @@#define AUDIO_CP_READY_C (1<<9)/* HSW Power Wells */ -#define HSW_PWR_WELL_CTL1 0x45400/* BIOS */ -#define HSW_PWR_WELL_CTL2 0x45404/* Driver */ -#define HSW_PWR_WELL_CTL3 0x45408/* KVMR */ -#define HSW_PWR_WELL_CTL4 0x4540C/* Debug */ +#define HSW_PWR_WELL_BIOS 0x45400/* CTL1 */ +#define HSW_PWR_WELL_DRIVER 0x45404/* CTL2 */ +#define HSW_PWR_WELL_KVMR 0x45408/* CTL3 */ +#define HSW_PWR_WELL_DEBUG 0x4540C/* CTL4 */ #define HSW_PWR_WELL_ENABLE (1<<31)#define HSW_PWR_WELL_STATE (1<<30)#define HSW_PWR_WELL_CTL5 0x45410
drivers/gpu/drm/i915/intel_display.c +1 -4
@@ -8593,10 +8593,7 @@ static void i915_disable_vga(struct drm_device *dev)void intel_modeset_init_hw (struct drm_device *dev) { -/* We attempt to init the necessary power wells early in the initialization -* time, so the subsystems that expect power to be enabled can work. -*/ -intel_init_power_wells (dev); +intel_init_power_well (dev);intel_prepare_ddi (dev);
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -646,7 +646,7 @@ extern void intel_update_fbc(struct drm_device *dev);extern void intel_gpu_ips_init (struct drm_i915_private *dev_priv);extern void intel_gpu_ips_teardown (void ); -extern void intel_init_power_wells (struct drm_device *dev); +extern void intel_init_power_well (struct drm_device *dev);extern void intel_enable_gt_powersave (struct drm_device *dev);extern void intel_disable_gt_powersave (struct drm_device *dev);extern void gen6_gt_check_fifodbg (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_pm.c +53 -17
86 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 2/2 drm/i915: dynamic Haswell display power well support
In reply to Paulo ZanoniFrom: Daniel Vetter <[email protected]>
We can disable (almost) all the display hw if we only use pipe A, with the integrated edp transcoder on port A. Because we don't set the cpu transcoder that early (yet), we need to help us with a trick to simply check for any edp encoders.
And wrt the old code: Can anyone explain what that struct mutex grabbing was supposed to protect?
v2: Paulo Zanoni pointed out that we also need to configure the eDP cpu transcoder correctly.
v3: Made by Paulo Zanoni
- Rebase patch to be on top of "fix intel_init_power_wells" patch
- Fix typos
- Fix a small bug by adding a "connectors_active" check
- Restore the initial code that unconditionally enables the power well when taking over from the BIOS
--- drivers/gpu/drm/i915/intel_ddi.c | 8 +++++++- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 2 +- 4 files changed, 40 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +7 -1
@@ -960,7 +960,13 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)if (cpu_transcoder ==TRANSCODER_EDP ) {switch (pipe) {case PIPE_A : - temp |=TRANS_DDI_EDP_INPUT_A_ONOFF ; +/* Can only use the always-on power well for eDP when +* not using the panel fitter, and when not using motion +* blur mitigation (which we don't support). */ +if (dev_priv->pch_pf_size) + temp |=TRANS_DDI_EDP_INPUT_A_ONOFF ; +else + temp |=TRANS_DDI_EDP_INPUT_A_ON ;break ;case PIPE_B : temp |=TRANS_DDI_EDP_INPUT_B_ONOFF ;
drivers/gpu/drm/i915/intel_display.c +31 -0
@@ -5449,6 +5449,35 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,return fdi_config_ok ? ret : -EINVAL ; } +static void haswell_modeset_global_resources (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +bool enable = false; +struct intel_crtc *crtc; +struct intel_encoder *encoder; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { +if (crtc->pipe !=PIPE_A && crtc->base.enabled) + enable = true; +/* XXX: Should check for edp transcoder here, but thanks to init +* sequence that's not yet availble. Just in case desktop eDP on +* PORT D is possible on haswell, too. */ + } + +list_for_each_entry (encoder, &dev->mode_config.encoder_list, + base.head) { +if (encoder->type !=INTEL_OUTPUT_EDP && + encoder->connectors_active) + enable = true; + } + +/* Even the eDP panel fitter is outside the always-on well. */ +if (dev_priv->pch_pf_size) + enable = true; + +intel_set_power_well (dev, enable); +} + static int haswell_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode,
@@ -8422,6 +8451,8 @@ static void intel_init_display(struct drm_device *dev) }else if (IS_HASWELL (dev)) { dev_priv->display.fdi_link_train = hsw_fdi_link_train; dev_priv->display.write_eld = haswell_write_eld; + dev_priv->display.modeset_global_resources = + haswell_modeset_global_resources; }else dev_priv->display.update_wm =NULL ; }else if (IS_G4X (dev)) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -647,6 +647,7 @@ extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);extern void intel_gpu_ips_teardown (void );extern void intel_init_power_well (struct drm_device *dev); +extern void intel_set_power_well (struct drm_device *dev,bool enable);extern void intel_enable_gt_powersave (struct drm_device *dev);extern void intel_disable_gt_powersave (struct drm_device *dev);extern void gen6_gt_check_fifodbg (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -3919,7 +3919,7 @@ void intel_init_clock_gating(struct drm_device *dev) dev_priv->display.init_clock_gating (dev); } -static void intel_set_power_well (struct drm_device *dev,bool enable) +void intel_set_power_well (struct drm_device *dev,bool enable) {struct drm_i915_private *dev_priv = dev->dev_private;bool is_enabled, enable_requested;
Signature · 1 line
1.7.11.7