From patchwork Sat Sep 8 16:14:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1426961 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id B38EADF2AB for ; Sat, 8 Sep 2012 17:22:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D8649EFE4 for ; Sat, 8 Sep 2012 10:22:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by gabe.freedesktop.org (Postfix) with ESMTP id C6E3E9E9D5 for ; Sat, 8 Sep 2012 10:22:17 -0700 (PDT) Received: by wibhm2 with SMTP id hm2so467496wib.0 for ; Sat, 08 Sep 2012 10:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=lLYfvalhS8u2/2s+vzekh4jSePALv5YA18bi9TRMgT0=; b=DTa05KN3/34nCK41DCK8M8Opj0eLglhCbyWfSnn1WCDnHnGpePMhXfUK+IJb2paneg q9uD0Ufx9onViiTgX2bzRYNvsDw48RXnOIxqS9k/RLFvzamedeWNcE/WCHeQq8gkd3gY iDuQb0ibyFx017tOJFe8gMGiHnbKzYJwd4Ikg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=lLYfvalhS8u2/2s+vzekh4jSePALv5YA18bi9TRMgT0=; b=Xr86gXqx8RgKTqAHf18rUPYbUrr+ngC/firb+ZiR90SLj0zMNI+jXp9G74VvjiQo22 44WIKYeH7DJ0PPoEqlDG06i2QMiQifxZXJyM8p2/HiTYIKUtoRQlTTOWPIXK4s3DbXiX 08+QiViptR1wIwhRQcDmpyeSxbnJyb8x/TfXFYqRiGuITIAFuNC+r4f8dKFf3DpSJtvL KwA6FU5voK+p1HFYDQYktSo+ZXsOo9qOKpo8H6ZrAtjoLgxPDtyVWZYpSVEXBOTk4arQ bb0+/EcgeL7iNSLL48eszkaosoyqcHsFRKP8JFtL0FPiJXx8p999ICEFs4z60zhv34x8 votQ== Received: by 10.216.233.95 with SMTP id o73mr5364255weq.59.1347124936291; Sat, 08 Sep 2012 10:22:16 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id do5sm8990094wib.10.2012.09.08.10.22.14 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 08 Sep 2012 10:22:15 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sat, 8 Sep 2012 18:14:52 +0200 Message-Id: <1347120892-1063-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <275ffc$6gs6ns@fmsmga002.fm.intel.com> References: <275ffc$6gs6ns@fmsmga002.fm.intel.com> X-Gm-Message-State: ALoCoQk2cloR4e52uX7m9qST7yAcui2y6NU5PlixUi8UHePLubYNItoNZ4fvpeGnFGi5AvInKBjq Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH] drm/i915: fixup the plane->pipe fixup code X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 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 We need to check whether the _other plane is on our pipe, not whether our plane is on the other pipe. Otherwise if not both pipes/planes are active, we won't properly clean up the mess and set up our desired plane->pipe mapping. v2: Fixup the logic, I've totally fumbled it. Noticed by Chris Wilson. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51265 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49838 Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index fd9c275..46f4598 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7994,11 +7994,27 @@ static void intel_enable_pipe_a(struct drm_device *dev) } +static bool +intel_check_plane_mapping(struct intel_crtc *crtc) +{ + struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; + u32 reg, val; + + reg = DSPCNTR(!crtc->plane); + val = I915_READ(reg); + + if ((val & DISPLAY_PLANE_ENABLE) && + (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe)) + return false; + + return true; +} + static void intel_sanitize_crtc(struct intel_crtc *crtc) { struct drm_device *dev = crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - u32 reg, val; + u32 reg; /* Clear any frame start delays used for debugging left by the BIOS */ reg = PIPECONF(crtc->pipe); @@ -8006,17 +8022,10 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) /* We need to sanitize the plane -> pipe mapping first because this will * disable the crtc (and hence change the state) if it is wrong. */ - if (!HAS_PCH_SPLIT(dev)) { + if (!HAS_PCH_SPLIT(dev) && !intel_check_plane_mapping(crtc)) { struct intel_connector *connector; bool plane; - reg = DSPCNTR(crtc->plane); - val = I915_READ(reg); - - if ((val & DISPLAY_PLANE_ENABLE) == 0 && - (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe)) - goto ok; - DRM_DEBUG_KMS("[CRTC:%d] wrong plane connection detected!\n", crtc->base.base.id); @@ -8040,7 +8049,6 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) WARN_ON(crtc->active); crtc->base.enabled = false; } -ok: if (dev_priv->quirks & QUIRK_PIPEA_FORCE && crtc->pipe == PIPE_A && !crtc->active) {