Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp175126lqo; Tue, 7 May 2024 16:43:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxBMw4k1PZzndMVK/Xi9VLRhgROOb57LTACvSZ9UQtN9LLD3WfLxdcI2fwkjMycQIPJuUXoAQJFawm8ayC6IMqgeVB0mEgtJ8cTvcnIQ== X-Google-Smtp-Source: AGHT+IGWCYYIN/APUGz7iUcaXXyatD8W7aSywTl0u7BHuKcTC7Ahddrx2G2gPk+WbES80e9nwH2N X-Received: by 2002:a17:906:3c0f:b0:a59:a532:ed5b with SMTP id a640c23a62f3a-a59fb9cf6e1mr48342766b.50.1715125382856; Tue, 07 May 2024 16:43:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715125382; cv=pass; d=google.com; s=arc-20160816; b=N2RSfG2vqylXs3UblTkqVVgZ/p9vTlNJiSYjJt/v/N69L66adZ/TOtDtBnlZ+clNbj i1x70Re65OaRN4UQBQPdI8jbjzwhofL1rjP0HH+NIHGN3f/DzU4eF6RLyrYj/iuAzKPP RImGNyNTuZdu2Q8SVlvf6trafPrFg89ntT6iuOO0i/NraaUBgkxIlfhAL4w93BxMv6LE 1edy2wga821/SJB0Y3aUMJ6KbIuKGKqLk9Z3Khmwbq/VH+ECL5H4zVldM48ntlrkRKmz cdlCH9pjmkyFqKbjliUpSEQDhb/ETFP40ovgaM+lYvfnzpLl7tE+ktspGQC2OVnkPho4 Ympg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4oJZe/2ZUo0gMDTBAKZc/cZAUpPta2yrJrAMbKEo48E=; fh=qu9PPqgg3VLrBz/yL/MV5jmTvGxZ8okPx7sCTV4TgwI=; b=CMEdMS8ORE39eVdmv0GuL8ofvBFASucEScU6zNIS0uw0bXq1Yvaq4Hi5d/yEUJvmdS Gbstm4GGEDre+cFwUd6lEGyQnIM9qxjus3a+DiAu5bQ9iWVu+3Dh4bry1KLFNFwF3bwE 8pJzlqsuP+B/xBTzZOk9eB5EieaqwIdoVnlRUgyms7bi1m3iYzNSQX8CcjJL2rN+6sIS t04RwIyEus6MXRG0hj+xy3YsRXym9qok99/xajkm6gT4KOwVkifZ8Wn7o/sshaFrUN/k DeyvvbT+9vCwOzyOPSlpwREkL9YVQTx2ZZmoszRAdmb1zgxfAbuohr/7abf2SMDvECES MFqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ljw5oF0b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v7-20020a170906380700b00a59a75518a8si4704554ejc.676.2024.05.07.16.43.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ljw5oF0b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7AA011F251CB for ; Tue, 7 May 2024 23:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B517170836; Tue, 7 May 2024 23:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ljw5oF0b" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7766E137935; Tue, 7 May 2024 23:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123509; cv=none; b=bLyG6VTzB2dyxEpGcMFWECpx8M+tnAKOc7hLl0cNaAJMQNrCA8XJTFyAXOY7P9M28TbmFCiwQEvdhic82UkwP17Cb7yr9tH//Zq9G/JPYSHgVD7r7t5RcxBJWW1/+CBg3smLXZ0NH6G3RdteoqkmeWxoZi3s/3yOW9ieB/nY6g0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123509; c=relaxed/simple; bh=VQPRs9iLz4D7n1G+GMh7JP1p2fCzmiocS/p2Lg0AXeA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p5/N4W0ZExjEI5g9tmZXVVGgzatVQmmVkMt06sugvEfaeBjXqSdDJnrwWo7ZAzgvja9Q31d7yRR1S+s6868KmhFAI1DPv7cA3pS9uwTFqJu8AWLr0dFwCVNN53YrHV046MYRoOhLxfDUSO6h1ldjm6x/P4tJ1mVpfVWalfb6jVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ljw5oF0b; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED27C2BBFC; Tue, 7 May 2024 23:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123509; bh=VQPRs9iLz4D7n1G+GMh7JP1p2fCzmiocS/p2Lg0AXeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljw5oF0brBQNbj+QIc0FPs9W3kpo/afUpCR7sdXT2EXI9suPrmNJ/QFIkaZj/0U2E plIAblLsBSlTXeo2wAXOMwhaz43heNuLYau0Hqn15yMvLmORMwTODykLn+4IZHfK3o 8eV4tav51+tvHMCEXpJkm6yg3XZgXqKKl4ofWWe0GpPCHsQrDLlL2B5CEnwGsxBDzX etdWSJPlw4jdUvQE8lbnQpLDdrffMjydchrheIYaNPUTLfRspDqk8KqeHqi+c7hgsw Mm224kqgnCmtQz2K0p/iwM65uYp5LBu6R3bx6zKb4+rWEvPuVfe04gfH+owvM2xT/H fTUP9DQDSNsuQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Leo Ma , Alvin Lee , Wayne Lin , Daniel Wheeler , Alex Deucher , Sasha Levin , harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, stylon.wang@amd.com, samson.tam@amd.com, relja.vojvodic@amd.com, etbitnun@amd.com, qingqing.zhuo@amd.com, charlene.liu@amd.com, wenjing.liu@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.6 33/43] drm/amd/display: Fix DC mode screen flickering on DCN321 Date: Tue, 7 May 2024 19:09:54 -0400 Message-ID: <20240507231033.393285-33-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507231033.393285-1-sashal@kernel.org> References: <20240507231033.393285-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.30 Content-Transfer-Encoding: 8bit From: Leo Ma [ Upstream commit ce649bd2d834db83ecc2756a362c9a1ec61658a5 ] [Why && How] Screen flickering saw on 4K@60 eDP with high refresh rate external monitor when booting up in DC mode. DC Mode Capping is disabled which caused wrong UCLK being used. Reviewed-by: Alvin Lee Acked-by: Wayne Lin Signed-off-by: Leo Ma Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c index e9345f6554dbc..2428a4763b85f 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c @@ -547,8 +547,12 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base, * since we calculate mode support based on softmax being the max UCLK * frequency. */ - dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, - dc->clk_mgr->bw_params->dc_mode_softmax_memclk); + if (dc->debug.disable_dc_mode_overwrite) { + dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); + dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); + } else + dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, + dc->clk_mgr->bw_params->dc_mode_softmax_memclk); } else { dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); } @@ -581,8 +585,13 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base, /* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ if (clk_mgr_base->clks.p_state_change_support && (update_uclk || !clk_mgr_base->clks.prev_p_state_change_support) && - !dc->work_arounds.clock_update_disable_mask.uclk) + !dc->work_arounds.clock_update_disable_mask.uclk) { + if (dc->clk_mgr->dc_mode_softmax_enabled && dc->debug.disable_dc_mode_overwrite) + dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, + max((int)dc->clk_mgr->bw_params->dc_mode_softmax_memclk, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz))); + dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz)); + } if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && clk_mgr_base->clks.num_ways > new_clocks->num_ways) { -- 2.43.0