From patchwork Tue Oct 29 13:52:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11217967 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 0F95714DB for ; Tue, 29 Oct 2019 13:53:37 +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 EA7DC20862 for ; Tue, 29 Oct 2019 13:53:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA7DC20862 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 981C96EB3E; Tue, 29 Oct 2019 13:53:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730080.outbound.protection.outlook.com [40.107.73.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id E64FE6E3F3; Tue, 29 Oct 2019 13:53:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GTnzYOnPunHAYilR+jqbxyT3kJLLvCUKg89ZdInXNmoyIoE3H/Ng7phs7jnkRCWE5Wa2CuqDq0ehhxXR8CcfExW4E98sJLh5vrAm3iLA8MtMmtKQFUnp0Vn06JiLPZtMimXhfURRZn8w7Lear8D21fPrt1LV8Kex6bI8V1L2Ad97MPJZDivI8eA+yFPBjcI2gB8rgchhvoaafDoDRB6vd6qgUGN+iKRVPhMUFVwbAqtNk0XKS/BmfrGnmaQ+iwss3YWzCvqJWXt4LO+WLK2NpGYZbxYL37qSa8ydOsrg6LkycscDPD6w/e/0XIGbXXItF15FpeXHid4cSrla1LQ2hw== 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=nr+TAUDm/MnVgXhfKt6CMssAb+kS6ADjzD5TlN2ndBk=; b=g1j4s3TxoFJy+Fgh+L2Eek1gI02+b7LEMSWeChP1UfuihdOlLMq0pex0WkZKpD7VP8ylos6HgOycGRQT41hzRyVsChn1YCHvBUoVkuI3tQFc+eWm2fK2lOhK/pAEaU+8ePmcIv6fzwf0YAceUbw+Hvcc9vOnbry94rbWrtxdUAoJMgt7KiJLDsRBZjG8i45a/2mgIAxkEWLMe8rHo4O2hAgkmVJlVcTt5TAmUBRVkV+6q3IV6/DYWJ7Nd/d8iGY0E5vDfuSgSH5RnECiiM8jM3uK9+soxDP5lndvL5UICQFUm/dZn/jiBnuCsZqAC6GTMUd4RC55D89UYQqAsY6oNw== 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 BN8PR12CA0012.namprd12.prod.outlook.com (2603:10b6:408:60::25) by BN8PR12MB3027.namprd12.prod.outlook.com (2603:10b6:408:64::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.23; Tue, 29 Oct 2019 13:53:04 +0000 Received: from CO1NAM03FT040.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by BN8PR12CA0012.outlook.office365.com (2603:10b6:408:60::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.17 via Frontend Transport; Tue, 29 Oct 2019 13:53:04 +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 CO1NAM03FT040.mail.protection.outlook.com (10.152.81.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2387.20 via Frontend Transport; Tue, 29 Oct 2019 13:53:03 +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; Tue, 29 Oct 2019 08:53:01 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) 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; Tue, 29 Oct 2019 08:53:01 -0500 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; Tue, 29 Oct 2019 08:53:00 -0500 From: To: Subject: [PATCH 13/13] drm/amd/display: Recalculate VCPI slots for new DSC connectors Date: Tue, 29 Oct 2019 09:52:45 -0400 Message-ID: <20191029135245.31152-14-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191029135245.31152-1-mikita.lipski@amd.com> References: <20191029135245.31152-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)(376002)(136003)(396003)(346002)(428003)(199004)(189003)(48376002)(81156014)(16586007)(54906003)(8676002)(36756003)(1076003)(478600001)(50466002)(5660300002)(2876002)(186003)(81166006)(305945005)(70586007)(47776003)(2906002)(14444005)(8936002)(316002)(356004)(6666004)(70206006)(50226002)(86362001)(53416004)(7696005)(476003)(486006)(51416003)(336012)(6916009)(4326008)(26005)(426003)(76176011)(2351001)(11346002)(2616005)(126002)(446003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR12MB3027; 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: 082cf3a7-8326-42ee-9eb1-08d75c7751c7 X-MS-TrafficTypeDiagnostic: BN8PR12MB3027: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0205EDCD76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mvki77R8+i3Mfb4EF2IMbFrpG6SiY6z3uJ0hkA7eBSfr0AkoDrK11YA3QU6XyNpanRARq5AW6H3BI76lCnsCn/ow9vi3ekMhkroyp5qIP+DvGwxLkNtWOJc5fIwycatZt1W3IBpM+YJvfVZHDA9rkVY2MxFNU1k/V/fNBFgtm1hC7ho9wfl8HKpe/B7+W/2Hvci4VyAg7dFb/XVl0iIzCBj+CZIBdzL5jpD40Rnmszy3ZztuLV6Ix+8sn2O8aW72DbL/bARDV/sIfJAUs7SlxTpZnFuPvk4o2fQuPIgfa7XvD9ZQw2CbdpSlIU6XDwKBGOY3nhw9Wg46IsBQ9Or404FrOTbyOSPDCaSuMLi4SFQOp9+priFjgBZXU+etFVptQwL+uGoO4qG6IEfqnskuNKirZGNyFgaGRYDPVDkJ+Sknb4YnoRdLpgCr3Xtxk4BI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2019 13:53:03.7393 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 082cf3a7-8326-42ee-9eb1-08d75c7751c7 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: BN8PR12MB3027 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=nr+TAUDm/MnVgXhfKt6CMssAb+kS6ADjzD5TlN2ndBk=; b=DPcYHm4HIja/mHl8wSdGkaWEYOWJ5IYXfDALHCLO0l5NqxK6VZ73uzRYkJaGMT+BRca/WgCEoiSkBx3wedaGhGjJqwpz71MmooXRN5yI7RUziVD/j+5jIMFR2aKazBXlpK0NC/8arSnUOlJdhFHVdxEmJSNT/GtY547KyzBHYCQ= 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 | 71 +++++++++++++++++-- 1 file changed, 66 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 adbd28e17947..664def4e4652 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4608,6 +4608,27 @@ static void dm_encoder_helper_disable(struct drm_encoder *encoder) } +static int convert_dc_color_depth_into_bpc (enum dc_color_depth display_color_depth) +{ + switch (display_color_depth) { + case COLOR_DEPTH_666: + return 6; + case COLOR_DEPTH_888: + return 8; + case COLOR_DEPTH_101010: + return 10; + case COLOR_DEPTH_121212: + return 12; + case COLOR_DEPTH_141414: + return 14; + case COLOR_DEPTH_161616: + return 16; + default: + break; + } + return 0; +} + static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) @@ -4651,6 +4672,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; @@ -7684,11 +7742,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 @@ -7760,6 +7813,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; @@ -7789,6 +7846,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) {