From patchwork Tue Nov 13 14:27:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Lisovskiy X-Patchwork-Id: 10680813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3279714BA for ; Tue, 13 Nov 2018 14:27:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FA262AAB7 for ; Tue, 13 Nov 2018 14:27:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D5C2AABA; Tue, 13 Nov 2018 14:27:35 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 B3AAE2AAB7 for ; Tue, 13 Nov 2018 14:27:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8CFB6E2AD; Tue, 13 Nov 2018 14:27:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A62B6E2AD; Tue, 13 Nov 2018 14:27:31 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 06:27:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,499,1534834800"; d="scan'208";a="103999307" Received: from slisovsk-lenovo-ideapad-720s-13ikb.fi.intel.com ([10.237.72.122]) by fmsmga002.fm.intel.com with ESMTP; 13 Nov 2018 06:27:28 -0800 From: Stanislav Lisovskiy To: intel-gfx@lists.freedesktop.org Date: Tue, 13 Nov 2018 16:27:28 +0200 Message-Id: <20181113142728.9243-1-stanislav.lisovskiy@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH v1] Fix the possible watermark miswriting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ville.syrjala@intel.com, martin.peres@intel.com, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Currently whenever we attempt to recalculate watermarks, we assign dirty_pipes to zero, then compare current wm results to the recalculated one and if they changed we set correspondent dirty_pipes bit again. This can lead to situation, when we same clearing dirty_pipes, same wm results twice and not setting dirty_pipes => so that watermarks are not actually updated, which then might lead to fifo underruns, crc mismatch and other issues. Instead, whenever we detect that wm results are changed, need to set correspondent dirty_pipes bit and clear it only once the change is written, but not clear it everytime we attempt to recalculate those in skl_compute_wm. Signed-off-by: Stanislav Lisovskiy --- drivers/gpu/drm/i915/intel_pm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index dc034617febb..f7fbc4bc0d43 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5441,9 +5441,6 @@ skl_compute_wm(struct drm_atomic_state *state) bool changed = false; int ret, i; - /* Clear all dirty flags */ - results->dirty_pipes = 0; - ret = skl_ddb_add_affected_pipes(state, &changed); if (ret || !changed) return ret; @@ -5496,6 +5493,7 @@ static void skl_atomic_update_crtc_wm(struct intel_atomic_state *state, struct drm_i915_private *dev_priv = to_i915(state->base.dev); struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal; const struct skl_ddb_allocation *ddb = &state->wm_results.ddb; + struct skl_ddb_values *results = &state->wm_results; enum pipe pipe = crtc->pipe; enum plane_id plane_id; @@ -5512,6 +5510,10 @@ static void skl_atomic_update_crtc_wm(struct intel_atomic_state *state, skl_write_cursor_wm(crtc, &pipe_wm->planes[plane_id], ddb); } + + /* Clear correspondent dirty bit */ + results->dirty_pipes &= ~drm_crtc_mask(&crtc->base); + } static void skl_initial_wm(struct intel_atomic_state *state,