From patchwork Thu Nov 7 15:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233223 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 97EE716B1 for ; Thu, 7 Nov 2019 15:32:59 +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 7FDF3214D8 for ; Thu, 7 Nov 2019 15:32:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FDF3214D8 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 77D056F717; Thu, 7 Nov 2019 15:32:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760055.outbound.protection.outlook.com [40.107.76.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E6A86F70D; Thu, 7 Nov 2019 15:32:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ap/IlPcjjFjpr5VF5j26dgTIJl9gwnF9gFx0M+Y9aHY3yaF9Mu64Z0z92h/7gTKWxpd+uA2x+zRtpkDs6sbjgJI8z+Z8prSDa9a6MLuNi6Kx0zUnmnYj46ugeAq8jK3nzEMBcjDmmw654z3OAJbrm+LEbABMB8NH5OdC+C/kcryYHrgEG5Xbt0QRG1AmnerbANj/ePeQuHBo9V8ZXPOqeVcFWkZ6eDZAYCQh35EMbl552KaK6Bt96C7eOfpPOEjl6MWw4eX+48EtwbqGqQoTpwFKkZ/f8UGNwqjf8oyMg0GJhFSTuRCFJm9JhL3voXZ2ZTVZxzmRZkq1NAixg/3q6Q== 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=mPV+Hb3LpUxzgcisP+S5QBg9Bjt8C1XPVsbe8bGZDKs=; b=av+Woxe+N2U0lTSv/wNj0A2stcx31k9jgKf+6w2M8ZrYD1YIDpe/L5RS/YZla3AKAX4pQNz654E8csmrQFfD1rWRAn0g0qcWsrHxKqQEz+wRlnArZwkiUwUX3sBIgzG9U3gK5Cr/Xnx7gEpgHOg2BKLnztcozwYTpK0rqOzRGC1Ckkk1EEwlEAQgTUpwBELP5nDrioi7sY9b0BpnZ/fzCKHOTsfqCugGgOeEUl1yU+87LQw73LiNzSxYnZtItN6QUmtb2WjsSFzYsAI5WhhHUEjMrZizCEVUChTHgn0pSF8sGeOd5kGd8DsMlCVOkVwVsSKDsdehQXGWEXHBc72vnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from DM5PR12CA0015.namprd12.prod.outlook.com (2603:10b6:4:1::25) by MWHPR12MB1325.namprd12.prod.outlook.com (2603:10b6:300:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:30 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by DM5PR12CA0015.outlook.office365.com (2603:10b6:4:1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:29 -0600 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 7 Nov 2019 09:32:29 -0600 From: To: Subject: [PATCH v6 13/13] drm/amd/display: Recalculate VCPI slots for new DSC connectors Date: Thu, 7 Nov 2019 10:32:12 -0500 Message-ID: <20191107153212.1145-14-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-1-mikita.lipski@amd.com> 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)(136003)(396003)(376002)(346002)(428003)(199004)(189003)(76176011)(446003)(476003)(2616005)(16586007)(11346002)(2906002)(486006)(8676002)(126002)(336012)(305945005)(426003)(2351001)(316002)(54906003)(6666004)(356004)(186003)(6916009)(1076003)(2876002)(5660300002)(86362001)(7696005)(50466002)(48376002)(53416004)(81156014)(81166006)(47776003)(4326008)(36756003)(478600001)(50226002)(14444005)(70586007)(70206006)(26005)(51416003)(8936002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1325; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b54c632-7973-489d-7eab-08d76397b3ec X-MS-TrafficTypeDiagnostic: MWHPR12MB1325: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZB/CDKx/hysQ8JTR1+2aTPYq07ltpCsi3WNhu98bZVJxqxgPEhPhu00WqzQFF2AZZNvheN+MwQIhNpA8jUYSp24ATD2Iy4+P8Okn/EnMJ+NoHhiLgU3IElCEP39PqBjhMpO4CP+NDxMreWc49J8mWTYbyWxPp87hhv1k1w0LicCxuRoWjnNoLUHDvpxEBn3Xziy6CTqyJ2zIYKyM7dLrECdOXi6ITBtWRqy4FKKQ03CM9mbH5wHFsuINoSe0FjBK694/X5m8POAJo4GamepXV+naw0iUl3A8U4GQtdzH1Wgoo0NlOFYSUKmcEt1/EXQjsRnYrfs+T/vkbmAOo6PBPMIC02YeOiLfinQUWB1Xs2ZLLTEFStSSEWb9oMaVsXjs6BYnFRr8IkuuDKWW/7TuzO1xhVRba5oWbKAIx14n1gtMHboUJBsogijIJ0Efuk6E X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:30.5125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b54c632-7973-489d-7eab-08d76397b3ec 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1325 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=mPV+Hb3LpUxzgcisP+S5QBg9Bjt8C1XPVsbe8bGZDKs=; b=4UDCR7LT7lOL0eOMUXHlu9WkzgiPd+xPFxXuB5zjWzRSm91AXPmUnDi8sh7x1edKkNSiDdNhwAMKVkk31n7W3kx7aUoNlTCaDYaW1aXM+r8+c23nMtA/6KYyTVWMcJU4qgehN80jPx6mQEPekIegdjWJjgu9R+o2VQbeUTX63WQ= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; 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: Jerry Zuo , Mikita Lipski , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Mikita Lipski Since for DSC MST connector's PBN is claculated differently due to compression, we have to recalculate both PBN and VCPI slots for that connector. The function iterates through all the active streams to find, which have DSC enabled, then recalculates PBN for it and calls drm_dp_helper_update_vcpi_slots_for_dsc to update connector's VCPI slots. v2: use drm_dp_mst_atomic_enable_dsc per port to enable/disable DSC Cc: Jerry Zuo Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 56 +++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) 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 609020a0549e..9e6dd82506f7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4958,6 +4958,49 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = { .atomic_check = dm_encoder_helper_atomic_check }; +static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state, + struct dc_state *dc_state) +{ + struct dc_stream_state *stream; + struct amdgpu_dm_connector *aconnector; + struct dm_connector_state *dm_conn_state; + int i = 0, clock = 0, bpp = 0; + int vcpi = 0, pbn = 0; + + for (i = 0; i < dc_state->stream_count; i++) { + + stream = dc_state->streams[i]; + + if (!stream) + continue; + + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + dm_conn_state = to_dm_connector_state(aconnector->base.state); + + if (!aconnector->port) + continue; + + if (stream->timing.flags.DSC != 1) { + drm_dp_mst_atomic_enable_dsc(state, aconnector->port, dm_conn_state->pbn, false); + continue; + } + + bpp = convert_dc_color_depth_into_bpc(stream->timing.display_color_depth)* 3; + clock = stream->timing.pix_clk_100hz / 10; + pbn = drm_dp_calc_pbn_mode(clock, bpp, true); + vcpi = drm_dp_mst_atomic_enable_dsc(state, aconnector->port, pbn, true); + + if (vcpi < 0) + return vcpi; + + if (vcpi > 0 && dm_conn_state->vcpi_slots != vcpi) { + dm_conn_state->pbn = pbn; + dm_conn_state->vcpi_slots = vcpi; + } + } + return 0; +} + static void dm_drm_plane_reset(struct drm_plane *plane) { struct dm_plane_state *amdgpu_state = NULL; @@ -7991,11 +8034,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; - /* Perform validation of MST topology in the state*/ - ret = drm_dp_mst_atomic_check(state); - if (ret) - goto fail; - if (state->legacy_cursor_update) { /* * This is a fast cursor update coming from the plane update @@ -8067,6 +8105,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT if (!compute_mst_dsc_configs_for_state(state, dm_state->context)) goto fail; + + ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context); + if (ret) + goto fail; #endif if (dc_validate_global_state(dc, dm_state->context, false) != DC_OK) { ret = -EINVAL; @@ -8096,6 +8138,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, dc_retain_state(old_dm_state->context); } } + /* Perform validation of MST topology in the state*/ + ret = drm_dp_mst_atomic_check(state); + if (ret) + goto fail; /* Store the overall update type for use later in atomic check. */ for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {