Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chris Wilson and committed by
Daniel Vetter
fd4daa9c 6e1b4fda

+19 -12
+1 -1
drivers/gpu/drm/i915/intel_ddi.c
··· 778 778 /* Can only use the always-on power well for eDP when 779 779 * not using the panel fitter, and when not using motion 780 780 * blur mitigation (which we don't support). */ 781 - if (intel_crtc->config.pch_pfit.size) 781 + if (intel_crtc->config.pch_pfit.enabled) 782 782 temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; 783 783 else 784 784 temp |= TRANS_DDI_EDP_INPUT_A_ON;
+13 -8
drivers/gpu/drm/i915/intel_display.c
··· 2249 2249 I915_WRITE(PIPESRC(intel_crtc->pipe), 2250 2250 ((crtc->mode.hdisplay - 1) << 16) | 2251 2251 (crtc->mode.vdisplay - 1)); 2252 - if (!intel_crtc->config.pch_pfit.size && 2252 + if (!intel_crtc->config.pch_pfit.enabled && 2253 2253 (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) || 2254 2254 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { 2255 2255 I915_WRITE(PF_CTL(intel_crtc->pipe), 0); ··· 3203 3203 struct drm_i915_private *dev_priv = dev->dev_private; 3204 3204 int pipe = crtc->pipe; 3205 3205 3206 - if (crtc->config.pch_pfit.size) { 3206 + if (crtc->config.pch_pfit.enabled) { 3207 3207 /* Force use of hard-coded filter coefficients 3208 3208 * as some pre-programmed values are broken, 3209 3209 * e.g. x201. ··· 3428 3428 3429 3429 /* To avoid upsetting the power well on haswell only disable the pfit if 3430 3430 * it's in use. The hw state code will make sure we get this right. */ 3431 - if (crtc->config.pch_pfit.size) { 3431 + if (crtc->config.pch_pfit.enabled) { 3432 3432 I915_WRITE(PF_CTL(pipe), 0); 3433 3433 I915_WRITE(PF_WIN_POS(pipe), 0); 3434 3434 I915_WRITE(PF_WIN_SZ(pipe), 0); ··· 5859 5859 tmp = I915_READ(PF_CTL(crtc->pipe)); 5860 5860 5861 5861 if (tmp & PF_ENABLE) { 5862 + pipe_config->pch_pfit.enabled = true; 5862 5863 pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe)); 5863 5864 pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe)); 5864 5865 ··· 6237 6236 if (!crtc->base.enabled) 6238 6237 continue; 6239 6238 6240 - if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.size || 6239 + if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.enabled || 6241 6240 crtc->config.cpu_transcoder != TRANSCODER_EDP) 6242 6241 enable = true; 6243 6242 } ··· 8206 8205 pipe_config->gmch_pfit.control, 8207 8206 pipe_config->gmch_pfit.pgm_ratios, 8208 8207 pipe_config->gmch_pfit.lvds_border_bits); 8209 - DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x\n", 8208 + DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x, %s\n", 8210 8209 pipe_config->pch_pfit.pos, 8211 - pipe_config->pch_pfit.size); 8210 + pipe_config->pch_pfit.size, 8211 + pipe_config->pch_pfit.enabled ? "enabled" : "disabled"); 8212 8212 DRM_DEBUG_KMS("ips: %i\n", pipe_config->ips_enabled); 8213 8213 } 8214 8214 ··· 8605 8603 if (INTEL_INFO(dev)->gen < 4) 8606 8604 PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); 8607 8605 PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); 8608 - PIPE_CONF_CHECK_I(pch_pfit.pos); 8609 - PIPE_CONF_CHECK_I(pch_pfit.size); 8606 + PIPE_CONF_CHECK_I(pch_pfit.enabled); 8607 + if (current_config->pch_pfit.enabled) { 8608 + PIPE_CONF_CHECK_I(pch_pfit.pos); 8609 + PIPE_CONF_CHECK_I(pch_pfit.size); 8610 + } 8610 8611 8611 8612 PIPE_CONF_CHECK_I(ips_enabled); 8612 8613
+1
drivers/gpu/drm/i915/intel_drv.h
··· 280 280 struct { 281 281 u32 pos; 282 282 u32 size; 283 + bool enabled; 283 284 } pch_pfit; 284 285 285 286 /* FDI configuration, only valid if has_pch_encoder is set. */
+1
drivers/gpu/drm/i915/intel_panel.c
··· 112 112 done: 113 113 pipe_config->pch_pfit.pos = (x << 16) | y; 114 114 pipe_config->pch_pfit.size = (width << 16) | height; 115 + pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; 115 116 } 116 117 117 118 static void
+3 -3
drivers/gpu/drm/i915/intel_pm.c
··· 2096 2096 struct drm_crtc *crtc) 2097 2097 { 2098 2098 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 2099 - uint32_t pixel_rate, pfit_size; 2099 + uint32_t pixel_rate; 2100 2100 2101 2101 pixel_rate = intel_crtc->config.adjusted_mode.clock; 2102 2102 2103 2103 /* We only use IF-ID interlacing. If we ever use PF-ID we'll need to 2104 2104 * adjust the pixel_rate here. */ 2105 2105 2106 - pfit_size = intel_crtc->config.pch_pfit.size; 2107 - if (pfit_size) { 2106 + if (intel_crtc->config.pch_pfit.enabled) { 2108 2107 uint64_t pipe_w, pipe_h, pfit_w, pfit_h; 2108 + uint32_t pfit_size = intel_crtc->config.pch_pfit.size; 2109 2109 2110 2110 pipe_w = intel_crtc->config.requested_mode.hdisplay; 2111 2111 pipe_h = intel_crtc->config.requested_mode.vdisplay;