| From cd8db09ea1d2c437b5227e22e045f47b13341950 Mon Sep 17 00:00:00 2001 |
| From: Chris Wilson <chris@chris-wilson.co.uk> |
| Date: Tue, 27 Aug 2013 17:04:17 +0100 |
| Subject: drm/i915: Track pfit enable state separately from size |
| |
| Detangle the additional state of whether or not the hw has the pfit |
| enabled from whether it has zero size. This allows us to cleanly |
| distinguish in the code when we expect the pfit to be enabled (for |
| Haswell pc8), and when the BIOS is confused and needs sanitizing. |
| |
| Reported-by: shui yanwei <yangweix.shui@intel.com> |
| Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> |
| Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68251 |
| Tested-by: shui yanwei <yangweix.shui@intel.com> |
| Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> |
| (cherry picked from commit fd4daa9cea025ddf8623db289e79d264e9fa66f6) |
| Signed-off-by: Darren Hart <dvhart@linux.intel.com> |
| --- |
| drivers/gpu/drm/i915/intel_ddi.c | 2 +- |
| drivers/gpu/drm/i915/intel_display.c | 21 +++++++++++++-------- |
| drivers/gpu/drm/i915/intel_drv.h | 1 + |
| drivers/gpu/drm/i915/intel_panel.c | 1 + |
| drivers/gpu/drm/i915/intel_pm.c | 6 +++--- |
| 5 files changed, 19 insertions(+), 12 deletions(-) |
| |
| diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
| index 060ea5096e52..ace63bd7afe6 100644 |
| --- a/drivers/gpu/drm/i915/intel_ddi.c |
| +++ b/drivers/gpu/drm/i915/intel_ddi.c |
| @@ -778,7 +778,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) |
| /* 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 (intel_crtc->config.pch_pfit.size) |
| + if (intel_crtc->config.pch_pfit.enabled) |
| temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; |
| else |
| temp |= TRANS_DDI_EDP_INPUT_A_ON; |
| diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
| index 099ad416fcdd..98af7eb372a4 100644 |
| --- a/drivers/gpu/drm/i915/intel_display.c |
| +++ b/drivers/gpu/drm/i915/intel_display.c |
| @@ -2252,7 +2252,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, |
| I915_WRITE(PIPESRC(intel_crtc->pipe), |
| ((crtc->mode.hdisplay - 1) << 16) | |
| (crtc->mode.vdisplay - 1)); |
| - if (!intel_crtc->config.pch_pfit.size && |
| + if (!intel_crtc->config.pch_pfit.enabled && |
| (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) || |
| intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { |
| I915_WRITE(PF_CTL(intel_crtc->pipe), 0); |
| @@ -3206,7 +3206,7 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc) |
| struct drm_i915_private *dev_priv = dev->dev_private; |
| int pipe = crtc->pipe; |
| |
| - if (crtc->config.pch_pfit.size) { |
| + if (crtc->config.pch_pfit.enabled) { |
| /* Force use of hard-coded filter coefficients |
| * as some pre-programmed values are broken, |
| * e.g. x201. |
| @@ -3433,7 +3433,7 @@ static void ironlake_pfit_disable(struct intel_crtc *crtc) |
| |
| /* To avoid upsetting the power well on haswell only disable the pfit if |
| * it's in use. The hw state code will make sure we get this right. */ |
| - if (crtc->config.pch_pfit.size) { |
| + if (crtc->config.pch_pfit.enabled) { |
| I915_WRITE(PF_CTL(pipe), 0); |
| I915_WRITE(PF_WIN_POS(pipe), 0); |
| I915_WRITE(PF_WIN_SZ(pipe), 0); |
| @@ -5874,6 +5874,7 @@ static void ironlake_get_pfit_config(struct intel_crtc *crtc, |
| tmp = I915_READ(PF_CTL(crtc->pipe)); |
| |
| if (tmp & PF_ENABLE) { |
| + pipe_config->pch_pfit.enabled = true; |
| pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe)); |
| pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe)); |
| |
| @@ -6251,7 +6252,7 @@ static void haswell_modeset_global_resources(struct drm_device *dev) |
| if (!crtc->base.enabled) |
| continue; |
| |
| - if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.size || |
| + if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.enabled || |
| crtc->config.cpu_transcoder != TRANSCODER_EDP) |
| enable = true; |
| } |
| @@ -8228,9 +8229,10 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, |
| pipe_config->gmch_pfit.control, |
| pipe_config->gmch_pfit.pgm_ratios, |
| pipe_config->gmch_pfit.lvds_border_bits); |
| - DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x\n", |
| + DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x, %s\n", |
| pipe_config->pch_pfit.pos, |
| - pipe_config->pch_pfit.size); |
| + pipe_config->pch_pfit.size, |
| + pipe_config->pch_pfit.enabled ? "enabled" : "disabled"); |
| DRM_DEBUG_KMS("ips: %i\n", pipe_config->ips_enabled); |
| } |
| |
| @@ -8626,8 +8628,11 @@ intel_pipe_config_compare(struct drm_device *dev, |
| if (INTEL_INFO(dev)->gen < 4) |
| PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); |
| PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); |
| - PIPE_CONF_CHECK_I(pch_pfit.pos); |
| - PIPE_CONF_CHECK_I(pch_pfit.size); |
| + PIPE_CONF_CHECK_I(pch_pfit.enabled); |
| + if (current_config->pch_pfit.enabled) { |
| + PIPE_CONF_CHECK_I(pch_pfit.pos); |
| + PIPE_CONF_CHECK_I(pch_pfit.size); |
| + } |
| |
| PIPE_CONF_CHECK_I(ips_enabled); |
| |
| diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
| index 322dbc6b20a2..90cf672c0c69 100644 |
| --- a/drivers/gpu/drm/i915/intel_drv.h |
| +++ b/drivers/gpu/drm/i915/intel_drv.h |
| @@ -284,6 +284,7 @@ struct intel_crtc_config { |
| struct { |
| u32 pos; |
| u32 size; |
| + bool enabled; |
| } pch_pfit; |
| |
| /* FDI configuration, only valid if has_pch_encoder is set. */ |
| diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c |
| index 42114ecbae0e..293564a2896a 100644 |
| --- a/drivers/gpu/drm/i915/intel_panel.c |
| +++ b/drivers/gpu/drm/i915/intel_panel.c |
| @@ -112,6 +112,7 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, |
| done: |
| pipe_config->pch_pfit.pos = (x << 16) | y; |
| pipe_config->pch_pfit.size = (width << 16) | height; |
| + pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; |
| } |
| |
| static void |
| diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
| index 0c115cc4899f..dd176b7296c1 100644 |
| --- a/drivers/gpu/drm/i915/intel_pm.c |
| +++ b/drivers/gpu/drm/i915/intel_pm.c |
| @@ -2096,16 +2096,16 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev, |
| struct drm_crtc *crtc) |
| { |
| struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| - uint32_t pixel_rate, pfit_size; |
| + uint32_t pixel_rate; |
| |
| pixel_rate = intel_crtc->config.adjusted_mode.clock; |
| |
| /* We only use IF-ID interlacing. If we ever use PF-ID we'll need to |
| * adjust the pixel_rate here. */ |
| |
| - pfit_size = intel_crtc->config.pch_pfit.size; |
| - if (pfit_size) { |
| + if (intel_crtc->config.pch_pfit.enabled) { |
| uint64_t pipe_w, pipe_h, pfit_w, pfit_h; |
| + uint32_t pfit_size = intel_crtc->config.pch_pfit.size; |
| |
| pipe_w = intel_crtc->config.requested_mode.hdisplay; |
| pipe_h = intel_crtc->config.requested_mode.vdisplay; |
| -- |
| 1.8.5.rc3 |
| |