[Intel-gfx] [PATCH 29/76] drm/i915: WARN when trying to enabled an unused crtc
Daniel Vetter
daniel.vetter at ffwll.ch
Thu Jul 26 20:48:54 CEST 2012
This is the first tiny step towards cross-checking the entire modeset
state machine with WARNs. A crtc can only be enabled when it's
actually in use, i.e. crtc->active imlies crtc->enabled.
Unfortunately we can't (yet) check this when disabling the crtc,
because the crtc helpers are a bit slopy with updating state and
unconditionally update crtc->enabled before changing the hw state.
Fixing that requires quite some more work.
Signed-Off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
drivers/gpu/drm/i915/intel_display.c | 4 ++++
drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 177795a..428e0ed 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3214,6 +3214,8 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
u32 temp;
bool is_pch_port;
+ WARN_ON(!crtc->enabled);
+
/* XXX: For compatability with the crtc helper code, call the encoder's
* enable function unconditionally for now. */
if (intel_crtc->active)
@@ -3390,6 +3392,8 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
int pipe = intel_crtc->pipe;
int plane = intel_crtc->plane;
+ WARN_ON(!crtc->enabled);
+
/* XXX: For compatability with the crtc helper code, call the encoder's
* enable function unconditionally for now. */
if (intel_crtc->active)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4145a1d..0f2a42e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -157,7 +157,15 @@ struct intel_crtc {
enum plane plane;
u8 lut_r[256], lut_g[256], lut_b[256];
int dpms_mode;
- bool active; /* is the crtc on? independent of the dpms mode */
+ /*
+ * Whether the crtc and the connected output pipeline is active. Implies
+ * that crtc->enabled is set, i.e. the current mode configuration has
+ * some outputs connected to this crtc.
+ *
+ * Atm crtc->enabled is unconditionally updated _before_ the hw state is
+ * changed, hence we can only check this when enabling the crtc.
+ */
+ bool active;
bool primary_disabled; /* is the crtc obscured by a plane? */
bool lowfreq_avail;
struct intel_overlay *overlay;
--
1.7.10.4
More information about the Intel-gfx
mailing list