From patchwork Wed Sep 18 20:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11151245 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6BD076 for ; Wed, 18 Sep 2019 20:28:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DD7D21920 for ; Wed, 18 Sep 2019 20:28:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DD7D21920 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C68AE72AED; Wed, 18 Sep 2019 20:27:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790075.outbound.protection.outlook.com [40.107.79.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1457E72AF0; Wed, 18 Sep 2019 20:27:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asa2SGZeycI+ofGG2pJWkPpEzE6aiYI3Bx3B7VeOGhL38yG6mVruiYftv6JKq8Ybxp6OsK8Cmi1hns0FId2M4apCpV68Qf9ldSXEDZAkuhLIpaqjcIq6IST38mOeFXn+DBUd2rGcHYX+YCCmU1oYpcUIUFLnJK8UpcoiI5uXddoUqccgDIWAUuP3cM5Yzr2G9deKompvhHk/noisyGsrPFdHLvSBYJ3ILQY73EEAeAAsCNhT003m80g1eXil3b0i/Po0w+6LBYJulMYBEt1THM2G4WJSn89XAMpIjt9TBgawICnwvQ7OP3ohVDEXMdSO3o/2Iy9qvtqbT5YN6+1k3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NUfZgIwD1rePH/tVdrGcC1P2b9Ue3WC2kRCiLT12iUY=; b=HVk69+/CofBcvFNT5VBxb97upqeztcCNz9JXr8kFl2w+NHeQfzzOcq+rqDfnCQqJvQTa+5Vn3wB82F9ooqLwZu4DVuAR81BWfgFHI4bIVZ8oFZQVsha4kBRLtnsj+jfFvLr7qdWKP1NV5/y9oimQ7hdu9DMuV2VEvGtQSPMcRBC4L21b3mC1+XcmmeOx4RhlHdvoIU6bpwu1reyKJdt1XYf+ApBQ7kxxcVmE2XZiiXXNEG4+Us/5xjb/HtitG12Dqung66OMAbXPvqfyPRQgGcKtJMscHSLly+MPmilOqR9O9dyEa4Xzj4L6RSzyxpKssSpTvgG5Ju5P3ULin+atbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from MWHPR1201CA0006.namprd12.prod.outlook.com (2603:10b6:301:4a::16) by MN2PR12MB3631.namprd12.prod.outlook.com (2603:10b6:208:c2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Wed, 18 Sep 2019 20:27:38 +0000 Received: from DM3NAM03FT053.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::207) by MWHPR1201CA0006.outlook.office365.com (2603:10b6:301:4a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2284.20 via Frontend Transport; Wed, 18 Sep 2019 20:27:38 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT053.mail.protection.outlook.com (10.152.83.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.14 via Frontend Transport; Wed, 18 Sep 2019 20:27:37 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 18 Sep 2019 15:27:37 -0500 From: To: Subject: [PATCH 15/15] drm/amd/display: Trigger modesets on MST DSC connectors Date: Wed, 18 Sep 2019 16:26:52 -0400 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(396003)(346002)(136003)(376002)(428003)(199004)(189003)(76176011)(2351001)(478600001)(70586007)(54906003)(26005)(186003)(7696005)(16586007)(51416003)(8676002)(81166006)(70206006)(50226002)(4326008)(81156014)(47776003)(316002)(118296001)(14444005)(53416004)(5024004)(126002)(8936002)(36756003)(6916009)(2616005)(48376002)(305945005)(50466002)(6666004)(2906002)(476003)(336012)(86362001)(356004)(486006)(426003)(2876002)(446003)(11346002)(5660300002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3631; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa1beeda-044a-40c8-adc3-08d73c76a585 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328); SRVR:MN2PR12MB3631; X-MS-TrafficTypeDiagnostic: MN2PR12MB3631: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 01644DCF4A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: IoVgZT9tmJFrQfOqrUWBCtQsywwbfUQ12TttxcMhf+b/5FmZ1znL+g1VxyhO9Xl2ziturqRyq66wLDx4S++Z/rAP3VtEw7DqnAvZC840ORv6aw160oEDoI4jBE8aP8dAErPanyb4unqakHQ4+6ENm3fgpfw77yimO111i0m0ye0A6tTL7iqLPmgaC7ueOF22xVIAg9BM0F1DFJ/u7rRglFZVTzNUXjuohLFOvmtUL+ozTxI5ZWQMM8H2+qBg6Nzpa26jKmBnwtRZ9myKQZWaK/vaQI0zbyTbCSSPFeXhPZx7qQRg03EzNJFFe4aJx7DGOieq7OyTmRVqYp9I9QcjRKMnnxinx5L8z8ENX4fSHIb8wqweJiRJv8PaFxTUEcQj2fCfBhqaWMYKDmapyBo/QKBEM4EdQYFNgr0y5byHkzg= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2019 20:27:37.6052 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa1beeda-044a-40c8-adc3-08d73c76a585 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3631 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NUfZgIwD1rePH/tVdrGcC1P2b9Ue3WC2kRCiLT12iUY=; b=a80rVA7/oyOB6NK9ui/lq88ZKPf+oint7uayiyv4IYnHlOAvCgOLQMcMVcDt1Ypvi9EhNu8YhPwVbeF4XKQDGJ1uvsYJZl3pGHsEj6W/FvUVcRhIkS0DWT2D7hpobkDJQEui5kiW6fR9Im6BCFa1nfN6bRHygCoQvOPeyJqKbvM= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=permerror action=none header.from=amd.com; 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: Leo Li , David Francis , Nicholas Kazlauskas , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis Whenever a connector on an MST network is attached, detached, or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing. Therefore, whenever a crtc has drm_atomic_crtc_needs_modeset, for each crtc that shares a MST topology with that stream and supports DSC, add that crtc (and all affected connectors and planes) to the atomic state and set mode_changed on its state v2: Do this check only on Navi and before adding connectors and planes on modesetting crtcs Cc: Leo Li Cc: Nicholas Kazlauskas Cc: Lyude Paul Signed-off-by: David Francis --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index ba017e6bf0b4..f65326e85b86 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6704,6 +6704,74 @@ static int do_aquire_global_lock(struct drm_device *dev, return ret < 0 ? ret : 0; } +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +/* + * TODO: This logic should at some point be moved into DRM + */ +static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm_crtc *crtc) +{ + struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct drm_connector_list_iter conn_iter; + struct drm_crtc_state *new_crtc_state; + struct amdgpu_dm_connector *aconnector = NULL, *aconnector_to_add; + int i, j; + struct drm_crtc *crtcs_affected[AMDGPU_MAX_CRTCS] = { 0 }; + + for_each_new_connector_in_state(state, connector, conn_state, i) { + if (conn_state->crtc != crtc) + continue; + + aconnector = to_amdgpu_dm_connector(connector); + if (!aconnector->port) + aconnector = NULL; + else + break; + } + + if (!aconnector) + return 0; + + i = 0; + drm_connector_list_iter_begin(state->dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (!connector->state || !connector->state->crtc) + continue; + + aconnector_to_add = to_amdgpu_dm_connector(connector); + if (!aconnector_to_add->port) + continue; + + if (aconnector_to_add->port->mgr != aconnector->port->mgr) + continue; + + if (!aconnector_to_add->dc_sink) + continue; + + if (!aconnector_to_add->dc_sink->sink_dsc_caps.dsc_dec_caps.is_dsc_supported) + continue; + + if (i >= AMDGPU_MAX_CRTCS) + continue; + + crtcs_affected[i] = connector->state->crtc; + i++; + } + drm_connector_list_iter_end(&conn_iter); + + for (j = 0; j < i; j++) { + new_crtc_state = drm_atomic_get_crtc_state(state, crtcs_affected[j]); + if (IS_ERR(new_crtc_state)) + return PTR_ERR(new_crtc_state); + + new_crtc_state->mode_changed = true; + } + + return 0; + +} +#endif + static void get_freesync_config_for_crtc( struct dm_crtc_state *new_crtc_state, struct dm_connector_state *new_con_state) @@ -7388,6 +7456,17 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + if (adev->asic_type >= CHIP_NAVI10) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) { + ret = add_affected_mst_dsc_crtcs(state, crtc); + if (ret) + goto fail; + } + } + } +#endif for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed &&