From patchwork Sat Nov 16 22:01:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11247767 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 4C17E13B2 for ; Sat, 16 Nov 2019 22:02:28 +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 33FDB2071E for ; Sat, 16 Nov 2019 22:02:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33FDB2071E 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 2F0C66E25E; Sat, 16 Nov 2019 22:01:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-eopbgr800071.outbound.protection.outlook.com [40.107.80.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF8F96E1F2; Sat, 16 Nov 2019 22:01:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L1wWHLJf6EfbFHJkIVHRjcq80Mjv4IJRQt0bNYvBATIMkyWo3i9B1HKEIbNZfxBesnzxevmjt6fHSzu4g8H0Cy/IeSdYtrLke3ETenoaF6/Cl8ZxLpDMmfJfEhbAr/PhHCf3JM1YOYqRKd1H4DtuQZJzEzHXVHQB7KFGloNZSAbV9efyzaao6z6qaJ4ivyj2lGZjKvjDg9hbckdyQCmpWTcR1CNORkT0i8bvlmdjsRtKbKqWX8Cdz7NwhMcZG8YxbP6fvf3GiaJeKYw49vIHB7jti6krrmFftLvXCQsWMs2sCtaZpWKtYiBLPrwHEIsSCjuOnB7kSXN2GU2pGcWS/w== 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=Q2AA3O+Vq5A9PsnwVzzRadrnhU7cSSGXglsJRv45JJk=; b=VQbJ2cKakKtM0fpcFevGxDON7z1U86PeOfvCwvoOwc/ArXPeznN2i4Y3kj1LcWRhYG8r2ZIySgTFRNOYTkMyc98xENUAiGb+6qoEocxzv6p+EFZRCB9vkI5UOth1FLeuvouEJ9+igu/RM3IQlEPVIWlCZv+ufiqvYfH2AZMjaSy9DCMrYtunMZooiAWVwJ61FeaVAvxtlNZblIC0UrERlstGRN5yATmeO9lZ82tv2HFFFS6b4sLEhgusP0UeZvXVpG4JRCOPMCk1h6sf1sMgwJro5hpH1AcdT+oPm+KFlFTl4I3xV3Cu7ANTBnYo7Xy23BCZ3kqLLhlN7OiHFPLGnQ== 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 CY4PR1201CA0017.namprd12.prod.outlook.com (2603:10b6:910:16::27) by DM6PR12MB2748.namprd12.prod.outlook.com (2603:10b6:5:43::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.27; Sat, 16 Nov 2019 22:01:40 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::200) by CY4PR1201CA0017.outlook.office365.com (2603:10b6:910:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Sat, 16 Nov 2019 22:01:40 +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 CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2451.23 via Frontend Transport; Sat, 16 Nov 2019 22:01:40 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Sat, 16 Nov 2019 16:01:37 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sat, 16 Nov 2019 16:01:37 -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; Sat, 16 Nov 2019 16:01:36 -0600 From: To: Subject: [PATCH v7 10/17] drm/dp_mst: Manually overwrite PBN divider for calculating timeslots Date: Sat, 16 Nov 2019 17:01:21 -0500 Message-ID: <20191116220128.16598-11-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191116220128.16598-1-mikita.lipski@amd.com> References: <20191116220128.16598-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)(396003)(346002)(39850400004)(376002)(136003)(428003)(199004)(189003)(8936002)(186003)(5660300002)(486006)(14444005)(4326008)(2616005)(126002)(6666004)(356004)(53416004)(476003)(2906002)(36756003)(50226002)(7696005)(54906003)(2351001)(51416003)(16586007)(316002)(26005)(6916009)(305945005)(47776003)(76176011)(478600001)(70206006)(81156014)(336012)(86362001)(48376002)(1076003)(81166006)(8676002)(11346002)(446003)(50466002)(426003)(2876002)(70586007)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2748; 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: c41a990a-4cfe-4416-3e01-08d76ae08f42 X-MS-TrafficTypeDiagnostic: DM6PR12MB2748: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 02234DBFF6 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9QcJvqvZZYEhd092F/oGv/TivnSXgcv89lJtTTA3vzsmREmgNKQQEjmqC/d0Nx8NsPF+bs955ZfgNGs2sbvRuq4hm6WJqi4cAB1yu3VDSVeOfZr76MCsEEnzXw1GN8EiLDxKOW9bF4SN6Lpjn6Z3uI2C0oVN8Q7JY0rj/9I3SR09jLq7obeObDujVk+TFQuvbHTKph+4ABsSBW4agr16iUNc1Mei+hcsZieUGOgAEUlDLtg0ZSYsIcsSHmaS9PntMBXIxwQ888OLx5D/ePbx5GFLfaHi5dlOBiJEl+lsvMFE5vLeVcZB4kZTKbn/Veb/f1dVselqP2se+TDu7ESwg8LP3QMNUhGJbVTsUMddUA7+be2l4cBnz9WMZXEzuOmJcmkpAlC2KPrE8TtXR8PSGLDfuff7RAyL5OzPsqS+T+XZoqyqCql/oUYEDwZhXmBr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2019 22:01:40.3335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c41a990a-4cfe-4416-3e01-08d76ae08f42 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: DM6PR12MB2748 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=Q2AA3O+Vq5A9PsnwVzzRadrnhU7cSSGXglsJRv45JJk=; b=2EVOwVn/If+EZUtuT6c0dtuVcoZu2Yu8I6W6owpyw6A6fuwPPy/0zRXnLcHPAzkpJpSwPVEYvJXcqevb0M/DSnAdfh6IJW+GTC04Jw0rRgy7hXrsC5GJa1soIVnekM1dWC/Oa+t+Ygjqf1C6AHgPQXvSjxkSMrXdVtJy6rc/1Tk= 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: Mikita Lipski , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Mikita Lipski [why] For DSC case we cannot always use topology manager's PBN divider variable. The default divider does not take FEC into account. Therefore we should allow driver to calculate its own divider based on the link rate and count its handling, as it is hw specific. [how] Pass pbn_div as an argument, which will be used if its more than zero, otherwise default topology manager's pbn_div will be used. Signed-off-by: Mikita Lipski --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++++-- drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ++- include/drm/drm_dp_mst_helper.h | 3 ++- 5 files changed, 14 insertions(+), 6 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 6c32b73c5197..3657a26ce1d1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4972,7 +4972,8 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, dm_new_connector_state->vcpi_slots = drm_dp_atomic_find_vcpi_slots(state, mst_mgr, mst_port, - dm_new_connector_state->pbn); + dm_new_connector_state->pbn, + 0); if (dm_new_connector_state->vcpi_slots < 0) { DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_state->vcpi_slots); return dm_new_connector_state->vcpi_slots; diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index d5df02315e14..94bb259ab73e 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3211,6 +3211,7 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr, * @mgr: MST topology manager for the port * @port: port to find vcpi slots for * @pbn: bandwidth required for the mode in PBN + * @pbn_div: divider for DSC mode that takes FEC into account * * Allocates VCPI slots to @port, replacing any previous VCPI allocations it * may have had. Any atomic drivers which support MST must call this function @@ -3237,7 +3238,8 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr, */ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, - struct drm_dp_mst_port *port, int pbn) + struct drm_dp_mst_port *port, int pbn, + int pbn_div) { struct drm_dp_mst_topology_state *topology_state; struct drm_dp_vcpi_allocation *pos, *vcpi = NULL; @@ -3270,7 +3272,10 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, if (!vcpi) prev_slots = 0; - req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div); + if (pbn_div <= 0) + pbn_div = mgr->pbn_div; + + req_slots = DIV_ROUND_UP(pbn, pbn_div); DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n", port->connector->base.id, port->connector->name, diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index dfac450841df..2123ac2939f0 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -65,7 +65,7 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, false); slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, - port, crtc_state->pbn); + port, crtc_state->pbn, 0); if (slots == -EDEADLK) return slots; if (slots >= 0) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index c45832230ccc..27c5ff99f77e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -784,7 +784,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, if (crtc_state->mode_changed) { slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, mstc->port, - asyh->dp.pbn); + asyh->dp.pbn, + 0); if (slots < 0) return slots; diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 4cf738545dfb..fc19094b06c3 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -661,7 +661,8 @@ struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_a int __must_check drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, - struct drm_dp_mst_port *port, int pbn); + struct drm_dp_mst_port *port, int pbn, + int pbn_div); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr,