From nobody Fri Oct 17 10:32:15 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD4F9C433FE for ; Wed, 19 Oct 2022 10:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234388AbiJSKuj (ORCPT ); Wed, 19 Oct 2022 06:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbiJSKrx (ORCPT ); Wed, 19 Oct 2022 06:47:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1217B15B130; Wed, 19 Oct 2022 03:21:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0DC3B822E9; Wed, 19 Oct 2022 08:48:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 411C9C433B5; Wed, 19 Oct 2022 08:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169283; bh=fTvT0ik4f6kDJvAqramL4MzipGYW+zF36KCJGMNC4nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsKPwc9T7iBvam+l4ol+dV3okT9chMEqDL4F0xhdU29U+Q4rvsf4U1Pruh6AwhRou h7P+Akde1nMwzYGdygBho9lYXsdGPpOALeyGrcwaaPMlDSq2Gz/41BrihJSSOL4sz8 d2FvAnC1eKAB68sRWCab1QeJy8LxVk+7byN24aeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Roman Li , Qingqing Zhuo , Fangzhi Zuo , Mark Broadworth , Alex Deucher Subject: [PATCH 6.0 193/862] drm/amd/display: Validate DSC After Enable All New CRTCs Date: Wed, 19 Oct 2022 10:24:40 +0200 Message-Id: <20221019083258.514244822@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fangzhi Zuo commit 876fcc4222e1d0e5b73343f4010a8b66be058f48 upstream. Before enabling new crtc, stream_count in dc_state does not sync with that in drm_atomic_state. Validating dsc in such case would leave newly added stream not jointly participating in dsc optimization with existing streams, but simply using default initialized vcpi all the time which gives wrong dsc determination decision. Consider the scenaio where one 4k60 connected to the dock under dp-alt mode. Since dp-alt mode is 2-lane setup, stream 1 consumes 63 slots with dsc need= ed. Then hook up a second 4k60 to the dock. stream 2 connected with 65 slot initialized by default without dsc. dsc pre validate will not jointly optimize stream 2 with stream 1 before crtc 2 added into the dc_state. That leads to stream 2 not getting dsc optimization, and trigger atomic_check failure all the time, as 65 > 63 limit. After getting all new crtcs added into the state, stream_count in dc_state correctly reflect that in drm_atomic_state which comes up with correct dsc decision. Fixes: 71be4b16d39a ("drm/amd/display: dsc validate fail not pass to atomic= check") Tested-by: Daniel Wheeler Reviewed-by: Roman Li Acked-by: Qingqing Zhuo Signed-off-by: Fangzhi Zuo Tested-by: Mark Broadworth Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9408,10 +9408,6 @@ static int amdgpu_dm_atomic_check(struct } } } - if (!pre_validate_dsc(state, &dm_state, vars)) { - ret =3D -EINVAL; - goto fail; - } } #endif for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state= , i) { @@ -9545,6 +9541,15 @@ static int amdgpu_dm_atomic_check(struct } } =20 +#if defined(CONFIG_DRM_AMD_DC_DCN) + if (dc_resource_is_dsc_encoding_supported(dc)) { + if (!pre_validate_dsc(state, &dm_state, vars)) { + ret =3D -EINVAL; + goto fail; + } + } +#endif + /* Run this here since we want to validate the streams we created */ ret =3D drm_atomic_helper_check_planes(dev, state); if (ret) {