From patchwork Thu Apr 21 08:45:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 724211 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3L8l19b008862 for ; Thu, 21 Apr 2011 08:47:21 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83B7E9F019 for ; Thu, 21 Apr 2011 01:47:01 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (server109-228-6-236.live-servers.net [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 999989E971 for ; Thu, 21 Apr 2011 01:45:21 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.66.37; Received: from arrandale.alporthouse.com (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 32682187-1500050 for multiple; Thu, 21 Apr 2011 09:45:10 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 21 Apr 2011 09:45:08 +0100 Message-Id: <1303375508-9425-4-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1303375508-9425-1-git-send-email-chris@chris-wilson.co.uk> References: <1303335829-21455-1-git-send-email-chris@chris-wilson.co.uk> <1303375508-9425-1-git-send-email-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.66.37 Subject: [Intel-gfx] [PATCH 3/3] drm/i915: Move the tracking of dpms_mode down into crtc enable/disable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Apr 2011 08:47:21 +0000 (UTC) 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 --- 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)