Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp872629rwi; Wed, 19 Oct 2022 04:09:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77WLLoIPpjokbxzAWJOW87eEzOQNllQJMXdgZU4vZ9cjoHpTYTZVHR97bvQB16B7YumWPp X-Received: by 2002:a17:907:628f:b0:72f:57da:c33d with SMTP id nd15-20020a170907628f00b0072f57dac33dmr6186101ejc.374.1666177755940; Wed, 19 Oct 2022 04:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177755; cv=none; d=google.com; s=arc-20160816; b=WZhTmjdvUCssHUdMk6NWbj+YWTarJUdkM6MmDZ/Y1gPq6Na7bqyeRwoQLbxSJKn0AJ rkWndVvPLcQOjd3GDQRzFHl2iyvH5stzm7j0HVqXWkj5QmmfE/AyQ3GCk/LrVS/aqaOC 16eceIScwH2eZ5PtQk8KmomeEgDjI1YO4A9opD8CcGG/cUN4Wejyc7VynPO5WVprN6lR nfClLXEFMjvM0XYEHCxutcAfVbkhpclBhyV6kDsVIypigEQ/CIsn9JTAirqfN5IaKf87 RU3g5g4O+GHVa1Hk7KAHDNcKZ7WUhqCZ7JTikRyW0uITN8snMaYogLiFHXSaRdtq/Cxl HW9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wVhrsd56Mn6VVfl1x/P2AhX6gE6OPLCYYAB4T7NUiQU=; b=h3R6nAj1cShXqA9trf6U2OzbJ3qfTqJkBLOPgy4BDf211dApGAWZgg4Wk4qc+uqK17 5rqx09p8g+3Ax6ztr4/N9WaRMqQZGwxjbOLyIZK8MdPV7CSloz5iaYd8Tnn0b8wOgOkV ZyWpEV/2NmzkCBb03sNcHeS6SPg3PIgcmBfrxFzNH0/oALaC30CtJNAolZ0gg3h2EBq8 MqHk0f8D6t3pDynzNnShX2t74cba7g/9s2+6NAu0KstsJVmQ+XIopYLlXKn66NFdNlLq ZgexSl5dMlWoqeGramhr2khLlxS6OCuJ/i7tnP2A1AF9wGhb21103mmws5+DY8vQdQcX 6SKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wsKPwc9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a1709066bd400b00783698dd8b4si12219641ejs.722.2022.10.19.04.08.46; Wed, 19 Oct 2022 04:09:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wsKPwc9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234380AbiJSKui (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:38 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 needed. 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 = -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 } } +#if defined(CONFIG_DRM_AMD_DC_DCN) + if (dc_resource_is_dsc_encoding_supported(dc)) { + if (!pre_validate_dsc(state, &dm_state, vars)) { + ret = -EINVAL; + goto fail; + } + } +#endif + /* Run this here since we want to validate the streams we created */ ret = drm_atomic_helper_check_planes(dev, state); if (ret) {