From patchwork Wed Sep 18 20:26:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11151237 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 F30C913BD for ; Wed, 18 Sep 2019 20:28:09 +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 DA5CA21A49 for ; Wed, 18 Sep 2019 20:28:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA5CA21A49 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 3C3A672AF6; Wed, 18 Sep 2019 20:27:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680067.outbound.protection.outlook.com [40.107.68.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB1C672B09; Wed, 18 Sep 2019 20:27:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0l+SAAauYiBO4RRymMnwNSpibxn4Hw3Y0JNIcDhaA64zFUsNcMvUHB4YToynpus7Qqu73XvTXJNs00b8gA9vxJBwn1rHj2aP+siHk3uRwb+fJE2qMhCJI1CN2aycbKcsiUR7EGoxg2UdMdxOqkhvu9lJ1leab8xcXdwXGWTNfYL3nTStIxg/QWAbdyuZyu8bJj5qZ4OHtb/JG/BygaiyDuy0L0ADGixw4FnhEYvOu/jGnVVlw3+Vg3Kd8ya+ubFvDye44Jpsry3bbjQcaNnbTEz5znwVTLIWOoKFH3XZMhSUd9qHQtj36rqQ1mfqSBp24wx0tNa6CUUtTX6YY3BSA== 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=zLmdCRWOUR5MCoEs1obEACirivcB5+sy2aIFUQc4p+U=; b=B2JNse7NjbvbF2HM0hRU4gUR1w0fV7265l+uLmZWUPfNj8XSfoKbQX/mUwTyJ0et9tUra13xT7W4FbwuNVMsntPr+Z1eFziEnsK7sEj8ALTUN1wLyVuZzIOsfkkDKewqh98yuJgcVhdZkXptHbe1+Q3quHKfW6jxF4c9Qy2MSa7C7AmbcTZUwW4FjDsxbvFPONthO1xF06+jKVrt7BLNsgaj8e/Xdz1/wjOTDr3+Bze/31/bSQKHjvURh+uMxUmxz8alaw+m/wbX45Yaf9PNRTnHhF1FtQMpC6LsJByIccDhE0tslvem/X1hhFGCnIzQ1Vmso8LY/x51Mmrg7kXIkw== 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 CH2PR12CA0006.namprd12.prod.outlook.com (2603:10b6:610:57::16) by BN8PR12MB2884.namprd12.prod.outlook.com (2603:10b6:408:97::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.18; Wed, 18 Sep 2019 20:27:31 +0000 Received: from DM3NAM03FT014.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by CH2PR12CA0006.outlook.office365.com (2603:10b6:610:57::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20 via Frontend Transport; Wed, 18 Sep 2019 20:27:31 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT014.mail.protection.outlook.com (10.152.82.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.14 via Frontend Transport; Wed, 18 Sep 2019 20:27:30 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 18 Sep 2019 15:27:29 -0500 From: To: Subject: [PATCH 10/15] drm/amd/display: Use correct helpers to compute timeslots Date: Wed, 18 Sep 2019 16:26:47 -0400 Message-ID: <97921519cf0c4f0684fa11c81693f077930662d7.1568833906.git.mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: 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)(376002)(136003)(39860400002)(396003)(428003)(189003)(199004)(476003)(11346002)(2616005)(186003)(2906002)(478600001)(118296001)(305945005)(26005)(86362001)(48376002)(2876002)(14444005)(50226002)(8936002)(81156014)(51416003)(426003)(316002)(54906003)(336012)(8676002)(16586007)(76176011)(126002)(486006)(6916009)(47776003)(446003)(50466002)(6666004)(356004)(81166006)(5660300002)(70206006)(2351001)(4326008)(450100002)(53416004)(36756003)(7696005)(70586007)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR12MB2884; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e43ec94-c4e3-404b-cae6-08d73c76a173 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328); SRVR:BN8PR12MB2884; X-MS-TrafficTypeDiagnostic: BN8PR12MB2884: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 01644DCF4A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: n/oNS2xOB9P6GudSO1ICFDKwlEhipcPiy4RkvTGFvV3sVtsuszHQtUqFZAQtFKoPs42YKQOxihpq0e0U38zr5fg1/wQCh8Nrn2dtgCWzEG3DaMVW7MILO6KrGriC3T2c3Us/K51ZFgFYpdHHcs0b1tYqYHB0pyOi3X+22+fZJuGTwrp+dmPmERyewhnOvN4apNrql6oSSXAzmwJwigT3nh62/2tg+3uKY7Ku8qwuncwFxn8tthDFex8U2Urk02MUK7aQlaWvOq5V3qucmLLkSzlohXYtq12W6tWn1mdb8T7wE65TIme4EeHmuEeu5eWlzEY6ererkyElwBX7Kmgo9ZRrYVcvLI9Y675njg0r3GKdJAOkbuKl0QSgB565y5WZmmqsSBcvFR8NKWCCp/1k3ehr2mNPhXAJyhQDlR6tfd8= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2019 20:27:30.7871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e43ec94-c4e3-404b-cae6-08d73c76a173 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2884 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=zLmdCRWOUR5MCoEs1obEACirivcB5+sy2aIFUQc4p+U=; b=G8JFFZmPX0k2LQ0VmTerTjSIm7Uwa3EsA0fmiM0sTfCTNwmzPCjMuuvSZVRZrQr3SWkjmde3FkbqiJOAwY1qc2/PAjtiMMX0mhQH1JXwEeJmY6FZwG6kC+TikoiuCd1naZOEEv1NxgAu3FCImnRMyxuZ91ZhwrIpj0Nf+bvfCMo= 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: David Francis , Jerry Zuo , dri-devel@lists.freedesktop.org, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis We were using drm helpers to convert a timing into its bandwidth, its bandwidth into pbn, and its pbn into timeslots These helpers -Did not take DSC timings into account -Used the link rate and lane count of the link's aux device, which are not the same as the link's current cap -Did not take FEC into account (FEC reduces the PBN per timeslot) For converting timing into PBN, use the new function drm_dp_calc_pbn_mode_dsc that handles the DSC case For converting PBN into time slots, amdgpu doesn't use the 'correct' atomic method (drm_dp_atomic_find_vcpi_slots), so don't add a new helper to cover our approach. Use the same means of calculating pbn per time slot as the DSC code. Cc: Jerry Zuo Cc: Nicholas Kazlauskas Signed-off-by: David Francis --- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index b151a5a51a94..aaf3158534ab 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -188,8 +188,8 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( int slots = 0; bool ret; int clock; - int bpp = 0; int pbn = 0; + int pbn_per_timeslot, bpp = 0; aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; @@ -233,11 +233,19 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( bpp = bpp * 3; - /* TODO need to know link rate */ - - pbn = drm_dp_calc_pbn_mode(clock, bpp, false); +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + if (stream->timing.flags.DSC) + pbn = drm_dp_calc_pbn_mode(clock, + stream->timing.dsc_cfg.bits_per_pixel, + true); + else +#endif + pbn = drm_dp_calc_pbn_mode(clock, bpp, false); - slots = drm_dp_find_vcpi_slots(mst_mgr, pbn); + /* Convert kilobits per second / 64 (for 64 timeslots) to pbn (54/64 megabytes per second) */ + pbn_per_timeslot = dc_link_bandwidth_kbps( + stream->link, dc_link_get_link_cap(stream->link)) / (8 * 1000 * 54); + slots = DIV_ROUND_UP(pbn, pbn_per_timeslot); ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots); if (!ret)