From patchwork Tue May 16 00:33:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 9728235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F04A760380 for ; Tue, 16 May 2017 00:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DECAA289DF for ; Tue, 16 May 2017 00:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF328289E2; Tue, 16 May 2017 00:33:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 35CBC289DF for ; Tue, 16 May 2017 00:33:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC1EF899E9; Tue, 16 May 2017 00:33:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B3C8899E9 for ; Tue, 16 May 2017 00:33:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 81B4F260786 From: Gabriel Krisman Bertazi To: intel-gfx@lists.freedesktop.org Date: Mon, 15 May 2017 21:33:04 -0300 Message-Id: <20170516003304.32121-1-krisman@collabora.co.uk> X-Mailer: git-send-email 2.11.0 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] drm: i915: Preserve old FBC status if update with no new planes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP If the atomic commit doesn't include any new plane, there is no need to choose a new CRTC for FBC, and the intel_fbc_choose_crtc() will bail out early. Although, if the FBC setup failed beforehand for whatever reason, we don't bail early, but we change the no_fbc_reason to "no suitable CRTC for FBC", which simply hides the real reason why the FBC wasn't initialized. For that scenario, it is better that we simply keep the old message in-place to make debugging easier. A scenario where this happens is with the igt@kms_frontbuffer_tracking@fbc-suspend testcase when executed on a Haswell system with not enough stolen memory. When enabling the CRTC, the FBC setup will be correctly initialized to a specific CRTC, but won't be enabled, since there is not enough memory. The testcase will then enable CRC checking, which requires a quirk for Haswell, which issues a new atomic commit that doesn't update the planes. Since that update doesn't include any new planes (and the FBC wasn't enabled), intel_fbc_choose_crtc() will not find any suitable CRTC, but update the error message, hiding the lack of memory information, which is the actual cause of the initialization failure. As a result, this causes that test to fail on Haswell. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100020 Fixes: f7e9b004b8a3 ("drm/i915/fbc: inline intel_fbc_can_choose()") Reported-by: Dorota Czaplejewicz Signed-off-by: Gabriel Krisman Bertazi Cc: Paulo Zanoni --- drivers/gpu/drm/i915/intel_fbc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index ded2add18b26..0c99c9b731ee 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c @@ -1045,6 +1045,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, struct drm_plane *plane; struct drm_plane_state *plane_state; bool crtc_chosen = false; + bool new_planes = false; int i; mutex_lock(&fbc->lock); @@ -1066,6 +1067,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, to_intel_plane_state(plane_state); struct intel_crtc_state *intel_crtc_state; struct intel_crtc *crtc = to_intel_crtc(plane_state->crtc); + new_planes = true; if (!intel_plane_state->base.visible) continue; @@ -1084,7 +1086,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, break; } - if (!crtc_chosen) + if (new_planes && !crtc_chosen) fbc->no_fbc_reason = "no suitable CRTC for FBC"; out: