aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-04-30 10:43:01 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-05-05 04:56:54 -0400
commit98ec77397a5c68ce753dc283aaa6f4742328bcdd (patch)
treebf4219f499c896f31bd290be9f5398363cf52890 /drivers/gpu/drm/i915/intel_display.c
parent024a43e12cccd13b7336fc71ab2067a19ade1857 (diff)
drm/i915: Make primary_enabled match the actual hardware state
The BIOS can enable a pipe but leave the primary plane disabled. This coflicts with out current idea of primary_enabled. Read the actual hardware plane state and set primary_enabled appropriately. We currently assume that primary_enabled is always true when we're about to disable a crtc. That needs to change now as the plane may not be enabled. So replace the relevant WARNs with early returns in intel_{enable,disable}_primary_hw_plane(). Fixes the following warning [ 3.831602] WARNING: CPU: 0 PID: 1112 at linux/drivers/gpu/drm/i915/intel_display.c:1918 intel_disable_primary_hw_plane+0xe4/0xf0 [i915]() which got introduced here by me: commit e9e39655c0c30cddc3f8c09a757678a24dd36737 Author: Ville Syrjälä <ville.syrjala@linux.intel.com> Date: Mon Apr 28 15:53:25 2014 +0300 drm/i915: Remove useless checks from primary enable/disable Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 47b4b85e95d2..4dbbda2970d4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1880,7 +1880,8 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
1880 /* If the pipe isn't enabled, we can't pump pixels and may hang */ 1880 /* If the pipe isn't enabled, we can't pump pixels and may hang */
1881 assert_pipe_enabled(dev_priv, pipe); 1881 assert_pipe_enabled(dev_priv, pipe);
1882 1882
1883 WARN(intel_crtc->primary_enabled, "Primary plane already enabled\n"); 1883 if (intel_crtc->primary_enabled)
1884 return;
1884 1885
1885 intel_crtc->primary_enabled = true; 1886 intel_crtc->primary_enabled = true;
1886 1887
@@ -1910,7 +1911,8 @@ static void intel_disable_primary_hw_plane(struct drm_i915_private *dev_priv,
1910 int reg; 1911 int reg;
1911 u32 val; 1912 u32 val;
1912 1913
1913 WARN(!intel_crtc->primary_enabled, "Primary plane already disabled\n"); 1914 if (!intel_crtc->primary_enabled)
1915 return;
1914 1916
1915 intel_crtc->primary_enabled = false; 1917 intel_crtc->primary_enabled = false;
1916 1918
@@ -11579,6 +11581,16 @@ void i915_redisable_vga(struct drm_device *dev)
11579 i915_redisable_vga_power_on(dev); 11581 i915_redisable_vga_power_on(dev);
11580} 11582}
11581 11583
11584static bool primary_get_hw_state(struct intel_crtc *crtc)
11585{
11586 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
11587
11588 if (!crtc->active)
11589 return false;
11590
11591 return I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE;
11592}
11593
11582static void intel_modeset_readout_hw_state(struct drm_device *dev) 11594static void intel_modeset_readout_hw_state(struct drm_device *dev)
11583{ 11595{
11584 struct drm_i915_private *dev_priv = dev->dev_private; 11596 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -11598,7 +11610,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
11598 &crtc->config); 11610 &crtc->config);
11599 11611
11600 crtc->base.enabled = crtc->active; 11612 crtc->base.enabled = crtc->active;
11601 crtc->primary_enabled = crtc->active; 11613 crtc->primary_enabled = primary_get_hw_state(crtc);
11602 11614
11603 DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n", 11615 DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
11604 crtc->base.base.id, 11616 crtc->base.base.id,