From patchwork Wed Jul 16 20:06:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4570271 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 585229F26C for ; Wed, 16 Jul 2014 20:06:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F28E201BA for ; Wed, 16 Jul 2014 20:06:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5FE90201B9 for ; Wed, 16 Jul 2014 20:06:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6299E6E632; Wed, 16 Jul 2014 13:06:56 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 65BCA6E632 for ; Wed, 16 Jul 2014 13:06:55 -0700 (PDT) Received: by mail-vc0-f179.google.com with SMTP id hq11so1216510vcb.10 for ; Wed, 16 Jul 2014 13:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cr8iyIMBKDk08rkfZ8K8DmMIduR6qMwcbVwV3QDbc8s=; b=G/8u/EJzunvsVfI5mhEKEFP0nv/knfOqg5fkFFlYiNm58CK8M+f53I1sbpyuUoHMXT t8igLXXFOimCAfIOGFxhvCk4tuXu4VhXDF/wNNTjqUNgRUeaYrrtjrdhVjutVjYFrRMP 5mibpNXmWjS6Rc1wS7RWa+YD/rSkw6T3cqFTaQ2FW0yJO05ch0QZoz/S7wHbGUF7vmG3 wN0vlfx8E9NQNNDDU6iSXcvc0L6oWXSlxq5S3LoacNuWFCvKa+gS0KkFsr8MnxyMK1Ic 3I7GJePGb4JQL0b5uumqYFUyYTmXrKcXkbSpOwp3UjHdaP+4zCUspBtKfY/o5JedH3vP 4GBA== X-Received: by 10.220.30.69 with SMTP id t5mr32988740vcc.6.1405541214852; Wed, 16 Jul 2014 13:06:54 -0700 (PDT) Received: from localhost.localdomain ([177.132.8.34]) by mx.google.com with ESMTPSA id m10sm567834vdj.28.2014.07.16.13.06.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Jul 2014 13:06:54 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Wed, 16 Jul 2014 17:06:34 -0300 Message-Id: <1405541195-3642-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.0 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] drm/i915: check the power wells on assert_{cursor, plane} X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni Since we merged runtime PM support for DPMS, it is possible that these functions will be called when the power wells are disabled but a mode is "set", resulting in "failed assertion" and "device suspended while reading register" WARNs. To reproduce the bug: disable all screens using mode unset, do a modeset on one screen, disable it using DPMS, then try to do a mode unset on it again to see the WARNs. Testcase: igt/rpm_rpm/dpms-mode-unset-lpsp Testcase: igt/rpm_rpm/dpms-mode-unset-non-lpsp Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 54e3af9..7ad46e2 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1216,7 +1216,9 @@ static void assert_cursor(struct drm_i915_private *dev_priv, struct drm_device *dev = dev_priv->dev; bool cur_state; - if (IS_845G(dev) || IS_I865G(dev)) + if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PIPE(pipe))) + cur_state = false; + else if (IS_845G(dev) || IS_I865G(dev)) cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE; else cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; @@ -1262,9 +1264,13 @@ static void assert_plane(struct drm_i915_private *dev_priv, u32 val; bool cur_state; - reg = DSPCNTR(plane); - val = I915_READ(reg); - cur_state = !!(val & DISPLAY_PLANE_ENABLE); + if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PIPE(plane))) { + cur_state = false; + } else { + reg = DSPCNTR(plane); + val = I915_READ(reg); + cur_state = !!(val & DISPLAY_PLANE_ENABLE); + } WARN(cur_state != state, "plane %c assertion failure (expected %s, current %s)\n", plane_name(plane), state_string(state), state_string(cur_state));