From patchwork Tue Dec 3 14:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11271421 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 3DCBC138D for ; Tue, 3 Dec 2019 14:36:11 +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 2661020659 for ; Tue, 3 Dec 2019 14:36:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2661020659 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 AE3AE6E7BD; Tue, 3 Dec 2019 14:35:55 +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-eopbgr750089.outbound.protection.outlook.com [40.107.75.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1745C6E7AD; Tue, 3 Dec 2019 14:35:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MiF0454mXBXXL3BH1Zd7XiGo1q0nB8uRSoWMvE4hAAmXiclDDcF1bF/20Nxjmjh5ByNE3IthLiO7nSJcbNf1TOdhdlsHbhTRWyfazHiFjd/ZTjYbiN2qACbSWB9PMXsRXI1DHmfZXo0BtbIe+WLgLb85AWWAAR6lFJun6ngowpz5VZQDvvVn3XwqiwELne56pNjlr0HJjOkyoS/OAmDw4s6tljXpAsKwMfApNo15ZB1mNDJBlDHcVS1n+cTrW62KeaSnjbNupLq7DojzjPjyzm0aGGJfOIqyY3Kfis5DFXSAnHP9ZVnmQmHE6Vflm6kh/DjMiUI+HOpLUbxwCThqFQ== 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=83SoNAC0jTM6aVE4hAwsT2MeLkJoIL8Pvx6Aqg8fnWM=; b=A5NqA4CHuOjEgdzH8RE385+kTvdSjfmIcOGh1fy/WO+uMOKMjzkJqfl86P4F3cY4F9a1kruV0E0sG/ap2mEeSuJ7Kk9Ul6CAl6oUxDtouegPead+9iPKlmEcsn8Q7d3MMGPCugBzvmDJNmomHPOdR5zXkCvUc1kBreP79Roh/qLQD3fnnzRcw/h4WN1EJ+1Inqq/9T2vjQdQOBP9H8Ds+vxZYFh01cxT260IiNfiynfPJwQyX8eYhY09N7OF2+OatYnL3U2N/03wuFDFqdIV8DVkcuf3XhDflvVVe191oIF8Q3mhOVFknfWxHVGdnM7nzRFbmb13cB/G04uR1oQH8Q== 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 DM6PR12CA0022.namprd12.prod.outlook.com (2603:10b6:5:1c0::35) by BN6PR12MB1683.namprd12.prod.outlook.com (2603:10b6:405:3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.20; Tue, 3 Dec 2019 14:35:47 +0000 Received: from DM6NAM11FT054.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::205) by DM6PR12CA0022.outlook.office365.com (2603:10b6:5:1c0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2495.18 via Frontend Transport; Tue, 3 Dec 2019 14:35:47 +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 DM6NAM11FT054.mail.protection.outlook.com (10.13.173.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Tue, 3 Dec 2019 14:35:47 +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; Tue, 3 Dec 2019 08:35:45 -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; Tue, 3 Dec 2019 08:35:45 -0600 From: To: Subject: [PATCH v8 10/17] drm/dp_mst: Manually overwrite PBN divider for calculating timeslots Date: Tue, 3 Dec 2019 09:35:23 -0500 Message-ID: <20191203143530.27262-11-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203143530.27262-1-mikita.lipski@amd.com> References: <20191203143530.27262-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)(346002)(136003)(39860400002)(376002)(396003)(428003)(189003)(199004)(478600001)(446003)(50466002)(14444005)(48376002)(53416004)(6916009)(5660300002)(305945005)(70206006)(70586007)(26005)(4326008)(186003)(450100002)(1076003)(2616005)(36756003)(16586007)(54906003)(8676002)(51416003)(7696005)(316002)(2906002)(76176011)(86362001)(2876002)(2351001)(8936002)(336012)(81156014)(81166006)(6666004)(356004)(426003)(50226002)(11346002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1683; 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: a7a747dd-8037-467f-8e25-08d777fe1654 X-MS-TrafficTypeDiagnostic: BN6PR12MB1683: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 02408926C4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xAYY69rsCH9icHmyUkgXSowzNdqJIDIEpvCdpYCp0yG+VLQEgCsr8iO16R//ybxC1oOD3tQAsoYJvLled/q+wet7iGn+EACK/edFsP0TUdrJ3k27uRdzTppATtJhSb+NMT+raHxnsKD65ZE9dZG7ARqzx+cWoxAnPXP4u3M4LETdh9izQ0jKaHNB9Ec5tod/jEzBDclybBKT+H6xNsSA+TVn54AF69P1YqvNftL8O4K1O2NE7hvOxvU4erdCGC+7fBIb1tclIcxe32UjAWZ6SVhpK5GvQvpCSJL5w8zyiyblLld8+CYkMpmi5n6h2Y43BuZ7z9gMSJhipoBpH3ahC2+U0Uzm0aD9P0d8Ibx9xaSk4jOGh8GsWw0nPXr+uBLandYBoa9z/rx6On5G62JBu3CGZ4j8E5CFrPIe0MoLtZLiyhwvPkXYVnA8XzYAbnFD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2019 14:35:47.5412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7a747dd-8037-467f-8e25-08d777fe1654 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: BN6PR12MB1683 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=83SoNAC0jTM6aVE4hAwsT2MeLkJoIL8Pvx6Aqg8fnWM=; b=qegw5uMm7Jn3w9hB3y1UOWPgmgDQeCboX15n8RHsW/jg4tZmvKN26Uuy7Wy3C5AI65MN5cPNruwZQkHz/Ktd9j+1x+21z3IeYD3AXz64iPIQ0tKmY1PHjta2LUiscNWU00TyVJ5HvKGsqCeIll5W7C/FsMi586QqZ8gBxtZgrsg= 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 9fc03fc1017d..753a79734817 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 018921c4ba98..f1d883960831 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4020,6 +4020,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 @@ -4046,7 +4047,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; @@ -4079,7 +4081,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 92be17711287..a068f54a6793 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 1c9e23d5a6fd..edb78966c5b6 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -787,7 +787,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, 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 32e60b9d7098..0f813d6346aa 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -771,7 +771,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,