Commit 98ec7739 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 024a43e1
...@@ -1880,7 +1880,8 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, ...@@ -1880,7 +1880,8 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
/* If the pipe isn't enabled, we can't pump pixels and may hang */ /* If the pipe isn't enabled, we can't pump pixels and may hang */
assert_pipe_enabled(dev_priv, pipe); assert_pipe_enabled(dev_priv, pipe);
WARN(intel_crtc->primary_enabled, "Primary plane already enabled\n"); if (intel_crtc->primary_enabled)
return;
intel_crtc->primary_enabled = true; intel_crtc->primary_enabled = true;
...@@ -1910,7 +1911,8 @@ static void intel_disable_primary_hw_plane(struct drm_i915_private *dev_priv, ...@@ -1910,7 +1911,8 @@ static void intel_disable_primary_hw_plane(struct drm_i915_private *dev_priv,
int reg; int reg;
u32 val; u32 val;
WARN(!intel_crtc->primary_enabled, "Primary plane already disabled\n"); if (!intel_crtc->primary_enabled)
return;
intel_crtc->primary_enabled = false; intel_crtc->primary_enabled = false;
...@@ -11579,6 +11581,16 @@ void i915_redisable_vga(struct drm_device *dev) ...@@ -11579,6 +11581,16 @@ void i915_redisable_vga(struct drm_device *dev)
i915_redisable_vga_power_on(dev); i915_redisable_vga_power_on(dev);
} }
static bool primary_get_hw_state(struct intel_crtc *crtc)
{
struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
if (!crtc->active)
return false;
return I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE;
}
static void intel_modeset_readout_hw_state(struct drm_device *dev) static void intel_modeset_readout_hw_state(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; 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,7 +11610,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
&crtc->config); &crtc->config);
crtc->base.enabled = crtc->active; crtc->base.enabled = crtc->active;
crtc->primary_enabled = crtc->active; crtc->primary_enabled = primary_get_hw_state(crtc);
DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n", DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
crtc->base.base.id, crtc->base.base.id,
......
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