From patchwork Tue Nov 13 14:31:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Lisovskiy X-Patchwork-Id: 10680819 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 7357013B5 for ; Tue, 13 Nov 2018 14:31:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63C462AACA for ; Tue, 13 Nov 2018 14:31:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 586EA2AAE0; Tue, 13 Nov 2018 14:31:45 +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=unavailable 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 12D392AADA for ; Tue, 13 Nov 2018 14:31:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C376589E50; Tue, 13 Nov 2018 14:31:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF81589A74; Tue, 13 Nov 2018 14:31:41 +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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 06:31:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,499,1534834800"; d="scan'208";a="104000361" 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:31:39 -0800 From: Stanislav Lisovskiy To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2] Fix the possible watermark miswriting for skl+ Date: Tue, 13 Nov 2018 16:31:38 +0200 Message-Id: <20181113143138.9536-1-stanislav.lisovskiy@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - 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, stanislav.lisovskiy@intel.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 are clearing dirty_pipes, same wm results twice in a row 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. v2: Fixed commit message 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,