From patchwork Wed Oct 30 19:24:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11219997 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 CE3DB139A for ; Wed, 30 Oct 2019 19:25:17 +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 B584A204FD for ; Wed, 30 Oct 2019 19:25:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B584A204FD 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 749626ED1E; Wed, 30 Oct 2019 19:24:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750081.outbound.protection.outlook.com [40.107.75.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED7516ED2D; Wed, 30 Oct 2019 19:24:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIKM8ZWZ/ibe4mmtnQNjG7u7H/kmMCwsAw6AJFlFEKeKo5EPgZUWNblpCXWTQkiVQZfxnskcUkWlI4MXRczLwuDVmc+ww4gfytrbUs155GrK4g+bH2P1vQtD1Rkn8Mycjw1ApaXw45YocheB6RLUV9rbwz2sud+SUEMMq2Apls4kMty8g2/4lzoFQBigQGEKqgyK91NSd3VDrfgywuCSvvluTJErY8Ch+CrsamPhcSIZonGiaj6wBL3IG0LIJlbd/tma2uOwZpe8CQS0Ex7NHDOlMb5nNJb/6z9qaD3r6CSa48mOz4SaXo19bLWAvAEHi1mKHIzZRVujcN8MA9URPA== 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=fiPPz/0vsukTGH0ZDkhUo1azABN+W79GAY4r8CFOp6I=; b=aT+8aA9vL+KtcKoli7OXqejz4w9tlsGJqErmyqq1Gr0HNu2RhVu+30afYzX6qTcEH55kr1NubbEZddUgaimmWLmd3POfp0MUquyyFXFR96hUQuSz5cF7rO7G6Oe0OWm7Z5Tjur0nYvbgbIyI4Q8XwdVRGO6+amj63VpQ6qiX50j0O3NJEaHCgu8teKM3pf9mePQ2eyjZoaQSb7RxrJHjwRwcYbLmATE0nlDNhkuSyQuljCfLzmThRbdZaYSJ5AEVSZLQAmHOS2Mfm+qllpxu7yEMb59CSBGl4IeCJQWx/8UOUBLzj581sKy0RtOSyrlKdzWEU24BB6F4on6tiwO17A== 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 CH2PR12CA0013.namprd12.prod.outlook.com (2603:10b6:610:57::23) by DM6PR12MB3356.namprd12.prod.outlook.com (2603:10b6:5:38::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.23; Wed, 30 Oct 2019 19:24:46 +0000 Received: from CO1NAM03FT039.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by CH2PR12CA0013.outlook.office365.com (2603:10b6:610:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.18 via Frontend Transport; Wed, 30 Oct 2019 19:24:46 +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 CO1NAM03FT039.mail.protection.outlook.com (10.152.81.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2387.20 via Frontend Transport; Wed, 30 Oct 2019 19:24:46 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Wed, 30 Oct 2019 14:24:46 -0500 Received: from SATLEXMB02.amd.com (10.181.40.143) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 30 Oct 2019 14:24:45 -0500 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 30 Oct 2019 14:24:45 -0500 From: To: Subject: [PATCH 13/13] drm/amd/display: Recalculate VCPI slots for new DSC connectors Date: Wed, 30 Oct 2019 15:24:31 -0400 Message-ID: <20191030192431.5798-14-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030192431.5798-1-mikita.lipski@amd.com> References: <20191030192431.5798-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)(979002)(4636009)(376002)(136003)(396003)(39860400002)(346002)(428003)(189003)(199004)(70206006)(70586007)(51416003)(7696005)(6916009)(316002)(4326008)(36756003)(50466002)(14444005)(48376002)(86362001)(8676002)(81156014)(81166006)(2351001)(50226002)(8936002)(47776003)(76176011)(1076003)(16586007)(486006)(426003)(476003)(126002)(478600001)(2906002)(305945005)(2616005)(446003)(11346002)(6666004)(356004)(2876002)(336012)(5660300002)(54906003)(26005)(186003)(53416004)(16060500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3356; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f721b84-4af6-4b58-319c-08d75d6ed328 X-MS-TrafficTypeDiagnostic: DM6PR12MB3356: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 02065A9E77 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2xkreXOIhV+faBB8DDnMFlGS/jYezEp3Xi7R4NbQLCVEucb0NGq5FvMTDRRVM8LhWyLaR4/lIiO0uDWWpBkYA22cFHOEW9KtiR7jW/8+6mCvN8Qnpo2LSvoGO41J3VH44tItmSBdrv0WYS60dfd+XJmJ8QdV9GAs1V/H1mXTHMhrwLbmTpsD36QS6feo/AHQeMCDMlpvHt8qnAso0QOY/4T3ReR9K3hhdcLfVE/MY/CtI8iUTQoT2vD2BGuK3OwXN5g6AX/iTEJDYbn8a4idF+O3UEkh3vW0ecqCFxcDvfCFvvEtIocexZoTs6yOeDIi+9plospTV4o0n+VM/E+J1YT3PmHyPTGLUvjcLyVvawjtLgDB/8xWYBikyZOEKyo9xLybLzgaSBgu35dQKXIV5reJ0uhyMmH3TJmdcEC4nknu0Hxd6JEY4ZT9wmuzFWWG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2019 19:24:46.4993 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f721b84-4af6-4b58-319c-08d75d6ed328 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: DM6PR12MB3356 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=fiPPz/0vsukTGH0ZDkhUo1azABN+W79GAY4r8CFOp6I=; b=1WfdRvLKJCd+39FppO1asR59EUwQSVXtxkLdZDbSwI52S1zLJbjCQqcRayJ1OJOzQbWR582ksrjl2xE/UIvlqkWLFL/wL/0xJtU3buoDto6d45gjfwGTzj2qOt2ONWvWk4zoOlfmvmVzXHriqx85pxSfktQCgZH+aH3wuHg5Gw0= 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. Cc: Jerry Zuo Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 50 +++++++++++++++++-- 1 file changed, 45 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 1bbdf29f3c7d..1bc02957cd18 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4674,6 +4674,43 @@ 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; + + 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) + continue; + + bpp = convert_dc_color_depth_into_bpc(stream->timing.display_color_depth)* 3; + clock = stream->timing.pix_clk_100hz / 10; + + dm_conn_state->pbn = drm_dp_calc_pbn_mode(clock, bpp, true); + + dm_conn_state->vcpi_slots = drm_dp_helper_update_vcpi_slots_for_dsc(state, aconnector->port, dm_conn_state->pbn); + + if (dm_conn_state->vcpi_slots < 0) + return dm_conn_state->vcpi_slots; + } + return 0; +} + static void dm_drm_plane_reset(struct drm_plane *plane) { struct dm_plane_state *amdgpu_state = NULL; @@ -7707,11 +7744,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 @@ -7783,6 +7815,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(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; @@ -7812,6 +7848,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) {