intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/3] drm/i915: Move the tracking of dpms_mode down into crtc enable/disable
Date: Thu, 21 Apr 2011 09:45:08 +0100	[thread overview]
Message-ID: <1303375508-9425-4-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1303375508-9425-1-git-send-email-chris@chris-wilson.co.uk>

As we failed to update the dpms_mode after modeset, where it is presumed
to have been changed to DRM_MODE_DPMS_ON by the upper layers the dpms state
on the crtc became inconsistent with its actual active state. This
notably confused code and left the pipe active when it was meant to be
disabled, leading to PGTBL_ER if the fb was subsequently moved.

As we use the dpms_mode state for restoring the crtc after load-detection,
we can not simply remove it in favour of simply using the active state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 78c38e2..e7822a6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2904,6 +2904,8 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 	intel_crtc_load_lut(crtc);
 	intel_update_fbc(dev);
 	intel_crtc_update_cursor(crtc, true);
+
+	intel_crtc->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static void ironlake_crtc_disable(struct drm_crtc *crtc)
@@ -3000,6 +3002,8 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 	intel_update_watermarks(dev);
 	intel_update_fbc(dev);
 	intel_clear_scanline_wait(dev);
+
+	intel_crtc->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
 static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
@@ -3052,6 +3056,9 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
 
+	DRM_DEBUG_KMS("[CRTC:%d] active: %d\n",
+		      crtc->base.id, intel_crtc->active);
+
 	if (intel_crtc->active)
 		return;
 
@@ -3068,6 +3075,8 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 	/* Give the overlay scaler a chance to enable if it's on this pipe */
 	intel_crtc_dpms_overlay(intel_crtc, true);
 	intel_crtc_update_cursor(crtc, true);
+
+	intel_crtc->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static void i9xx_crtc_disable(struct drm_crtc *crtc)
@@ -3078,6 +3087,9 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
 
+	DRM_DEBUG_KMS("[CRTC:%d] active: %d\n",
+		      crtc->base.id, intel_crtc->active);
+
 	if (!intel_crtc->active)
 		return;
 
@@ -3099,6 +3111,8 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	intel_update_fbc(dev);
 	intel_update_watermarks(dev);
 	intel_clear_scanline_wait(dev);
+
+	intel_crtc->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
 static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
@@ -3130,11 +3144,13 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
 	int pipe = intel_crtc->pipe;
 	bool enabled;
 
+	DRM_DEBUG_KMS("[CRTC:%d] current dpms %d, new %d\n",
+		      crtc->base.id,
+		      intel_crtc->dpms_mode, mode);
+
 	if (intel_crtc->dpms_mode == mode)
 		return;
 
-	intel_crtc->dpms_mode = mode;
-
 	dev_priv->display.dpms(crtc, mode);
 
 	if (!dev->primary->master)
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-21  8:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20  9:22 Remove dead code from intel_get_load_detect_pipe Chris Wilson
2011-04-20  9:22 ` [PATCH 1/6] drm/i915: Simplify return value " Chris Wilson
2011-04-20 18:10   ` Keith Packard
2011-04-20 18:26     ` [PATCH 1/2] " Chris Wilson
2011-04-20 18:26       ` [PATCH 2/2] drm/i915: Propagate failure to set mode for load-detect pipe Chris Wilson
2011-04-20  9:22 ` [PATCH 2/6] drm/i915: Don't store temporary load-detect variables in the generic encoder Chris Wilson
2011-04-20 18:12   ` Keith Packard
2011-04-20  9:22 ` [PATCH 3/6] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe Chris Wilson
2011-04-20 18:12   ` Keith Packard
2011-04-20  9:22 ` [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc Chris Wilson
2011-04-20 18:23   ` Keith Packard
2011-04-20 19:38     ` Chris Wilson
2011-04-20 21:00       ` Keith Packard
2011-04-20  9:22 ` [PATCH 5/6] drm/i915: Remove dead code from intel_get_load_detect_pipe() Chris Wilson
2011-04-20 18:26   ` Keith Packard
2011-04-20  9:22 ` [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe Chris Wilson
2011-04-20 18:43   ` Keith Packard
2011-04-20 18:55     ` Chris Wilson
2011-04-20 21:03       ` Keith Packard
2011-04-20 21:43         ` [PATCH] " Chris Wilson
2011-04-21  8:45           ` When in doubt, use a temporary fb Chris Wilson
2011-04-21  8:45             ` [PATCH 1/3] drm/i915: Remove dead code from intel_release_load_detect_pipe() Chris Wilson
2011-04-21  8:45             ` [PATCH 2/3] drm/i915: Attach a fb to the load-detect pipe Chris Wilson
2011-04-21  8:45             ` Chris Wilson [this message]
2011-04-20 20:16     ` [PATCH] " Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303375508-9425-4-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).