From patchwork Thu Nov 7 15:32:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233199 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 4650F16B1 for ; Thu, 7 Nov 2019 15:32:27 +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 2E8CD218AE for ; Thu, 7 Nov 2019 15:32:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E8CD218AE 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 603D96F6FD; Thu, 7 Nov 2019 15:32:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740047.outbound.protection.outlook.com [40.107.74.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5E2B6F6FD; Thu, 7 Nov 2019 15:32:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LLmmlPcnBRRlZ8Em4PO+N3b0lrty4XK1RQrw6VP5VmyMIpAtCtDAc9UbwwI/l+q0iO7UumUtV5O5olYHY/xvDsrTLHCaWm1K47OvkpztaH20+6sZSmHR2C++Afkmb/aWRcdNrRlWgWtbgmeLwUgjlRy3bCaY+bMWb3Kf8HHS2hb8wrQi3Sd2vov2C0mhd9mDwwgNfiiC/yFH+wsD2bsR8C10HMb9VxC6JppSS0hw4QqhJQYDe/Kh9TI5nI2OEsivbUNERhay9UNT7CBmOJNbwgi/SFhOE6VkzSQSsNQSnZYcdiYuJu+dJjSpKE8+b1FjxRZbJjXL53Rwyd8P7SJc6Q== 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=04kxfx0JD2c16853aQrKAz2/UxS3NWOX1WvwXozLme8=; b=caGeOHMKLiVEp5/K4mQ/1zk+UbivwO1Pi/MalaBsdSNlKxjWQx8MxggRh2AWeqOmFpyxakh8s4MwEiSSTmzJsETXaPVPer3TTE6lv+9u7Ci+EmYfP2zj8PckRiGCsmUfCFsBTj+D+ZXo+Vx12qsvwEFk5yPkwlCR+KsUBPKxeqCFyeFCbMw6uY29UlGdu3Aoat8QGMaqegZMBcCebF02HE6/W1R0MDUVWDgL70EMI9ykD0ccE3jD4QpSPTvNhgoUeFx8Jb5Bh8em1lMyFhEFd7jpa39OwyeoH+sMRgdKf6IN0PLJ1mOrdQ+TZ32WAX0WGCkpT/cJIM+ZuXm+3gJrkQ== 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 BN8PR12CA0034.namprd12.prod.outlook.com (2603:10b6:408:60::47) by DM6PR12MB2953.namprd12.prod.outlook.com (2603:10b6:5:181::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.23; Thu, 7 Nov 2019 15:32:19 +0000 Received: from DM3NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::205) by BN8PR12CA0034.outlook.office365.com (2603:10b6:408:60::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2430.24 via Frontend Transport; Thu, 7 Nov 2019 15:32:19 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT051.mail.protection.outlook.com (10.152.83.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:19 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:19 -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; Thu, 7 Nov 2019 09:32:18 -0600 From: To: Subject: [PATCH v6 01/13] drm/dp_mst: Add PBN calculation for DSC modes Date: Thu, 7 Nov 2019 10:32:00 -0500 Message-ID: <20191107153212.1145-2-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(39860400002)(346002)(136003)(376002)(428003)(199004)(189003)(2906002)(86362001)(16586007)(70586007)(2876002)(305945005)(81166006)(81156014)(478600001)(8676002)(446003)(76176011)(11346002)(126002)(6916009)(476003)(7696005)(51416003)(50226002)(2616005)(8936002)(70206006)(47776003)(316002)(486006)(2351001)(53416004)(426003)(26005)(1076003)(36756003)(54906003)(50466002)(186003)(6666004)(48376002)(5660300002)(356004)(450100002)(4326008)(336012)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2953; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd243aba-e6d1-4507-5d8e-08d76397ad50 X-MS-TrafficTypeDiagnostic: DM6PR12MB2953: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3OhSzL0WUi6FTpVLxIkEiaZKn0LO66J7VShHhhNlukuJ4ZwZm8R9Wdup8xf9itHkC/On3Q5P1B1mA6qgfrx/kmt01kkxFvS/vkZHdjsPkSc9+pMem7vHvWilXh/T9P9pDHHZN71ISGXhaCirthy4bBmFQ1G6jLjJMUe4JfbRVn5hM6eARahDQHwCoOOImug0pVMHCuyOnw8hhQk6XNxDuQYxGAYLKnCeYNnUZKUs5i1xn/eZJeI4SDEAf05slWz9K6mV+t5+EIw0d0EYhrU9eio04D5oD2g6ibly8jgvjxhRGCDIcD0wbPWTPX7/bQCrDQ/Bu7IYpLqEXVj5VRK3ufLr0uwGdoWd7AQH94keTLk3lZzD0+8JzZQJacmqzNuuc1r8cZc4VCkeZxGvRBwRsUByhwxxlRRklbysVsYqPa2l5/CJ9LJIADCZJ9YzPqQF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:19.4290 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd243aba-e6d1-4507-5d8e-08d76397ad50 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2953 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=04kxfx0JD2c16853aQrKAz2/UxS3NWOX1WvwXozLme8=; b=g4rzgg8BvuAyZVrVwI4/fOLaD75InIevxqHinOnrOcJwoJAFKIfFZE2wYma9oXRZ+4rafgvrNsRSk/syHySqNYSGjOsfFX6TP4hxHflMnnqW8czqz0OOOy/9+Lni5I+zQoFlekIPtfdS4fqMn5zYaWOynNIuJrOlWkHTmBmjtRY= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis With DSC, bpp can be fractional in multiples of 1/16. Change drm_dp_calc_pbn_mode to reflect this, adding a new parameter bool dsc. When this parameter is true, treat the bpp parameter as having units not of bits per pixel, but 1/16 of a bit per pixel v2: Don't add separate function for this Reviewed-by: Manasi Navare Reviewed-by: Lyude Paul Reviewed-by: Harry Wentland Signed-off-by: David Francis --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 16 ++++++++++++---- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 ++- drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ++- drivers/gpu/drm/radeon/radeon_dp_mst.c | 2 +- include/drm/drm_dp_mst_helper.h | 3 +-- 6 files changed, 19 insertions(+), 10 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 ed7cad4a182d..105ab57515fe 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4940,7 +4940,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, color_depth = convert_color_depth_from_display_info(connector, conn_state); bpp = convert_dc_color_depth_into_bpc(color_depth) * 3; clock = adjusted_mode->clock; - dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp); + dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp, false); } dm_new_connector_state->vcpi_slots = drm_dp_atomic_find_vcpi_slots(state, mst_mgr, diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 82add736e17d..3e7b7553cf4d 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3534,10 +3534,11 @@ EXPORT_SYMBOL(drm_dp_check_act_status); * drm_dp_calc_pbn_mode() - Calculate the PBN for a mode. * @clock: dot clock for the mode * @bpp: bpp for the mode. + * @dsc: DSC mode. If true, bpp has units of 1/16 of a bit per pixel * * This uses the formula in the spec to calculate the PBN value for a mode. */ -int drm_dp_calc_pbn_mode(int clock, int bpp) +int drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc) { u64 kbps; s64 peak_kbps; @@ -3555,11 +3556,18 @@ int drm_dp_calc_pbn_mode(int clock, int bpp) * peak_kbps *= (1006/1000) * peak_kbps *= (64/54) * peak_kbps *= 8 convert to bytes + * + * If the bpp is in units of 1/16, further divide by 16. Put this + * factor in the numerator rather than the denominator to avoid + * integer overflow */ numerator = 64 * 1006; denominator = 54 * 8 * 1000 * 1000; + if (dsc) + numerator /= 16; + kbps *= numerator; peak_kbps = drm_fixp_from_fraction(kbps, denominator); @@ -3570,19 +3578,19 @@ EXPORT_SYMBOL(drm_dp_calc_pbn_mode); static int test_calc_pbn_mode(void) { int ret; - ret = drm_dp_calc_pbn_mode(154000, 30); + ret = drm_dp_calc_pbn_mode(154000, 30, false); if (ret != 689) { DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", 154000, 30, 689, ret); return -EINVAL; } - ret = drm_dp_calc_pbn_mode(234000, 30); + ret = drm_dp_calc_pbn_mode(234000, 30, false); if (ret != 1047) { DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", 234000, 30, 1047, ret); return -EINVAL; } - ret = drm_dp_calc_pbn_mode(297000, 24); + ret = drm_dp_calc_pbn_mode(297000, 24, false); if (ret != 1063) { DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", 297000, 24, 1063, ret); diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 2c5ac3dd647f..dfac450841df 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -61,7 +61,8 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, crtc_state->pipe_bpp = bpp; crtc_state->pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, - crtc_state->pipe_bpp); + crtc_state->pipe_bpp, + false); slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, port, crtc_state->pbn); diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index f1dbc7852414..c45832230ccc 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -778,7 +778,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, if (!state->duplicated) asyh->dp.pbn = drm_dp_calc_pbn_mode(crtc_state->adjusted_mode.clock, - connector->display_info.bpc * 3); + connector->display_info.bpc * 3, + false); if (crtc_state->mode_changed) { slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c index 2994f07fbad9..c997f88218f2 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c @@ -514,7 +514,7 @@ static bool radeon_mst_mode_fixup(struct drm_encoder *encoder, mst_enc = radeon_encoder->enc_priv; - mst_enc->pbn = drm_dp_calc_pbn_mode(adjusted_mode->clock, bpp); + mst_enc->pbn = drm_dp_calc_pbn_mode(adjusted_mode->clock, bpp, false); mst_enc->primary->active_device = mst_enc->primary->devices & mst_enc->connector->devices; DRM_DEBUG_KMS("setting active device to %08x from %08x %08x for encoder %d\n", diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 2ba6253ea6d3..9116b2c95239 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -610,8 +610,7 @@ bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr, struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); -int drm_dp_calc_pbn_mode(int clock, int bpp); - +int drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc); bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int slots); From patchwork Thu Nov 7 15:32:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233201 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 C4EFE16B1 for ; Thu, 7 Nov 2019 15:32:32 +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 ACA78214D8 for ; Thu, 7 Nov 2019 15:32:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACA78214D8 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 568376E0FD; Thu, 7 Nov 2019 15:32:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790082.outbound.protection.outlook.com [40.107.79.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC0F36F700; Thu, 7 Nov 2019 15:32:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xuz3Uq2WHWAoP42W8k7UdGzoX/UxLpCCybjvwokuJcgk3eZpeQljdEOwlDS3B10BEbPq6YZ6Dxh1cTF79bIEz7XRCRO3GhccJW9BQ6ZSUgur3eUIynISlWD2mTLcCOFKzkmWRn1wFllNDex16h8QFbWrAUnLc5kSenNJ7PLe/FfuHKYyZGjJqaxEtXXI1GCaN2hrMMcM9GYjr4HotwhakrUcZ/vqfeUL5s2BoAG0Ime4gMR7FQ23F/pVZI3XcEalgAwkvdywNcSZc00cbtl3BPNpzYzcp37B7hsIXhKqgVOp3vXv8u0dhFoGULJfhjcqm6dVVuU8YZLQ1LLui9biYA== 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=XtzNhoT5WrJIF43FzY54g/YC8FN7tJzave3qPSMHVEs=; b=AZAwIXkgbGc0Ng4LmDPo02z7aUrmBNhcXKVW3+qyd2CYJuT9tHxsqUT8WSBrbhRyOtxhElur8cs9Jfr+bZ60LAER7zqhxYnOzOJHIG2EkDoFus5tYPnjzMHP23VN8roG/tm/q8etHFEahEN5b0mmYm+yCXIzf7qTpx2G93y3ZHpiFkHaxi3sQlTPRJUmboUoQW1S6HdcH63UrQv6b0EOu+MOIp8RDNYvXW3ywuvpEr6gSivLYnZAlSFUKiHE8yECZM3Iyp2MH2YUC2nLSm5D2Wc4Gx2YnOfMeEXjPpjqcNn8ZvmVkmN8k6Z5641vLdpD5vwUCF3eTljxa79Vm+O+yQ== 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 MWHPR12CA0038.namprd12.prod.outlook.com (2603:10b6:301:2::24) by CH2PR12MB4103.namprd12.prod.outlook.com (2603:10b6:610:7e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Thu, 7 Nov 2019 15:32:27 +0000 Received: from DM3NAM03FT041.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by MWHPR12CA0038.outlook.office365.com (2603:10b6:301:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT041.mail.protection.outlook.com (10.152.83.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:26 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:20 -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; Thu, 7 Nov 2019 09:32:19 -0600 From: To: Subject: [PATCH v6 02/13] drm/dp_mst: Parse FEC capability on MST ports Date: Thu, 7 Nov 2019 10:32:01 -0500 Message-ID: <20191107153212.1145-3-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(396003)(136003)(346002)(376002)(39860400002)(428003)(199004)(189003)(70206006)(54906003)(50466002)(6666004)(86362001)(316002)(51416003)(70586007)(11346002)(8936002)(7696005)(76176011)(47776003)(2876002)(2616005)(50226002)(16586007)(48376002)(486006)(305945005)(5660300002)(4326008)(476003)(126002)(6916009)(1076003)(8676002)(426003)(81166006)(186003)(81156014)(2906002)(53416004)(2351001)(26005)(36756003)(336012)(446003)(450100002)(478600001)(356004)(16060500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR12MB4103; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 719ae963-7522-4ba1-b1fa-08d76397b1af X-MS-TrafficTypeDiagnostic: CH2PR12MB4103: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BIrgLKiO9PDgadwq247Dn3RGPnjkjtC7be9DkgINzLRSf5M7ie5Yothux9KQXx51EhUzwGOuAjeyj0x7x3+FjwjjqjgChCNWczWAzrBo8FWtZxGfrerPYp/9zgrlRc9DfTYc18+utu0hYhfbl6d1vvrEYOKc4zanSPB8n8NN4PZIuaqYPdKqrTfYeITgG11zGE/EedCNFXlnvr0d5h7wnt5Ca0r6Eqz6EzibCELuBNp9MWyfqWKmDWxGEh4HLMtTMeMY+oz+lglGtAz2jnRgheMJE5YH3g/tLQ73q8A46ohRElLLyhp/R7Y74kuIPedL4mrmmWWAGT9gUEkAp66I+WSLLQO2vs2RzOAphkg/8fFqVEC1fuKsRrXMQ5PhWMHlVVahQo0P5m0wwvX84lu68MePRMMmuVASSlW9OqiSSRBuDYMr1k1c5Y3cwj3gCU2Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:26.7646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 719ae963-7522-4ba1-b1fa-08d76397b1af 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4103 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=XtzNhoT5WrJIF43FzY54g/YC8FN7tJzave3qPSMHVEs=; b=SowS2RKy2FVKp3qA3DB0el1QXYkTVNVtSCLVduPv08ZeiLoyjZZFHKiMgA1giGcvT8bHZvN2TAJ+V0uuBfj0ZfqMkvWfisyuBODYoy4dysBhfuvDHzasK4uBmsTD+wDv1FyaHTl/q9GCfzauxqyyQLkcuQqpDjfB9uXtxkOIIP8= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis As of DP1.4, ENUM_PATH_RESOURCES returns a bit indicating if FEC can be supported up to that point in the MST network. The bit is the first byte of the ENUM_PATH_RESOURCES ack reply, bottom-most bit (refer to section 2.11.9.4 of DP standard, v1.4) That value is needed for FEC and DSC support Store it on drm_dp_mst_port Reviewed-by: Lyude Paul Reviewed-by: Harry Wentland Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ include/drm/drm_dp_mst_helper.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 3e7b7553cf4d..9f3604355705 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -553,6 +553,7 @@ static bool drm_dp_sideband_parse_enum_path_resources_ack(struct drm_dp_sideband { int idx = 1; repmsg->u.path_resources.port_number = (raw->msg[idx] >> 4) & 0xf; + repmsg->u.path_resources.fec_capable = raw->msg[idx] & 0x1; idx++; if (idx > raw->curlen) goto fail_len; @@ -2183,6 +2184,7 @@ static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, DRM_DEBUG_KMS("enum path resources %d: %d %d\n", txmsg->reply.u.path_resources.port_number, txmsg->reply.u.path_resources.full_payload_bw_number, txmsg->reply.u.path_resources.avail_payload_bw_number); port->available_pbn = txmsg->reply.u.path_resources.avail_payload_bw_number; + port->fec_capable = txmsg->reply.u.path_resources.fec_capable; } } diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 9116b2c95239..f113ae04fa88 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -108,6 +108,8 @@ struct drm_dp_mst_port { * audio-capable. */ bool has_audio; + + bool fec_capable; }; /** @@ -312,6 +314,7 @@ struct drm_dp_port_number_req { struct drm_dp_enum_path_resources_ack_reply { u8 port_number; + bool fec_capable; u16 full_payload_bw_number; u16 avail_payload_bw_number; }; From patchwork Thu Nov 7 15:32:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233219 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 D373816B1 for ; Thu, 7 Nov 2019 15:32:56 +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 BB883214D8 for ; Thu, 7 Nov 2019 15:32:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB883214D8 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 6ED856F71A; Thu, 7 Nov 2019 15:32:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740083.outbound.protection.outlook.com [40.107.74.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31E186F700; Thu, 7 Nov 2019 15:32:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TmVBJeFEUepNrWX4m1s/oTM7kV2rqEECBfq195Z9SW5yABDLQRQzZQ09Xd+VyjV4oZBRKTl1s2xFBoEWH0pDUtBGe0u6Z9T1zZ9rV0wBLP35aa4tU3v6LLamVD+yc7g7nqesNwnZeZW2ptf1+9InSNwFrqQ0BmA0JHZYnrCb4suN+auxK2/SMEXDvovYiYZG5RQuqo+7BvW6H4gHBa2bb5+JVdkB+j0sJqOdGH3WIJ2aVyb0Kq9rjY4eNSPo+nA6lzvdq2lR4LPjdZ1JrEotcvz6KWJEt5xxlXpXYhg3zvWWLTTyN7hIsRQB0pJ8KKQ3amKHJ2rLjEFpwzvRDh2Bfg== 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=f+odq4Dv1isf6j3RciXnLyn+hJEA5951qCkgEInRvs0=; b=U9wvMNfs85CzIFUhrysTOullRfxAGx7fbsUvdK8RkIGIfz33pP48I/+KK32L8U/w8PHyf/Tl2M/tdclgOrfMSEKMrQfELjunhgIVMwdal+rTbjPMbNPiZCxW7u8mlZNQ5S7tKkisIpsyZR2riY/e9zRJsWIlZcsUpVZpqFGCRecSofG9T2xXXdJj2/YT8gmXKy73suyTtyaAg12e7gshm99twHcQiC4x0VfSV/ho6yw3UJxY50WTvI/yj/KY66su2CZc6GpZhjOYTivM6Bxjk55Ee9AKES0kxZCFJLU4/1nU98i0pesspc/v7eJUFOqqWagJbtxFIV7o7+zHVd0ABw== 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 MWHPR12CA0038.namprd12.prod.outlook.com (2603:10b6:301:2::24) by BY5PR12MB4178.namprd12.prod.outlook.com (2603:10b6:a03:20e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:28 +0000 Received: from DM3NAM03FT041.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by MWHPR12CA0038.outlook.office365.com (2603:10b6:301:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT041.mail.protection.outlook.com (10.152.83.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:20 -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; Thu, 7 Nov 2019 09:32:20 -0600 From: To: Subject: [PATCH v6 03/13] drm/dp_mst: Add MST support to DP DPCD R/W functions Date: Thu, 7 Nov 2019 10:32:02 -0500 Message-ID: <20191107153212.1145-4-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(136003)(376002)(396003)(346002)(428003)(199004)(189003)(50226002)(6666004)(54906003)(70586007)(1076003)(356004)(47776003)(50466002)(4326008)(316002)(2351001)(5660300002)(48376002)(2906002)(70206006)(7696005)(51416003)(6916009)(16586007)(336012)(76176011)(478600001)(486006)(446003)(26005)(186003)(426003)(8676002)(53416004)(14444005)(81166006)(81156014)(2876002)(11346002)(126002)(86362001)(450100002)(36756003)(305945005)(8936002)(2616005)(476003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY5PR12MB4178; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00e595f7-b83b-4c17-5182-08d76397b249 X-MS-TrafficTypeDiagnostic: BY5PR12MB4178: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WDpYheODRx9oteocTKvUt3GHYfkROOXRdMZPXL20CCWaEvr591QCmUmzsLI2NqFATgjoqPeWEr0ZIHEEhFtElpLIgfJ3Hu0CS+EMSsiK+FDXVlgWjjVlgFC1dRkZmKxkR7SySr4Php4EzmAvwb0LAKNnWXo36IdjE/1q9f4dgJCfZYovODB+0FzC4ZviE3T2cwK1SMp/u9LpsTM3fFnjMRF97ziEdZSw3gcCffZMjdNgGTIwOOI1T21F62oiD7eAmgf9hi1jjZqNGCf8x9PgNIlF/SNMAXKplT94lb4mOe6MKmfrdJeSCN6vvk0EO2tiRKwMnVATiJb3b32g+NPEfx9Bob0T49BrisSxOHkQeCcjIK4leORHh/coEen+q7IMnexpI4H0GYI7mxWZACHttDyAXkcMDWaCV84p98D0DQrhPKvjjUT3pU47FXNiwYIK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:27.7714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00e595f7-b83b-4c17-5182-08d76397b249 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4178 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=f+odq4Dv1isf6j3RciXnLyn+hJEA5951qCkgEInRvs0=; b=zuLXd/yMBnNB6QX/N2ktOZEGikNu8XkQxre074l2fHc6K1921lzL/+4Ld0SeNw4rIHbvpbXKG7Xu8D9/Bi/tM/m69ngcw1he2mNXfhL9SrYrfHei7YGzNrvNETeuPXA4pfTELfN3uHEHcxxHoI4KASdWAplCdffk7R05WcAU8s8= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis Instead of having drm_dp_dpcd_read/write and drm_dp_mst_dpcd_read/write as entry points into the aux code, have drm_dp_dpcd_read/write handle both. This means that DRM drivers can make MST DPCD read/writes. v2: Fix spacing v3: Dump dpcd access on MST read/writes v4: Fix calling wrong function on DPCD write Reviewed-by: Lyude Paul Reviewed-by: Harry Wentland Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++---------- drivers/gpu/drm/drm_dp_helper.c | 31 +++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c index 0cfb386754c3..2510717d5a08 100644 --- a/drivers/gpu/drm/drm_dp_aux_dev.c +++ b/drivers/gpu/drm/drm_dp_aux_dev.c @@ -163,11 +163,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to) break; } - if (aux_dev->aux->is_remote) - res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf, - todo); - else - res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo); + res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo); if (res <= 0) break; @@ -215,11 +211,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from) break; } - if (aux_dev->aux->is_remote) - res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, - todo); - else - res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo); + res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo); if (res <= 0) break; diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index ffc68d305afe..af1cd968adfd 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "drm_crtc_helper_internal.h" @@ -251,7 +253,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, /** * drm_dp_dpcd_read() - read a series of bytes from the DPCD - * @aux: DisplayPort AUX channel + * @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to read * @buffer: buffer to store the register values * @size: number of bytes in @buffer @@ -280,13 +282,18 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, * We just have to do it before any DPCD access and hope that the * monitor doesn't power down exactly after the throw away read. */ - ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer, - 1); - if (ret != 1) - goto out; + if (!aux->is_remote) { + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, + buffer, 1); + if (ret != 1) + goto out; + } - ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer, - size); + if (aux->is_remote) + ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size); + else + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, + buffer, size); out: drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret); @@ -296,7 +303,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read); /** * drm_dp_dpcd_write() - write a series of bytes to the DPCD - * @aux: DisplayPort AUX channel + * @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to write * @buffer: buffer containing the values to write * @size: number of bytes in @buffer @@ -313,8 +320,12 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, { int ret; - ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, - size); + if (aux->is_remote) + ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size); + else + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, + buffer, size); + drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret); return ret; } From patchwork Thu Nov 7 15:32:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233221 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 3EE141599 for ; Thu, 7 Nov 2019 15:32:58 +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 27097214D8 for ; Thu, 7 Nov 2019 15:32:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27097214D8 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 A44B16F720; Thu, 7 Nov 2019 15:32:39 +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-eopbgr680070.outbound.protection.outlook.com [40.107.68.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 506F889CF9; Thu, 7 Nov 2019 15:32:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TRz1u8Xn+1UbiZocoJCVX64cpaZkYhVGwfLGAB4UD0CVZMISV9rEljqbXm0OltvMr8HAYkcgIHJqg6zJknhnXlmpB39Ew7ONukjD6Yqgd8b4jCGlfvi2LZDtD8GAZRTTQOfsQzBwJllqmZA5Cau39kgNH9hwi8J34sPXrDxgE+FJZPoOvIQEtc+Wg3jG4RTkfoqDScp65ulhhm7hsLxLRI5I0SHq3eeJI0G5WdideJ2BPhDudlBF6YYcLR0nXkTLkkiywPRoBaB7J+0dfssaNh940xMOHjhSFwgzo3N639QfmpG3e84oBIVB1eagKGtBHTFMxcSqjKqncA7eYXRP9A== 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=kwqvFUkrOJvpByqdYnm2zl3GdfUXOFTh/JeJzwsgGrg=; b=UPfsCIlNRCM+ZM/7tXtYlIogBaIlV8vS9DPs3zSZM3T7Ecxo7xSvw8I99c+PT55BMTKR+NOY7NQWKKh4vw7hbIZzxZByTV0qM6WL4vNEEZ+c4/0MAghGH+KuUoINX3PRYIFnvPReRkf+hdLSrMZJY43jSbFY2d9i60qG3gUE0niqc6Y2VYDgUrEKuXJJe4+0ESOH00flaBAuR6iegDv5S0gn5upjhn/DCdEj6SZHjAz+iErbM9N9HLBVTd7r7W4SdiQCTvmdxqRvMVEsSe+erVrk0nf0zTuV9LN97PkjN4eilZJkegP2GaFCRdmS+G4P4AfVUcRQvQ7sG5HD8fskGQ== 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 MWHPR12CA0038.namprd12.prod.outlook.com (2603:10b6:301:2::24) by MN2PR12MB4191.namprd12.prod.outlook.com (2603:10b6:208:1d3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.24; Thu, 7 Nov 2019 15:32:28 +0000 Received: from DM3NAM03FT041.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::206) by MWHPR12CA0038.outlook.office365.com (2603:10b6:301:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT041.mail.protection.outlook.com (10.152.83.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:21 -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; Thu, 7 Nov 2019 09:32:21 -0600 From: To: Subject: [PATCH v6 04/13] drm/dp_mst: Fill branch->num_ports Date: Thu, 7 Nov 2019 10:32:03 -0500 Message-ID: <20191107153212.1145-5-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(376002)(346002)(39860400002)(396003)(136003)(428003)(199004)(189003)(450100002)(305945005)(356004)(6666004)(126002)(476003)(2616005)(14444005)(11346002)(316002)(486006)(54906003)(426003)(478600001)(76176011)(7696005)(16586007)(5660300002)(70206006)(70586007)(50226002)(86362001)(51416003)(2906002)(446003)(1076003)(81156014)(81166006)(336012)(8676002)(2351001)(50466002)(48376002)(8936002)(4326008)(53416004)(2876002)(186003)(6916009)(47776003)(36756003)(26005)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4191; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c9db646-c18d-49bf-e8f0-08d76397b2ae X-MS-TrafficTypeDiagnostic: MN2PR12MB4191: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Azgutp47TgvCqHY6e2i9ijeffd76RyjZQBhCaFfGqU5XzW5gk61vp4+4PdVO2Y1M1l6r7RVDCEUAcIaPxOZ8srLTpJHZrtfDaz8a2Jr79E18L8Plxz66+Xnaae/xh6PoBh0hV8n6mOclT7J81CNcpxK0/gl0w5MWS+c2fzkoQiXX9FFz+qjc9zDfj63FSBiIWzt2PYnWPj54LCjt63U7sKySmshgJY0tLu8ZuB4oIsIiAVvTiIV5tdhNestOUkX9gjxARsH8nR34+KBaqyXWH5PCDEKVCLksy+AmM11q7/gj+vKL5dul03jVicFVQ7/sHiAf5Rmc0Tl96qF8P5tgRwdS0IxaToQXf+GjTZzBM26/GIMStswCTgVhKM3/ceDGfB1yArNAIR37L8xUN8EV8ei8Odaw7og36BLawULsmG+xPNL5FXkrJ2yJDpJAOBGU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:28.4360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c9db646-c18d-49bf-e8f0-08d76397b2ae 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4191 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=kwqvFUkrOJvpByqdYnm2zl3GdfUXOFTh/JeJzwsgGrg=; b=NocxKlSxv/aHhg4Z+yIs9NzF3H0oaZH7HUn95j5SNy99qC+ZSdKW7l5z5x1ROOCNHhi/2Rv5Aw0VPoz8WNxyDW/p9061oB0CXoImZoQPgeRhmJ16LJx9r8UuCFsaWFkeR5qglR+CQfMfUzLuKTS8SHivH1xkYJvgbrRoI6tt47A= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis This field on drm_dp_mst_branch was never filled It is initialized to zero when the port is kzallocced. When a port is added to the list, increment num_ports, and when a port is removed from the list, decrement num_ports. v2: remember to decrement on port removal v3: don't explicitly init to 0 Reviewed-by: Lyude Paul Reviewed-by: Harry Wentland Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 9f3604355705..502923c24450 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1669,6 +1669,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, mutex_lock(&mstb->mgr->lock); drm_dp_mst_topology_get_port(port); list_add(&port->next, &mstb->ports); + mstb->num_ports++; mutex_unlock(&mstb->mgr->lock); } @@ -1703,6 +1704,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, /* remove it from the port list */ mutex_lock(&mstb->mgr->lock); list_del(&port->next); + mstb->num_ports--; mutex_unlock(&mstb->mgr->lock); /* drop port list reference */ drm_dp_mst_topology_put_port(port); From patchwork Thu Nov 7 15:32:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233215 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 45ECE1599 for ; Thu, 7 Nov 2019 15:32:53 +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 2DC27214D8 for ; Thu, 7 Nov 2019 15:32:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DC27214D8 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 B51636F70F; Thu, 7 Nov 2019 15:32:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690084.outbound.protection.outlook.com [40.107.69.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2252A6F708; Thu, 7 Nov 2019 15:32:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g+qSW6rGkVsMJTh2V+c4JtQeEnbL5Yp2nLvuLzgEbSg4DJB5QzYcsj3lAJX2V2OQ+JImEG0USVAUZaFdwShxDMgk6nArIyyXfasZpoFy8a4pM6GUlBliW0zFPS+4jgFBexsigipIpsk5mWIIbBjsTP2JXVLtz2DegbJ1YYxWlgcFR/GlX9m1Ca+uDJrhx+zDRCBZkBu9PhKcj1hqdEIme4eH9jA8bf4U0Aac/E20Yx12T/2ywnL4dBCSUdo8HX6/8tlHBE3LcGzsANEcXJmq8ftXDP+YcbqF0PkW9l6sZVIiNjR4j9qZ4kDAUPtFcTmleGJpumMSC16iNGqaKpWJ1g== 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=1JgIGw5uDAPqC+2ghLVNL6FJSl4yKmT3Mvd49Z942tQ=; b=dhnC/1wxMxIavbhsLr/43LgeH8kkHZTTvoBGKHEZWcWRNHYcZbovJlxbfgJalpz4b1xELcMlFnvKv0CyW5gXFMmFJZ6Dn+0AO7C7wvO9Hbp+FI8mH/wpHddNZodJqhxmMRPEXB2YS6Ua0y7ZoLG3KfudfJWFlZFmtSJyM54XLVdzRYBbhIqxbRxYpalBAeArMEJuCgmOe2KKzyxiJNpGWVKDovlatFCAT8uF2NlKp3npV02hAxhr1jWFuCTyns4lSaK85nLbjvNSDjx8zUG2sfF47XlnpYBQ0DfQ7BHTk/2EYV8N9kOesVjaWsk8XpukJffD7eKf8RsM8LiFLHpKMA== 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 MWHPR12CA0031.namprd12.prod.outlook.com (2603:10b6:301:2::17) by CY4PR12MB1638.namprd12.prod.outlook.com (2603:10b6:910:10::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:29 +0000 Received: from DM3NAM03FT041.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by MWHPR12CA0031.outlook.office365.com (2603:10b6:301:2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:29 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT041.mail.protection.outlook.com (10.152.83.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:29 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Nov 2019 09:32:22 -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; Thu, 7 Nov 2019 09:32:22 -0600 From: To: Subject: [PATCH v6 05/13] drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux Date: Thu, 7 Nov 2019 10:32:04 -0500 Message-ID: <20191107153212.1145-6-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(346002)(376002)(396003)(136003)(428003)(189003)(199004)(11346002)(2876002)(126002)(426003)(86362001)(26005)(446003)(486006)(186003)(5024004)(14444005)(53416004)(81156014)(81166006)(8676002)(8936002)(476003)(50226002)(2616005)(305945005)(450100002)(36756003)(50466002)(4326008)(47776003)(316002)(2351001)(5660300002)(6666004)(356004)(1076003)(54906003)(70586007)(7696005)(51416003)(16586007)(6916009)(76176011)(478600001)(336012)(48376002)(70206006)(2906002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1638; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d386fbc0-cb5e-450f-1a5d-08d76397b32a X-MS-TrafficTypeDiagnostic: CY4PR12MB1638: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZghQ7fGzU8Ttz1EiazkLQth/db7nsW9CeZcW5fGh8Febmkus5TUqZrcuID12xLBt5XhhpIJSBbkmE8zIHc/qvLKcnjIoWcMliIgD52dQVUa25E7NK8yMAEv9jg8bE9Poj6OwolV8fGYdwQW9fvSpl9tS8hBIAZG8T7Mf/9S5lg5FUlInLipi4YYretRIgWT9UV12JIHU9EnGt2MlklmLYwTu2ZE9Y5yi4OXBe/tmhVJd/6u1IAqxz/xxKetIjwib+yNDKX/HJuHIaF4yjue2ZYj+UIFMcNploCbAAU7I6wX3vcQQH3iw3cR1Y7sko6Sl2UXMCI9TmjBswEJXbZGFX5rqtTV4GL/d5BO/LY61TKdwe4jEP07osXw0W7hmaFj3OjZ4JNZe0ZexbOhIvIkBeBh084itIMpCIxm8AqYFurg+THUQuCdi9f9/ZCpwnbgo X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:29.2436 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d386fbc0-cb5e-450f-1a5d-08d76397b32a 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1638 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=1JgIGw5uDAPqC+2ghLVNL6FJSl4yKmT3Mvd49Z942tQ=; b=VO06zxqP7Ie7qlkpZ62nudJii8vHOkVeTYQbgAXumjDQCiZHqlYOcsHkql+rwtlo90rSFWwe72KtPEjkSN59YSAdfv98cMU20pyV+DMDRVkQJTW+5KPpcOZxSzl3EQDtucJXYsLE9h/210rhSoVLDt9k7mcNMNlH+Ezm1ep0Wtw= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis Add drm_dp_mst_dsc_aux_for_port. To enable DSC, the DSC_ENABLED register might have to be written on the leaf port's DPCD, its parent's DPCD, or the MST manager's DPCD. This function finds the correct aux for the job. As part of this, add drm_dp_mst_is_virtual_dpcd. Virtual DPCD is a DP feature new in DP v1.4, which exposes certain DPCD registers on virtual ports. v2: Remember to unlock mutex on all paths v3: Refactor to match coding style and increase brevity Reviewed-by: Lyude Paul Reviewed-by: Wenjing Liu Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_mst_topology.c | 127 ++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 2 + 2 files changed, 129 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 502923c24450..d8f9ba27b559 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4150,3 +4150,130 @@ static void drm_dp_mst_unregister_i2c_bus(struct drm_dp_aux *aux) { i2c_del_adapter(&aux->ddc); } + +/** + * drm_dp_mst_is_virtual_dpcd() - Is the given port a virtual DP Peer Device + * @port: The port to check + * + * A single physical MST hub object can be represented in the topology + * by multiple branches, with virtual ports between those branches. + * + * As of DP1.4, An MST hub with internal (virtual) ports must expose + * certain DPCD registers over those ports. See sections 2.6.1.1.1 + * and 2.6.1.1.2 of Display Port specification v1.4 for details. + * + * May acquire mgr->lock + * + * Returns: + * true if the port is a virtual DP peer device, false otherwise + */ +static bool drm_dp_mst_is_virtual_dpcd(struct drm_dp_mst_port *port) +{ + struct drm_dp_mst_port *downstream_port; + + if (!port || port->dpcd_rev < DP_DPCD_REV_14) + return false; + + /* Virtual DP Sink (Internal Display Panel) */ + if (port->port_num >= 8) + return true; + + /* DP-to-HDMI Protocol Converter */ + if (port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV && + !port->mcs && + port->ldps) + return true; + + /* DP-to-DP */ + mutex_lock(&port->mgr->lock); + if (port->pdt == DP_PEER_DEVICE_MST_BRANCHING && + port->mstb && + port->mstb->num_ports == 2) { + list_for_each_entry(downstream_port, &port->mstb->ports, next) { + if (downstream_port->pdt == DP_PEER_DEVICE_SST_SINK && + !downstream_port->input) { + mutex_unlock(&port->mgr->lock); + return true; + } + } + } + mutex_unlock(&port->mgr->lock); + + return false; +} + +/** + * drm_dp_mst_dsc_aux_for_port() - Find the correct aux for DSC + * @port: The port to check. A leaf of the MST tree with an attached display. + * + * Depending on the situation, DSC may be enabled via the endpoint aux, + * the immediately upstream aux, or the connector's physical aux. + * + * This is both the correct aux to read DSC_CAPABILITY and the + * correct aux to write DSC_ENABLED. + * + * This operation can be expensive (up to four aux reads), so + * the caller should cache the return. + * + * Returns: + * NULL if DSC cannot be enabled on this port, otherwise the aux device + */ +struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port) +{ + struct drm_dp_mst_port *immediate_upstream_port; + struct drm_dp_mst_port *fec_port; + + if (!port) + return NULL; + + if (port->parent) + immediate_upstream_port = port->parent->port_parent; + else + immediate_upstream_port = NULL; + + fec_port = immediate_upstream_port; + while (fec_port) { + /* + * Each physical link (i.e. not a virtual port) between the + * output and the primary device must support FEC + */ + if (!drm_dp_mst_is_virtual_dpcd(fec_port) && + !fec_port->fec_capable) + return NULL; + + fec_port = fec_port->parent->port_parent; + } + + /* DP-to-DP peer device */ + if (drm_dp_mst_is_virtual_dpcd(immediate_upstream_port)) { + u8 upstream_dsc; + u8 endpoint_dsc; + u8 endpoint_fec; + + if (drm_dp_dpcd_read(&port->aux, + DP_DSC_SUPPORT, &endpoint_dsc, 1) < 0) + return NULL; + if (drm_dp_dpcd_read(&port->aux, + DP_FEC_CAPABILITY, &endpoint_fec, 1) < 0) + return NULL; + if (drm_dp_dpcd_read(&immediate_upstream_port->aux, + DP_DSC_SUPPORT, &upstream_dsc, 1) < 0) + return NULL; + + /* Enpoint decompression with DP-to-DP peer device */ + if ((endpoint_dsc & DP_DSC_DECOMPRESSION_IS_SUPPORTED) && + (endpoint_fec & DP_FEC_CAPABLE) && + (upstream_dsc & 0x2) /* DSC passthrough */) + return &port->aux; + + /* Virtual DPCD decompression with DP-to-DP peer device */ + return &immediate_upstream_port->aux; + } + + /* Virtual DPCD decompression with DP-to-HDMI or Virtual DP Sink */ + if (drm_dp_mst_is_virtual_dpcd(port)) + return &port->aux; + + return NULL; +} +EXPORT_SYMBOL(drm_dp_mst_dsc_aux_for_port); diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index f113ae04fa88..4cf738545dfb 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -673,6 +673,8 @@ int __must_check drm_dp_mst_atomic_check(struct drm_atomic_state *state); void drm_dp_mst_get_port_malloc(struct drm_dp_mst_port *port); void drm_dp_mst_put_port_malloc(struct drm_dp_mst_port *port); +struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port); + extern const struct drm_private_state_funcs drm_dp_mst_topology_state_funcs; /** From patchwork Thu Nov 7 15:32:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233203 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 17E2F1599 for ; Thu, 7 Nov 2019 15:32:36 +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 F3AB3214D8 for ; Thu, 7 Nov 2019 15:32:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3AB3214D8 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 DA7FC89CF9; Thu, 7 Nov 2019 15:32:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820058.outbound.protection.outlook.com [40.107.82.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 743696F701; Thu, 7 Nov 2019 15:32:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KTo6xGiZkFRU5pFVYKtAAqMWnEotdcgOmCJ37w/TytzMb78mTp6FSpTmnLuQ4q8zkGnPNHRZyhE7o+khMQCAg4PoGOyyoEDzEdIjYlhfn6OU/RcVjSRFSWblUwVn5zJFr6h66O5y4JROvOtldixFjiCcE+ZkXs7sY/PD3CyNg3UkPcfKtOy4F/WldCwmaA7dC6/ACAAuSPWlcNzcSYOddZoFGTLRVyki1ylYVKT6rEa5PaUgXwzc9GykQdx4q136FfCzdngZBCAMOmTzN/b1guRFm4YXWcEyUxTlGZeQqPfOc8sL9jUXz5ZaI0Uty+mJAXUP7SYpa1+V4qhoD4nnew== 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=DQljAUWyBxW1++PbqRv2rxF84kNm04bK9HEjbd+77j8=; b=GRruaVipGQfHrsX0bIZhU8dHDPbZatb3Yq1q2OYkNCO3W0imzdhW2rXJbTILN5BH5PwWv0H+Ou1+3RIs+QIG2cnLr5sgRUPwW0MDaM7FJqxKSV8zpdd8ygNSe/BYtbbhzdk7YKuw6PnLmGv3FujqicTpN2I6PMQ7I4mOrdeF0E2uLokopsTcPDPo79Q7X7em0Qdi7X9HTCrPSv+JlvY0FpHOGf0UoEUftgG6A+QBFE70SOOex3lsUki43WFN78tqN/76vdcYwG0QufuDNilcxR0p380Mh8NeVeDIYe4pPMZPAuTeskQ/wJFqnRykEI4Ul/4DT3/E5wJExvsfDYuZVg== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by MN2PR12MB3488.namprd12.prod.outlook.com (2603:10b6:208:ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Thu, 7 Nov 2019 15:32:27 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:26 +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; Thu, 7 Nov 2019 09:32:23 -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; Thu, 7 Nov 2019 09:32:23 -0600 From: To: Subject: [PATCH v6 06/13] drm/dp_mst: Add new quirk for Synaptics MST hubs Date: Thu, 7 Nov 2019 10:32:05 -0500 Message-ID: <20191107153212.1145-7-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(376002)(136003)(396003)(346002)(39860400002)(428003)(199004)(189003)(50466002)(6666004)(36756003)(450100002)(86362001)(446003)(11346002)(126002)(16586007)(8936002)(76176011)(476003)(48376002)(486006)(51416003)(7696005)(2906002)(336012)(4326008)(426003)(2876002)(2616005)(305945005)(47776003)(2351001)(6916009)(53416004)(14444005)(1076003)(356004)(316002)(54906003)(70586007)(186003)(70206006)(478600001)(5660300002)(81156014)(50226002)(81166006)(8676002)(26005)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3488; 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: ac408041-4778-48a5-11d3-08d76397b1c8 X-MS-TrafficTypeDiagnostic: MN2PR12MB3488: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 51gtIpmdZN0NizWlBDGJZMdHr8e8gn1I6WHceS5us2tHyx+KIukzqU6gf/oD34uLc0AwJTqTUy3lzTaRzfx+KDlWid1jnD2p9zsuMc6D6S4KgkRrsEjXeaT1BJdGAdir4x5WgkUKjRrarhFWvI0VqP0QwB3hFA/+akH7vXbNiOk9t9xVpfpobMjEZdXbe67Qj/+LwJ2afMq7EqfzFdfMpLm0lCUqGsiyOHviWWGwsCYSRDI/UeGnCcfo2VjF0+SiaAkrlFYfBK/1uSwcBTYkXrGca/CoTEocwY86aNReQUYOaIt/E0xwTbug6VME0SHtuDFSdyF1bZboM/7/wbRfpTXp99mpJpqtK5vQ4sxkUW+WImUr1gx/vGrSeQic5w4NssCHgskxx6MNa0RZrnKXDqxrqre8gNjVSS1m6Trm82XGTEfai8n1UtHGS9goWgD2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:26.9174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac408041-4778-48a5-11d3-08d76397b1c8 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: MN2PR12MB3488 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=DQljAUWyBxW1++PbqRv2rxF84kNm04bK9HEjbd+77j8=; b=wfXr+6cyNZPEawabTPacDf0b+QL0fnHDqXwBaxO60b4RVHAFFyaF9q/wTyk3ItpKsG9ImuM/0I38xs++hF2j/M/+4M9j5gFnwk6BjBkttbsHEijCii7m6+EsQdJ9wsVJKu9u42+LwJvEVHReGaIYxtEXm7GGxyJd1EMe6sRWa+M= 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 , Mikita Lipski , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Mikita Lipski Synaptics DP1.4 hubs (BRANCH_ID 0x90CC24) do not support virtual DPCD registers, but do support DSC. The DSC caps can be read from the physical aux, like in SST DSC. These hubs have many different DEVICE_IDs. Add a new quirk to detect this case. Reviewed-by: Wenjing Liu Reviewed-by: Lyude Paul Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_helper.c | 2 ++ drivers/gpu/drm/drm_dp_mst_topology.c | 27 +++++++++++++++++++++++++++ include/drm/drm_dp_helper.h | 7 +++++++ 3 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index af1cd968adfd..02fa8c3d9a82 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -1271,6 +1271,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = { { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) }, /* CH7511 seems to leave SINK_COUNT zeroed */ { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) }, + /* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */ + { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) }, }; #undef OUI diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index d8f9ba27b559..d5df02315e14 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4222,6 +4222,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port) { struct drm_dp_mst_port *immediate_upstream_port; struct drm_dp_mst_port *fec_port; + struct drm_dp_desc desc = { 0 }; if (!port) return NULL; @@ -4274,6 +4275,32 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port) if (drm_dp_mst_is_virtual_dpcd(port)) return &port->aux; + /* + * Synaptics quirk + * Applies to ports for which: + * - Physical aux has Synaptics OUI + * - DPv1.4 or higher + * - Port is on primary branch device + * - Not a VGA adapter (DP_DWN_STRM_PORT_TYPE_ANALOG) + */ + if (!drm_dp_read_desc(port->mgr->aux, &desc, true)) + return NULL; + + if (drm_dp_has_quirk(&desc, DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) && + port->mgr->dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14 && + port->parent == port->mgr->mst_primary) { + u8 downstreamport; + + if (drm_dp_dpcd_read(&port->aux, DP_DOWNSTREAMPORT_PRESENT, + &downstreamport, 1) < 0) + return NULL; + + if ((downstreamport & DP_DWN_STRM_PORT_PRESENT) && + ((downstreamport & DP_DWN_STRM_PORT_TYPE_MASK) + != DP_DWN_STRM_PORT_TYPE_ANALOG)) + return port->mgr->aux; + } + return NULL; } EXPORT_SYMBOL(drm_dp_mst_dsc_aux_for_port); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 5a795075d5da..5ff59e9bbbb1 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1464,6 +1464,13 @@ enum drm_dp_quirk { * The driver should ignore SINK_COUNT during detection. */ DP_DPCD_QUIRK_NO_SINK_COUNT, + /** + * @DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD: + * + * The device supports MST DSC despite not supporting Virtual DPCD. + * The DSC caps can be read from the physical aux instead. + */ + DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD, }; /** From patchwork Thu Nov 7 15:32:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233207 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 B29F71599 for ; Thu, 7 Nov 2019 15:32:43 +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 9AD65214D8 for ; Thu, 7 Nov 2019 15:32:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AD65214D8 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 64B676F70A; Thu, 7 Nov 2019 15:32:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720076.outbound.protection.outlook.com [40.107.72.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id AFF066F705; Thu, 7 Nov 2019 15:32:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a3sUhOwkK2aBP7H524bUnBZDr6pRMBwSo3AHEwoA5oqJll0ijUF0lER/abRAKUJTuXqZB8PvIIp9XLnRzYIRzqPgGEF1T5px/P8Hy4FBUfldR3sQ13fqY7LTF/0z89pkMCoGUqgCtvYsn2UDHUO3NAEv8OjPDSrEXwO+Sv4TBlEea1UPeBQiB2jMz60cMUf+uQYKnFceveKVbhMHt3o0fCB249b3hevFRFF9Nj2TE4jJJxzncSQiAWTmER3lr/rEH92zR6xO4s/1ucl1JXloTrgiq0V6QV0WHfqpgbroXdUvQIv43uKVmCuyBypyqn3pOOqAPo/8maMUNBwbTjqYzQ== 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=6FFQGdxpYtvDLaxePo4O9o/GPtp4v66SFjBsgH2AV0k=; b=Zk1sVkhkBDdlE2mX3FaC0zUfwqxLS1jmNd17Lt5GeVN8IpxLw0Xhu1/VvTp47ulAeSkoJ6HidH5dHp9+9JKGW95BtIdtMRetPmxp8FauT08cdIuZZKpPbsEEnWmPTq+IqDV7lVohd19XTTtNwpzBqOzIuCsa8lmFhyZFiP+2O+imqi/YgYYToSD2c4M+rONU1b2uXIdXoqbA1UP11dTZio78Lo7ruMgk7U+RN2U1V9GhrNGGSOe7KvTYVsKSvNOi25OzOv9BIijCs7nIZ8q0kGqYZcXx8/CBR4SQaZ1yhCMzpZGpjzO30Hsjk5gqmv+RGXbXnDWvdIeV2eoNhi/NLw== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by DM5PR12MB1226.namprd12.prod.outlook.com (2603:10b6:3:75::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:27 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +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; Thu, 7 Nov 2019 09:32:24 -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; Thu, 7 Nov 2019 09:32:24 -0600 From: To: Subject: [PATCH v6 07/13] drm/amd/display: Initialize DSC PPS variables to 0 Date: Thu, 7 Nov 2019 10:32:06 -0500 Message-ID: <20191107153212.1145-8-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(376002)(136003)(39860400002)(428003)(199004)(189003)(6916009)(70586007)(5660300002)(70206006)(50226002)(305945005)(7696005)(86362001)(356004)(76176011)(446003)(486006)(51416003)(11346002)(2616005)(81166006)(476003)(426003)(2351001)(1076003)(6666004)(126002)(53416004)(186003)(336012)(26005)(4326008)(50466002)(478600001)(48376002)(36756003)(81156014)(8676002)(54906003)(2876002)(2906002)(16586007)(8936002)(450100002)(316002)(47776003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1226; 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: fce546b9-9626-45d2-e464-08d76397b21d X-MS-TrafficTypeDiagnostic: DM5PR12MB1226: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:345; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FYnZdVdlQLTxEdakDWQv6eqnKV3WGOgcFQw6tqa5k/WlmxW5v/BKqhq4Ig8CuGXIiT+ZSGJzB0cDW4egJsgeIyHiLHc0eRIT7HXDuRgz+9Wmjch0vupkoYEWS3cYT0ekY3YXvAYEMk16AQlahVaizXn22axu2tBpZzI6kTXjRdc+Bq6ZTtv1IBniNnk+DI5zZY26X1D0yR/iYaEAeiZJP+Jvy4/r5aZTC46cHZmOzp2WMgr3VKqnfjJTYc4JdjT/Q9GgtnyTNxHiX2fW61cDDdfJTsYywCDcVc72KGxTW+j9/GW4x/GbFPI9OHRkJOC4/G1hWDCAjrwA8Ffegze4JMEMYh/TY+FDzYZO2Mf5us/Uv4u0rIuOf9mfwAeaEP7pMIngaJ8jEGbJt3oar9ubfiqATucfUwfW3kQMgvNG0iwA/ZYZ1VNl1g5mXj1ba5Av X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:27.4748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fce546b9-9626-45d2-e464-08d76397b21d 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: DM5PR12MB1226 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=6FFQGdxpYtvDLaxePo4O9o/GPtp4v66SFjBsgH2AV0k=; b=wC7aodohsJJYBRP/De9W75ahwT2+tWh5ZXfqAaKlw93oSZ4ke/MsHLi4qasrbVDeq1FEbjyUI2o2KwW1e3ohrpRBuJ2/W5MpOm42qhQcX6XwQvNnqKBSykDJrU/n2KcC4b2LsQ/JRCPH5w2mvz8B4JuPurAwU5yaLhn7gUwXTr8= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis For DSC MST, sometimes monitors would break out in full-screen static. The issue traced back to the PPS generation code, where these variables were being used uninitialized and were picking up garbage. memset to 0 to avoid this Reviewed-by: Nicholas Kazlauskas Signed-off-by: David Francis --- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 3 +++ drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c index bb1e8e5b5252..a7f3a9ecc626 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c @@ -526,6 +526,9 @@ bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable) struct dsc_config dsc_cfg; uint8_t dsc_packed_pps[128]; + memset(&dsc_cfg, 0, sizeof(dsc_cfg)); + memset(dsc_packed_pps, 0, 128); + /* Enable DSC hw block */ dsc_cfg.pic_width = stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right; dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom; diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c index 0111545dac75..6bdfee20b6a7 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c @@ -206,6 +206,9 @@ static bool dsc2_get_packed_pps(struct display_stream_compressor *dsc, const str struct dsc_reg_values dsc_reg_vals; struct dsc_optc_config dsc_optc_cfg; + memset(&dsc_reg_vals, 0, sizeof(dsc_reg_vals)); + memset(&dsc_optc_cfg, 0, sizeof(dsc_optc_cfg)); + DC_LOG_DSC("Getting packed DSC PPS for DSC Config:"); dsc_config_log(dsc, dsc_cfg); DC_LOG_DSC("DSC Picture Parameter Set (PPS):"); From patchwork Thu Nov 7 15:32:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233205 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 E5B9D16B1 for ; Thu, 7 Nov 2019 15:32:41 +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 CE06E214D8 for ; Thu, 7 Nov 2019 15:32:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE06E214D8 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 0515E6F700; Thu, 7 Nov 2019 15:32:31 +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-eopbgr730052.outbound.protection.outlook.com [40.107.73.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CDE26F700; Thu, 7 Nov 2019 15:32:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBIrcSS7uZqVzueJPHTCy+zj+Dxcq0lycas5e94pZky3wiEuPR+LYgLlhOxFG+0hFPOZ126CJZlnLYVg1pQhenpWPt68ksgtPpD9fZwFFdKu5RWvSplc/exqASCzsS5Ea8kffbOaSz0n7pAQvygdevEPVeG1T3VyrRFSTOgzPC6/21MzmGGmrwh9MlJqt8c0yhl51KI21BmjZBtSP4+xw0oGRFKTxyKYNiXpRwoBgwaGo9nXYNabgEXFU4G6vxFJr0g/2TtE6f7a2ohhtuaqcQJ4a6hWZj4Tgnbp2f63LwCJ5KIkWZ0sQ1t/P4wWMDCcSfIFArjIQjhgDPwqmLmNFg== 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=Z0B6nFMOiji2jnP9EAD+OCkvPyxlN4xxaKh5F+SPKeM=; b=UgmQKVZ1Qsc5IlvUUv9mLHmARaK3vZUJnyJARE6eRdxt1y6wh6OsmMb2kjwJFefAcX1L/y6EFhg6CH1njon1DUD7Rl7hJp+KUU3Aicx4tt8X2D3qwYWUMuczN9hPj6K8FHTxDICjMN5qWa+RTBc69IZP5iFOPwRqOgmRGKv/FELr9J3pacUquMkA3h+aLl+WbWQKeZUYjQqpZRPtvBzBBj6N3lNf0gR9NR112xF10U4h0byIZX6DxC88dug2rnr9zii5zflq7hkhDn0fg13UJSm6X6YV5E0HGf/TYRfXNw31CwwmrnvaDKvqzXDFl99P7/4Ug4SS4NarR8CwMR62Cw== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by DM6PR12MB3514.namprd12.prod.outlook.com (2603:10b6:5:18a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:28 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:27 +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; Thu, 7 Nov 2019 09:32:25 -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; Thu, 7 Nov 2019 09:32:24 -0600 From: To: Subject: [PATCH v6 08/13] drm/amd/display: Validate DSC caps on MST endpoints Date: Thu, 7 Nov 2019 10:32:07 -0500 Message-ID: <20191107153212.1145-9-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(476003)(486006)(2616005)(11346002)(81166006)(7696005)(14444005)(48376002)(81156014)(336012)(426003)(446003)(50466002)(186003)(6916009)(126002)(450100002)(51416003)(50226002)(26005)(2906002)(76176011)(478600001)(2876002)(8676002)(4326008)(2351001)(36756003)(5660300002)(86362001)(305945005)(1076003)(8936002)(15650500001)(53416004)(70586007)(316002)(16586007)(6666004)(54906003)(70206006)(47776003)(356004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3514; 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: 80dc29eb-1ffe-4d63-8ff9-08d76397b254 X-MS-TrafficTypeDiagnostic: DM6PR12MB3514: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eaRIZGTZws3FJ3wcyrMjWlA53tj9d5pjxvZ91ZEeIma53h+hjO/SVh/795tPndNrNDG56e9q688zChP1NDtf21wEzXXt5NfzllglWmSbW5WTXcpaejpovLtnPmqdLG/occ5oMlau12FLXzzdK5dcf8BaVTzZGZE/HMtwYWvdcCFrkYYMKrpiUbngXbTIH7hP+QV9txsq21lP9wemXB6U4fJGhlru4VgAamyuRNv2cspGEr3atBeO/dy6LXFtRYzuIPTNQkluUCdvfL+y4kqIBN34jdtj8vwoF1qzu90/gnbPCyjstvwojgBvEWZm5/Gn4Z/oPh9uvPIzHIgQ3Ft3vIoTMujlYngxY1AxhEUksWtjP/vX6sV3ZLfF9PIGNkp+epfLp+T8HF8lik7fgngT62F3+EQtiU+MpzOymRKRIGLjssLGnsNjJ/DH31kPiQbT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:27.8391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80dc29eb-1ffe-4d63-8ff9-08d76397b254 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: DM6PR12MB3514 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=Z0B6nFMOiji2jnP9EAD+OCkvPyxlN4xxaKh5F+SPKeM=; b=C5YWIt/nnl64CQM5R2g5Pyj+0Hf7tEJOrP8BZBg4fb/hJbsXNbRPDufRTJIgyMwgZRMpoL5rboDQmuSiFxBZwT7akSBA4T4w0NpoYccckTJM7WSqUdB+ViRPtC0gW+JHakCzoHKrF+sdDflPGFXbrqCM1zlW/w+zHORY08SSWYk= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis During MST mode enumeration, if a new dc_sink is created, populate it with dsc caps as appropriate. Use drm_dp_mst_dsc_aux_for_port to get the raw caps, then parse them onto dc_sink with dc_dsc_parse_dsc_dpcd. Reviewed-by: Wenjing Liu Signed-off-by: David Francis --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 ++ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 31 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index f6e18d8a9936..c7f1e2f00fac 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -323,6 +323,9 @@ struct amdgpu_dm_connector { struct drm_dp_mst_port *port; struct amdgpu_dm_connector *mst_port; struct amdgpu_encoder *mst_encoder; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + struct drm_dp_aux *dsc_aux; +#endif /* TODO see if we can merge with ddc_bus or make a dm_connector */ struct amdgpu_i2c_adapter *i2c; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 1a17ea1b42e0..804a00082bee 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -25,6 +25,7 @@ #include #include +#include #include "dm_services.h" #include "amdgpu.h" #include "amdgpu_dm.h" @@ -188,6 +189,28 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = { .early_unregister = amdgpu_dm_mst_connector_early_unregister, }; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +static bool validate_dsc_caps_on_connector(struct amdgpu_dm_connector *aconnector) +{ + struct dc_sink *dc_sink = aconnector->dc_sink; + struct drm_dp_mst_port *port = aconnector->port; + u8 dsc_caps[16] = { 0 }; + + aconnector->dsc_aux = drm_dp_mst_dsc_aux_for_port(port); + + if (!aconnector->dsc_aux) + return false; + + if (drm_dp_dpcd_read(aconnector->dsc_aux, DP_DSC_SUPPORT, dsc_caps, 16) < 0) + return false; + + if (!dc_dsc_parse_dsc_dpcd(dsc_caps, NULL, &dc_sink->sink_dsc_caps.dsc_dec_caps)) + return false; + + return true; +} +#endif + static int dm_dp_mst_get_modes(struct drm_connector *connector) { struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); @@ -230,10 +253,16 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) /* dc_link_add_remote_sink returns a new reference */ aconnector->dc_sink = dc_sink; - if (aconnector->dc_sink) + if (aconnector->dc_sink) { amdgpu_dm_update_freesync_caps( connector, aconnector->edid); +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + if (!validate_dsc_caps_on_connector(aconnector)) + memset(&aconnector->dc_sink->sink_dsc_caps, + 0, sizeof(aconnector->dc_sink->sink_dsc_caps)); +#endif + } } drm_connector_update_edid_property( From patchwork Thu Nov 7 15:32:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233209 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 789161599 for ; Thu, 7 Nov 2019 15:32:46 +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 60BB5214D8 for ; Thu, 7 Nov 2019 15:32:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60BB5214D8 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 C99D86F712; Thu, 7 Nov 2019 15:32:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760083.outbound.protection.outlook.com [40.107.76.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id C93816F700; Thu, 7 Nov 2019 15:32:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H7hLGBscHBr9ezSwd1K8OXs5QyQ0TPwR3DAOvE++xlE5oOUzvTCza7WUcVOVKkfRnq0xUtvbR+UoqodzYvX1qZoJ8gMr0GbB5rUpPtsUfJt+/G9j8aLrI7dZlnyWkyD7lg4WvyV58FOVhrMgo7BAsrEcjkNKFyUWYdvIUkvjBY7RLobhCDbVc0j/wH5Mco6XebjlX/yyrcj6G7oN6fjDKsAoHkB8pK56qG/8dfyfAVQrklCu9x7LYGOhZl8L/LynBX0ct0Z3c89U85KdZF71N2bUVkehfugcyQNggk8FFmoLMAEabRY5qGRvXyBJvwzfVRzpqeFc9CDpbx86Q4vMAw== 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=gKFJS8LHc90hEXeh8koGFe6v1zWHzss/OKvYQRYh5wg=; b=KX7AVHznYt2dVsZMvCObA5SJmoSIx6BPhBJHEhp3CXjpBNgGvVAnx+1iodpKuZlZY9N3s6qbYSAan6BY2EPZHRFGcY2SvCnyR6FyZhLDJ58eFinCXpAZT4iBCvPg1jQSH/unlZVtRzB+5M7GQltWTr7LCIjlceB4TdMx9jKrBMpQrHipMExwJOZK3lGjBkAssNrM1GDr1PUx/UXULB84VidERWHNi3iUWIeS80UCvueMerzho3O7q7S1Vgrd8AGJ6geSr2rE3x+OQ4F9XkkOt76GsRrqMT1J3/4WFIqpjUsdp1x8svBuhvKOCK378FDEl9YYazXtDFeL0Xylg6yYIQ== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by DM6PR12MB3515.namprd12.prod.outlook.com (2603:10b6:5:18a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.23; Thu, 7 Nov 2019 15:32:28 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +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; Thu, 7 Nov 2019 09:32:25 -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; Thu, 7 Nov 2019 09:32:25 -0600 From: To: Subject: [PATCH v6 09/13] drm/amd/display: Write DSC enable to MST DPCD Date: Thu, 7 Nov 2019 10:32:08 -0500 Message-ID: <20191107153212.1145-10-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(136003)(376002)(39860400002)(346002)(428003)(199004)(189003)(7696005)(50466002)(8936002)(8676002)(81156014)(50226002)(1076003)(86362001)(70586007)(336012)(2876002)(81166006)(26005)(51416003)(70206006)(54906003)(48376002)(76176011)(16586007)(186003)(53416004)(2351001)(47776003)(316002)(486006)(11346002)(476003)(2906002)(126002)(426003)(5660300002)(4326008)(6666004)(356004)(36756003)(446003)(478600001)(450100002)(14444005)(305945005)(2616005)(6916009)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3515; 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: 20813ccf-5d7c-427f-0b73-08d76397b29a X-MS-TrafficTypeDiagnostic: DM6PR12MB3515: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fIKpVIYf4VQyjHtKck6U6lzbn4jUT98O1h6LLarSaUuLQck5lkHpJFmJcLEXya0xFgMRKvZrjnzr5e4cEwgFi6Pv6YMxi7U/3FjpwuEhDlWnjeqREsHx8EI/tFP8PTkEnq77dqab9tn93NfTyfl2Dk2sCcIRbJAOwXHSMLCwXQEVpKIyvAizQA5MCYJgrneQYCp9qPMMhxpDkXfCiSrPknQ1JHsCiUz/u5GPZFHN5GwhrCohOjyydwnrwRciaHJAS7RlqyYIinkcu152izxZB1Fh46f3Hi/llJtGFBdY9GVd6rNux9YgC9vyphbhuHdfuctY4lNW6AsylkUd8OQ0muwDk0OqxpJsfg/OD1NLOT3FxE10eO6ypGmjpe6tcSe7pBCbwTmHv6fKR4z9wsXtofHXpjuKFxsZyFyMULIx8vL4+aczAawN/APoZ2C08zfr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:28.2755 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20813ccf-5d7c-427f-0b73-08d76397b29a 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: DM6PR12MB3515 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=gKFJS8LHc90hEXeh8koGFe6v1zWHzss/OKvYQRYh5wg=; b=eGJo39Un4gSFKciwy7Uyb0ugu5J8ketBauR1GpkHeIP/hsqTVASB7G608IDJVAi+/gnYzo0Wx6EjHn2qFBni79ymbNKudsvEctq7TMIxDMyQNLKqG97gF7S+fjHDpuxGxd3yp2ciNhehAobZXwWPtPguY7UclvhhgnSf1sdPdKE= 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis Rework the dm_helpers_write_dsc_enable callback to handle the MST case. Use the cached dsc_aux field. Reviewed-by: Wenjing Liu Signed-off-by: David Francis --- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 e3cda6984d28..a00cd1dafaf5 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 @@ -37,6 +37,7 @@ #include "dc.h" #include "amdgpu_dm.h" #include "amdgpu_dm_irq.h" +#include "amdgpu_dm_mst_types.h" #include "dm_helpers.h" @@ -519,8 +520,24 @@ bool dm_helpers_dp_write_dsc_enable( ) { uint8_t enable_dsc = enable ? 1 : 0; + struct amdgpu_dm_connector *aconnector; + + if (!stream) + return false; + + if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + + if (!aconnector->dsc_aux) + return false; + + return (drm_dp_dpcd_write(aconnector->dsc_aux, DP_DSC_ENABLE, &enable_dsc, 1) >= 0); + } + + if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT) + return dm_helpers_dp_write_dpcd(ctx, stream->link, DP_DSC_ENABLE, &enable_dsc, 1); - return dm_helpers_dp_write_dpcd(ctx, stream->sink->link, DP_DSC_ENABLE, &enable_dsc, 1); + return false; } bool dm_helpers_is_dp_sink_present(struct dc_link *link) From patchwork Thu Nov 7 15:32:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233217 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 70DC516B1 for ; Thu, 7 Nov 2019 15:32:55 +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 5905E214D8 for ; Thu, 7 Nov 2019 15:32:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5905E214D8 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 C6D2C6F716; Thu, 7 Nov 2019 15:32:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820089.outbound.protection.outlook.com [40.107.82.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E48F6F705; Thu, 7 Nov 2019 15:32:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVhYQdtDpiGTLxSQxO9mrfgXFM/9ibyyVXP310gnHHB43ni/NP3YHrgXrszVZLxZ+G3Zq8rlD5F5Steb3+gFG5CVtN0PEOZnt3WPeaGGjBF4MKWd5fi6VWFYSGb4T17asHnbFpC/p+aDjyN3hG4Z4u/1eMp5iwiQhS5Aeu40JG/7jfnxQZagvhWw/RDLD2Pgm6lN8tGPOWmPK9veVHxGHPruB0XVgji9KhybiM8GiknV6wk4CCZtWPvJWqQie/aO/umPpV4vVK1d2yzKvE+wdFOT41f+q3qMPr7rgQxSZZTfaT+tVMHyATmlj9W8cVb4FUAMWiiTbMdWoYTtxjySng== 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=LB+7Yu/a/hqjAX3Pdl9lX4Hkq8VwR17k62KPaquM8zk=; b=mAlc+JuQbzzIEt4JTTmGCUUn8YbSaU+/vla5jy36nw9F3m59lNKXt6gKoYD0UPIv2vVN9BH5GbJI1Ylgqn8U50XdN1FvKPZUuYJEiZikjB8ODpKKSoCW37mxQCw8gnlMs1bmMucxAByTb72uuGR5Egup6djlUxFZb9SxbQfK2KwBvKRWIpIyW5xvmmtyfXcc+RqHKrfHQzHc+6sjqU02una4VwmIpobhiZfBYDXz1I2LQrnm0DikeycyTTLoDtVcXs6qwjAfJsFksY+4GiR1nm+omx0Wb8PrmSsvZRYWC7X2oXEbH3HZf6dsQRYteVtrpDPDWL16xoxyng3bWo0+gQ== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by BYAPR12MB3512.namprd12.prod.outlook.com (2603:10b6:a03:134::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.24; Thu, 7 Nov 2019 15:32:28 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:28 +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; Thu, 7 Nov 2019 09:32:26 -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; Thu, 7 Nov 2019 09:32:26 -0600 From: To: Subject: [PATCH v6 10/13] drm/dp_mst: Add DSC enablement helpers to DRM Date: Thu, 7 Nov 2019 10:32:09 -0500 Message-ID: <20191107153212.1145-11-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(136003)(39860400002)(396003)(346002)(376002)(428003)(189003)(199004)(446003)(2906002)(51416003)(81156014)(1076003)(81166006)(86362001)(478600001)(426003)(16586007)(7696005)(76176011)(50226002)(5660300002)(70586007)(70206006)(53416004)(4326008)(6916009)(26005)(36756003)(47776003)(2876002)(186003)(2351001)(8676002)(336012)(48376002)(50466002)(8936002)(6666004)(356004)(305945005)(54906003)(316002)(2616005)(476003)(126002)(11346002)(14444005)(486006)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3512; 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: 425f2adf-0957-44ed-8844-08d76397b2d4 X-MS-TrafficTypeDiagnostic: BYAPR12MB3512: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jjxnQQhOYeIsv2AfJIP/3AO9IqVj/j7mlDnUnHy7rXr2QW1kts7h238b+WTxr/3lchJShDx496nn1zopa/bYBd8LoTkl/UbZwXLz+8SG8A53Bie90hfBHSAfQtvF2Vd465R9SAsmMz5ZAMmCtrJkaQe6VQ9MFiPlBWwV7KsmyRW3EbmMRmHtUbRcnnQ/p1fnE2+lctshg+z48RSl//K+Clvi7rwtIrJN443+Fdabf+COAxd0k9l/emO0fh1z/TgOO0QYBKLknDP+Ii9FoI4GDndB0EtQb7C0WdQWuMaMgpe8LgeHY0W2lQaV/AGuZ5Tftv4b1DwrsV0ETQozI8JnM1j5uBNf+L7SJemKLkw2VDGyTk5eX6HFpHBqQKX9yy34ziD9cj2vO4Vmxs305CFsWVMRY3DQPUzqNnGsCvLWjp37e56Ljulh48/1QsepndKD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:28.6758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 425f2adf-0957-44ed-8844-08d76397b2d4 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: BYAPR12MB3512 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=LB+7Yu/a/hqjAX3Pdl9lX4Hkq8VwR17k62KPaquM8zk=; b=ybXVBFjzYe6CQ0BZxIL9c/wDEDGHF0TR3i9ZUFRHBoYbA6ezcgDy3V2JsgVOKCS+KrgsrCK9Wfwg+VPA4k7oz87INiXKyAkMmGz6u68CIuEJBTqRRsEK7eqlze78dU7hf7QtWStTLbUhyVImvPz8A9Ku0iUrgu0c6T2Dmpk5vYg= 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 Adding a helper function to be called by drivers outside of DRM to enable DSC on the MST ports. Function is called to recalculate VCPI allocation if DSC is enabled and raise the DSC flag to enable. In case of disabling DSC the flag is set to false and recalculation of VCPI slots is expected to be done in encoder's atomic_check. v2: squash separate functions into one and call it per port Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- drivers/gpu/drm/drm_dp_mst_topology.c | 76 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 5 ++ 2 files changed, 81 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index d5df02315e14..86e20dbf3cce 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3871,6 +3871,82 @@ drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr, return 0; } +/** + * drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off + * @state: Pointer to the new &struct drm_dp_mst_topology_state + * @pointer: Pointer to the affected MST Port + * @pbn: Newly recalculated bw required for link with DSC enabled + * @enable: Boolean flag enabling or disabling DSC on the port + * + * This function enables DSC on the given Port + * by recalculating its vcpi from pbn provided + * and sets dsc_enable flag to keep track of which + * ports have DSC enabled + * + * See also: + * drm_dp_helper_update_vcpi_slots_for_dsc() + */ +int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state, + struct drm_dp_mst_port *port, + int pbn, + bool enable) +{ + struct drm_dp_mst_topology_state *mst_state; + struct drm_dp_vcpi_allocation *pos; + struct drm_connector_state *conn_state; + struct drm_crtc *crtc; + struct drm_crtc_state *crtc_state; + bool found = false; + int vcpi = 0; + + mst_state = drm_atomic_get_mst_topology_state(state, port->mgr); + + if (IS_ERR(mst_state)) + return PTR_ERR(mst_state); + + list_for_each_entry(pos, &mst_state->vcpis, next) { + if (pos->port == port) { + found = true; + break; + } + } + + if (!found) + return -EINVAL; + + if (pos->dsc_enabled == enable) + return 0; + + if (enable) { + vcpi = drm_dp_atomic_find_vcpi_slots(state, port->mgr, port, pbn); + + if (vcpi < 0) + return -EINVAL; + } + + pos->dsc_enabled = enable; + + conn_state = drm_atomic_get_connector_state(mst_state->base.state, + port->connector); + + if (IS_ERR(conn_state)) + return PTR_ERR(conn_state); + + crtc = conn_state->crtc; + + if (!crtc) + return -EINVAL; + + crtc_state = drm_atomic_get_crtc_state(mst_state->base.state, crtc); + + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); + + crtc_state->mode_changed = true; + + return vcpi; +} +EXPORT_SYMBOL(drm_dp_mst_atomic_enable_dsc); /** * drm_dp_mst_atomic_check - Check that the new state of an MST topology in an * atomic update is valid diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 4cf738545dfb..0a9aed1c00ff 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -431,6 +431,7 @@ struct drm_dp_payload { struct drm_dp_vcpi_allocation { struct drm_dp_mst_port *port; int vcpi; + bool dsc_enabled; struct list_head next; }; @@ -662,6 +663,10 @@ 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); +int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state, + struct drm_dp_mst_port *port, + int pbn, + bool enable); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, From patchwork Thu Nov 7 15:32:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233211 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 371DA1864 for ; Thu, 7 Nov 2019 15:32:49 +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 1C9CB214D8 for ; Thu, 7 Nov 2019 15:32:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C9CB214D8 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 9ACDC6F715; Thu, 7 Nov 2019 15:32:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740084.outbound.protection.outlook.com [40.107.74.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BE4B89C6C; Thu, 7 Nov 2019 15:32:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+DJWoDPaQNDlPggSsEiB31gPP9Z3NFr70xdID2kMa30tad+LQvKRDeRbOz/fRxbIOm37jc0SUJIuu0DY2+AxSES6inD4eXjrdOeWSolU9w+jduYT6yMEnHI66PSP8KRbPkBsLDOzQGuPaPPXdl35Zqd6ntD+qEKWUAmQnEj7z0BLcq5QIV1qDBGQtBgBZjUQZc2pgH5bYrn206MfIDOYZHAdBa4hVeop/QLu2lNgQALVEm6FeKNCjWqtj22AWkHa1MwULg2S/F9NFqXdgAggcxBDIdP3F2K2RHlfwfR8pKhLCK2bWV4++Mcs311VbW0SD1gf8uuq+XLD0cMXssfEQ== 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=QDahGbodcZkrdxllRCGxxiEsvpSv+MkbzmcBRat875k=; b=Wx8CsHxP5s7MbGDaXVjZmjTJeO4Nm721ZLqvFiXA6TrumD8Ed/iCuH3kjyxd37n2k662n9Ht/gQnS3Ae0E4E8GuFXGcXLLQ7PN0+CuCCGcZBfHAF1fge7DH1vRTrEZhqNserdn7HpExshVzhwo7A9vzPDGJQLyOxSBsFjS4eiX/2ms/bJJCzTAlDzwbgaBUMJA3wWSGIJMB6006rT5vs/hRV7m5CQsl8rgLqV7PhysDBYsltVUxNa0uWRW96pDPFkKsQzawfsBfsfGq3GnRUs1JRJo0ZNY40/mHHnibqHIEOl1gf6Hc7Y5hj03B1gaSXpSiuZt7cTkrBAxnKKRCt7w== 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 DM5PR12CA0016.namprd12.prod.outlook.com (2603:10b6:4:1::26) by BYAPR12MB3479.namprd12.prod.outlook.com (2603:10b6:a03:dc::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Thu, 7 Nov 2019 15:32:29 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0016.outlook.office365.com (2603:10b6:4:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:29 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:29 +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; Thu, 7 Nov 2019 09:32:27 -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; Thu, 7 Nov 2019 09:32:27 -0600 From: To: Subject: [PATCH v6 11/13] drm/dp_mst: Add branch bandwidth validation to MST atomic check Date: Thu, 7 Nov 2019 10:32:10 -0500 Message-ID: <20191107153212.1145-12-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(376002)(396003)(39860400002)(136003)(428003)(189003)(199004)(81166006)(51416003)(336012)(14444005)(2906002)(2351001)(426003)(2876002)(316002)(47776003)(16586007)(8676002)(76176011)(26005)(53416004)(478600001)(54906003)(186003)(86362001)(1076003)(36756003)(5660300002)(7696005)(48376002)(486006)(70206006)(11346002)(70586007)(356004)(4326008)(6916009)(476003)(2616005)(81156014)(8936002)(6666004)(126002)(305945005)(50226002)(50466002)(446003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3479; 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: 043f19e5-f5f9-43f9-014e-08d76397b330 X-MS-TrafficTypeDiagnostic: BYAPR12MB3479: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:61; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: owHZ8ZC2xruG7zn6qESs2bxM98/01n2fZUqBo6z54g/80fX22dgpcJYUVnX79jm6SN6ZrGyrdCjRT79UuQO2BuwSTsMFcxZCzYy78iYPvo8FCm63uD9UfvTIPgy8VbCRn7tsZi76eUji/20t+72x1ZPheudFp2WkWjWmScWz3DS3/i6llRf4fD6V608zT9fbqBEH6Sqg/VKOl3MQ83ZWbialcwlRr5TMlgeqieFZwA9XhMFgE65IvFgR9b8f4ZbSgwwVcNB4144JMTBjsHBMjKZe5vHoQRZMxgpxO9vSXZPc9ypvOI7W+Z0xy4rHw3ZDoSMDJ9qNJkUeIj5Y6fGERiODPYHEmZfCD3FJG3q3d3/uZlWwQm6RCU262c56QYXWmUg91MfkmEioAyjR1GxPre8VGxWYq0ujuarYJwXyPRkU9Vm69mxzTdaqlzPZj1w8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:29.2773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 043f19e5-f5f9-43f9-014e-08d76397b330 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: BYAPR12MB3479 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=QDahGbodcZkrdxllRCGxxiEsvpSv+MkbzmcBRat875k=; b=gRCyzDEFsmVevk9W/duRw0vpZiZGA2iclUUfcUos/ujqGIQRYSO5cko/7zQc31WlVYDMysPwLxp0GWJBedY9GUkJijNZGAuR3BdGsauPGJMVCtieVC5qsvXa4ROclS+pZjdk3Xn2C8488YFWi7HFYAEOPIM83W6OpcCsy0r0dVM= 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 Adding PBN attribute to drm_dp_vcpi_allocation structure to keep track of how much bandwidth each Port requires. Adding drm_dp_mst_atomic_check_bw_limit to verify that state's bandwidth needs doesn't exceed available bandwidth. The funtion is called in drm_dp_mst_atomic_check after drm_dp_mst_atomic_check_topology_state to fully verify that the proposed topology is supported. Cc: Jerry Zuo Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- drivers/gpu/drm/drm_dp_mst_topology.c | 68 +++++++++++++++++++++++++-- include/drm/drm_dp_mst_helper.h | 1 + 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 86e20dbf3cce..2e44dfda0fbf 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3241,7 +3241,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, { struct drm_dp_mst_topology_state *topology_state; struct drm_dp_vcpi_allocation *pos, *vcpi = NULL; - int prev_slots, req_slots, ret; + int prev_slots, prev_bw, req_slots, ret; topology_state = drm_atomic_get_mst_topology_state(state, mgr); if (IS_ERR(topology_state)) @@ -3252,6 +3252,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, if (pos->port == port) { vcpi = pos; prev_slots = vcpi->vcpi; + prev_bw = vcpi->pbn; /* * This should never happen, unless the driver tries @@ -3267,14 +3268,18 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, break; } } - if (!vcpi) + if (!vcpi) { prev_slots = 0; - + prev_bw = 0; + } req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div); DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n", port->connector->base.id, port->connector->name, port, prev_slots, req_slots); + DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n", + port->connector->base.id, port->connector->name, + port, prev_bw, pbn); /* Add the new allocation to the state */ if (!vcpi) { @@ -3287,6 +3292,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, list_add(&vcpi->next, &topology_state->vcpis); } vcpi->vcpi = req_slots; + vcpi->pbn = pbn; ret = req_slots; return ret; @@ -3832,6 +3838,59 @@ static void drm_dp_mst_destroy_state(struct drm_private_obj *obj, kfree(mst_state); } +static bool drm_dp_mst_port_downstream_of_branch(struct drm_dp_mst_port *port, + struct drm_dp_mst_branch *branch) +{ + while (port->parent) { + if (port->parent == branch) + return true; + + if (port->parent->port_parent) + port = port->parent->port_parent; + else + break; + } + return false; +} + +static inline +int drm_dp_mst_atomic_check_bw_limit(struct drm_dp_mst_branch *branch, + struct drm_dp_mst_topology_state *mst_state) +{ + struct drm_dp_mst_port *port; + struct drm_dp_vcpi_allocation *vcpi; + int pbn_limit = 0, pbn_used = 0; + + list_for_each_entry(port, &branch->ports, next) { + if (port->mstb) { + if (drm_dp_mst_atomic_check_bw_limit(port->mstb, mst_state)) + return -EINVAL; + } + if (port->available_pbn > 0) + pbn_limit = port->available_pbn; + } + DRM_DEBUG_ATOMIC("[MST BRANCH:%p] branch has %d PBN available\n", + branch, + pbn_limit); + + list_for_each_entry(vcpi, &mst_state->vcpis, next) { + if (!vcpi->pbn) + continue; + + if (drm_dp_mst_port_downstream_of_branch(vcpi->port, branch)) + pbn_used += vcpi->pbn; + } + DRM_DEBUG_ATOMIC("[MST BRANCH:%p] branch used %d PBN\n", + branch, + pbn_limit); + if (pbn_used > pbn_limit) { + DRM_DEBUG_ATOMIC("[MST BRANCH:%p] No available bandwidth\n", + branch); + return -EINVAL; + } + return 0; +} + static inline int drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_topology_state *mst_state) @@ -3978,6 +4037,9 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state *state) ret = drm_dp_mst_atomic_check_topology_state(mgr, mst_state); if (ret) break; + ret = drm_dp_mst_atomic_check_bw_limit(mgr->mst_primary, mst_state); + if (ret) + break; } return ret; diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 0a9aed1c00ff..08de711f38b0 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -431,6 +431,7 @@ struct drm_dp_payload { struct drm_dp_vcpi_allocation { struct drm_dp_mst_port *port; int vcpi; + int pbn; bool dsc_enabled; struct list_head next; }; From patchwork Thu Nov 7 15:32:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233213 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 1748916B1 for ; Thu, 7 Nov 2019 15:32:51 +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 F34E3214D8 for ; Thu, 7 Nov 2019 15:32:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F34E3214D8 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 B99E16F711; Thu, 7 Nov 2019 15:32:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700056.outbound.protection.outlook.com [40.107.70.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2AFE46F709; Thu, 7 Nov 2019 15:32:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CncZeKk8jCJrV/lc9iaj5h5kQInH8cWTzNBjWv1nI428jk7ELRRiz6JoZ239jsVK7jaSeLVanAGRvVmlb1KgkC+Ghxp8afhCVd9UeQ96fm3u+74UnEoSvtq501+FvIdOI8cz15p6tEt4Vs1nChq4pBcSfwTAy3VU6l3LlNk2CMKKdCvLsb2XJ7wLF2TirWIXdMxTVwcDv/LwU7nK5I7We/QO6lZKbQBdgqCX5vfatT+QCiOz2PaA5zt/VQJWVocJ65cNwpnKJ1xiNqZNpslji5942ADFJ/sKUpKkDsCcCX4PBpo45Qq6jUlQ0M7qmDjeaET2CB83e9bI+hHHEel9Jg== 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=tTBIyR3HOvIzIJ8AkTeEJXHSWsKag+du9dnyLyuhRvM=; b=lGhdoQlHbyx931E9m0uCg1AnOsDzfc1gh0+pYdX7+PNx1TjBg1ZYpPbPJavFHw8Lor/JbSO2CIDoLK6nwQu23e/iCz3F+HX14W6txUyHpolj2eAwT4s35jzUEGESGofvw4rtI/VihaAY1+HczdcigEUP4Bt+S3LS9Snj3Rk/ylftMJOwUQJD3BuoVD0Lro2k8mwQVg41bMqQHhlK38V+KS6nGxvN1tjfT8VbpZgCqm6K5bG4BKpIUdkMDJpArhAIBUaAOY9vPX2EWkOd1bPwB9d9QNMdFPgi5dp/kENG0DVNU/rhVdFdDjNpfYBXTHQwoOdk8PR6FSbxWDU65O5GKw== 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 DM5PR12CA0013.namprd12.prod.outlook.com (2603:10b6:4:1::23) by MN2PR12MB3679.namprd12.prod.outlook.com (2603:10b6:208:159::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.24; Thu, 7 Nov 2019 15:32:30 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::207) by DM5PR12CA0013.outlook.office365.com (2603:10b6:4:1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +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; Thu, 7 Nov 2019 09:32:28 -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; Thu, 7 Nov 2019 09:32:28 -0600 From: To: Subject: [PATCH v6 12/13] drm/amd/display: MST DSC compute fair share Date: Thu, 7 Nov 2019 10:32:11 -0500 Message-ID: <20191107153212.1145-13-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(396003)(39860400002)(376002)(428003)(199004)(189003)(30864003)(70206006)(70586007)(1076003)(186003)(5660300002)(53416004)(4326008)(450100002)(478600001)(126002)(486006)(6666004)(356004)(426003)(14444005)(336012)(476003)(2616005)(11346002)(36756003)(305945005)(446003)(50466002)(48376002)(316002)(8676002)(76176011)(51416003)(6916009)(7696005)(2351001)(16586007)(86362001)(47776003)(54906003)(26005)(50226002)(2876002)(8936002)(81156014)(81166006)(2906002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3679; 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: bf56504b-49fb-42c1-aadb-08d76397b3a1 X-MS-TrafficTypeDiagnostic: MN2PR12MB3679: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QSTrJGdkC2pL53cOcPBlaUVLUfZUxit9PpgpK1GDKfxv0lyvBBtGx5iyC9YpPue6dteZA4zwhpQI/Le/AKQJXqtoQstreVHH7p1DsqJz+AbePGgLVu7ZZYCMbzZjs8t+wxLuSVxWMPuPbrKfCfbwUNiR1SvzMugGzKDnD8Je8+l3Wv8XrX73uPr/kU+e6WTjlx/g3nXnM2gCpmsGzxyk8IEGNdo2UcadWrMs3h+692eheDc2H8wqeJ4m9MqPyQBZa3bCajB377SWUkn24Ko+7oWQ+UVxIb4RPJet/Xu7klfh/flvInW+Hxww5h/X235yqZCaQnHpEP8I+ZdnaxF4OPKTTpnFCxeyxJtTxxmQLtfQaXhW+yxRDBzBazaijm3p4A05Wz/zu/DGq8wiCKoI7Fglj1bdytpwGlnPQg3Xup3Cp2TZPhwdxZz8i4dydXdG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:30.0212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf56504b-49fb-42c1-aadb-08d76397b3a1 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: MN2PR12MB3679 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=tTBIyR3HOvIzIJ8AkTeEJXHSWsKag+du9dnyLyuhRvM=; b=B20ZokC3sYQWOXusiLxOJVLiyRXrLBdPOgL3sOmcHmKEFheAjGfHRY2G52i11/vewhGFxI2tV47oS4Z8/7PFTa/hiLBC6526+Or+qjP9KA19dhy8JM4AKisbPgNxLslYCAXhIY+g8FT7qVJUJW7WMY6KOgy3c3qTVye6Bd32fmc= 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 , Mikita Lipski , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis If there is limited link bandwidth on a MST network, it must be divided fairly between the streams on that network Implement an algorithm to determine the correct DSC config for each stream The algorithm: This [ ] ( ) represents the range of bandwidths possible for a given stream. The [] area represents the range of DSC configs, and the () represents no DSC. The bandwidth used increases from left to right. First, try disabling DSC on all streams [ ] (|) [ ] (|) Check this against the bandwidth limits of the link and each branch (including each endpoint). If it passes, the job is done Second, try maximum DSC compression on all streams that support DSC [| ] ( ) [| ] ( ) If this does not pass, then enabling this combination of streams is impossible Otherwise, divide the remaining bandwidth evenly amongst the streams [ | ] ( ) [ | ] ( ) If one or more of the streams reach minimum compression, evenly divide the reamining bandwidth amongst the remaining streams [ |] ( ) [ |] ( ) [ | ] ( ) [ | ] ( ) If all streams can reach minimum compression, disable compression greedily [ |] ( ) [ |] ( ) [ ] (|) Perform this algorithm on each full update, on each MST link with at least one DSC stream on it After the configs are computed, call dcn20_add_dsc_to_stream_resource on each stream with DSC enabled. It is only after all streams are created that we can know which of them will need DSC. Do all of this at the end of amdgpu atomic check. If it fails, fail check; This combination of timings cannot be supported. v2: Use drm_dp_mst_atomic_check to validate bw for certain dsc configurations Reviewed-by: Wenjing Liu Signed-off-by: David Francis Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 397 ++++++++++++++++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 5 + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 3 + .../drm/amd/display/dc/dcn20/dcn20_resource.h | 1 + 5 files changed, 410 insertions(+) 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 105ab57515fe..609020a0549e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8064,6 +8064,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + if (!compute_mst_dsc_configs_for_state(state, dm_state->context)) + goto fail; +#endif if (dc_validate_global_state(dc, dm_state->context, false) != DC_OK) { ret = -EINVAL; goto fail; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 804a00082bee..6065f1d8e83e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -38,6 +38,8 @@ #include "i2caux_interface.h" +#include "dc/dcn20/dcn20_resource.h" + /* #define TRACE_DPCD */ #ifdef TRACE_DPCD @@ -491,3 +493,398 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, aconnector->connector_id); } +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +struct dsc_mst_fairness_params { + struct dc_crtc_timing *timing; + struct dc_sink *sink; + struct dc_dsc_bw_range bw_range; + bool compression_possible; + struct drm_dp_mst_port *port; +}; + +struct dsc_mst_fairness_vars { + int pbn; + bool dsc_enabled; + int bpp_x16; +}; + +static bool port_downstream_of_branch(struct drm_dp_mst_port *port, + struct drm_dp_mst_branch *branch) +{ + while (port->parent) { + if (port->parent == branch) + return true; + + if (port->parent->port_parent) + port = port->parent->port_parent; + else + break; + } + return false; +} + +static bool check_pbn_limit_on_branch(struct drm_dp_mst_branch *branch, + struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, int count) +{ + struct drm_dp_mst_port *port; + int i; + int pbn_limit = 0; + int pbn_used = 0; + + list_for_each_entry(port, &branch->ports, next) { + if (port->mstb) + if (!check_pbn_limit_on_branch(port->mstb, params, vars, count)) + return false; + + if (port->available_pbn > 0) + pbn_limit = port->available_pbn; + } + + for (i = 0; i < count; i++) { + if (port_downstream_of_branch(params[i].port, branch)) + pbn_used += vars[i].pbn; + } + + if (pbn_used > pbn_limit) + return false; + + return true; +} + +static bool check_bandwidth_limits(struct dc_link *dc_link, + struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, + int count) +{ + int link_timeslot_limit = 63; + int link_timeslots_used = 0; + int pbn_per_timeslot; + int i; + struct drm_dp_mst_topology_mgr *mst_mgr; + + /* kbits to pbn, dividing by 64 */ + + pbn_per_timeslot = dc_link_bandwidth_kbps(dc_link, + dc_link_get_link_cap(dc_link)) / (8 * 1000 * 54); + + /* Check link bandwidth limit */ + for (i = 0; i < count; i++) + link_timeslots_used += DIV_ROUND_UP(vars[i].pbn, pbn_per_timeslot); + + if (link_timeslots_used > link_timeslot_limit) + return false; + + /* Check branch bandwidth limit for each port on each branch */ + mst_mgr = params[0].port->mgr; + + if (!check_pbn_limit_on_branch(mst_mgr->mst_primary, params, vars, count)) + return false; + return true; +} + +static int kbps_to_peak_pbn(int kbps) +{ + u64 peak_kbps = kbps; + + peak_kbps *= 1006; + peak_kbps /= 1000; + return (int) DIV_ROUND_UP(peak_kbps * 64, (54 * 8 * 1000)); +} + +static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, + int count) +{ + int i; + + for (i = 0; i < count; i++) { + memset(¶ms[i].timing->dsc_cfg, 0, sizeof(params[i].timing->dsc_cfg)); + if (vars[i].dsc_enabled && dc_dsc_compute_config( + params[i].sink->ctx->dc->res_pool->dscs[0], + ¶ms[i].sink->sink_dsc_caps.dsc_dec_caps, + params[i].sink->ctx->dc->debug.dsc_min_slice_height_override, + 0, + params[i].timing, + ¶ms[i].timing->dsc_cfg)) { + params[i].timing->flags.DSC = 1; + params[i].timing->dsc_cfg.bits_per_pixel = vars[i].bpp_x16; + } else { + params[i].timing->flags.DSC = 0; + } + + } + +} + +static int bpp_x16_from_pbn(struct dsc_mst_fairness_params param, int pbn) +{ + struct dc_dsc_config dsc_config; + u64 kbps; + + kbps = (u64)pbn * 994 * 8 * 54 / 64; + dc_dsc_compute_config( + param.sink->ctx->dc->res_pool->dscs[0], + ¶m.sink->sink_dsc_caps.dsc_dec_caps, + param.sink->ctx->dc->debug.dsc_min_slice_height_override, + (int) kbps, param.timing, &dsc_config); + + return dsc_config.bits_per_pixel; +} + +static void increase_dsc_bpp(struct dc_link *dc_link, + struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, + int count) +{ + int i; + bool bpp_increased[MAX_PIPES]; + int initial_slack[MAX_PIPES]; + int min_initial_slack; + int next_index; + int remaining_to_increase = 0; + int pbn_per_timeslot; + int link_timeslots_used; + int fair_pbn_alloc; + + for (i = 0; i < count; i++) { + if (vars[i].dsc_enabled) { + initial_slack[i] = kbps_to_peak_pbn(params[i].bw_range.max_kbps) - vars[i].pbn; + bpp_increased[i] = false; + remaining_to_increase += 1; + } else { + initial_slack[i] = 0; + bpp_increased[i] = true; + } + } + + pbn_per_timeslot = dc_link_bandwidth_kbps(dc_link, + dc_link_get_link_cap(dc_link)) / (8 * 1000 * 54); + + while (remaining_to_increase) { + next_index = -1; + min_initial_slack = -1; + for (i = 0; i < count; i++) { + if (!bpp_increased[i]) { + if (min_initial_slack == -1 || min_initial_slack > initial_slack[i]) { + min_initial_slack = initial_slack[i]; + next_index = i; + } + } + } + + if (next_index == -1) + break; + + link_timeslots_used = 0; + + for (i = 0; i < count; i++) + link_timeslots_used += DIV_ROUND_UP(vars[i].pbn, pbn_per_timeslot); + + fair_pbn_alloc = (63 - link_timeslots_used) / remaining_to_increase * pbn_per_timeslot; + + if (initial_slack[next_index] > fair_pbn_alloc) { + vars[next_index].pbn += fair_pbn_alloc; + if (check_bandwidth_limits(dc_link, params, vars, count)) + vars[next_index].bpp_x16 = bpp_x16_from_pbn(params[next_index], vars[next_index].pbn); + else + vars[next_index].pbn -= fair_pbn_alloc; + } else { + vars[next_index].pbn += initial_slack[next_index]; + if (check_bandwidth_limits(dc_link, params, vars, count)) + vars[next_index].bpp_x16 = params[next_index].bw_range.max_target_bpp_x16; + else + vars[next_index].pbn -= initial_slack[next_index]; + } + + bpp_increased[next_index] = true; + remaining_to_increase--; + } +} + +static void try_disable_dsc(struct dc_link *dc_link, + struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, + int count) +{ + int i; + bool tried[MAX_PIPES]; + int kbps_increase[MAX_PIPES]; + int max_kbps_increase; + int next_index; + int remaining_to_try = 0; + + for (i = 0; i < count; i++) { + if (vars[i].dsc_enabled && vars[i].bpp_x16 == params[i].bw_range.max_target_bpp_x16) { + kbps_increase[i] = params[i].bw_range.stream_kbps - params[i].bw_range.max_kbps; + tried[i] = false; + remaining_to_try += 1; + } else { + kbps_increase[i] = 0; + tried[i] = true; + } + } + + while (remaining_to_try) { + next_index = -1; + max_kbps_increase = -1; + for (i = 0; i < count; i++) { + if (!tried[i]) { + if (max_kbps_increase == -1 || max_kbps_increase < kbps_increase[i]) { + max_kbps_increase = kbps_increase[i]; + next_index = i; + } + } + } + + if (next_index == -1) + break; + + vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps); + + if (check_bandwidth_limits(dc_link, params, vars, count)) { + vars[next_index].dsc_enabled = false; + vars[next_index].bpp_x16 = 0; + } else { + vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps); + } + + tried[next_index] = true; + remaining_to_try--; + } +} + +static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, + struct dc_state *dc_state, + struct dc_link *dc_link) +{ + int i; + struct dc_stream_state *stream; + struct dsc_mst_fairness_params params[MAX_PIPES]; + struct dsc_mst_fairness_vars vars[MAX_PIPES]; + struct amdgpu_dm_connector *aconnector; + int count = 0; + + memset(params, 0, sizeof(params)); + + /* Set up params */ + for (i = 0; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + + if (stream->link != dc_link) + continue; + + stream->timing.flags.DSC = 0; + + params[count].timing = &stream->timing; + params[count].sink = stream->sink; + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + params[count].port = aconnector->port; + params[count].compression_possible = stream->sink->sink_dsc_caps.dsc_dec_caps.is_dsc_supported; + if (!dc_dsc_compute_bandwidth_range( + stream->sink->ctx->dc->res_pool->dscs[0], + stream->sink->ctx->dc->debug.dsc_min_slice_height_override, + 8, 16, + &stream->sink->sink_dsc_caps.dsc_dec_caps, + &stream->timing, ¶ms[count].bw_range)) + params[count].bw_range.stream_kbps = dc_bandwidth_in_kbps_from_timing(&stream->timing); + + count++; + } + + /* Try no compression */ + for (i = 0; i < count; i++) { + vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps); + vars[i].dsc_enabled = false; + vars[i].bpp_x16 = 0; + drm_dp_atomic_find_vcpi_slots(state, + params[i].port->mgr, + params[i].port, + vars[i].pbn); + } + + if (!drm_dp_mst_atomic_check(state)) { + set_dsc_configs_from_fairness_vars(params, vars, count); + return true; + } + + /* Try max compression */ + for (i = 0; i < count; i++) { + if (params[i].compression_possible) { + vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.min_kbps); + vars[i].dsc_enabled = true; + vars[i].bpp_x16 = params[i].bw_range.min_target_bpp_x16; + } else { + vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps); + vars[i].dsc_enabled = false; + vars[i].bpp_x16 = 0; + } + drm_dp_atomic_find_vcpi_slots(state, + params[i].port->mgr, + params[i].port, + vars[i].pbn); + } + if (drm_dp_mst_atomic_check(state)) + return false; + + /* Optimize degree of compression */ + increase_dsc_bpp(dc_link, params, vars, count); + + try_disable_dsc(dc_link, params, vars, count); + + set_dsc_configs_from_fairness_vars(params, vars, count); + + return true; +} + +bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, + struct dc_state *dc_state) +{ + int i, j; + struct dc_stream_state *stream; + bool computed_streams[MAX_PIPES]; + struct amdgpu_dm_connector *aconnector; + + for (i = 0; i < dc_state->stream_count; i++) + computed_streams[i] = false; + + for (i = 0; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + + if (stream->signal != SIGNAL_TYPE_DISPLAY_PORT_MST) + continue; + + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + + if (!aconnector || !aconnector->dc_sink) + continue; + + if (!aconnector->dc_sink->sink_dsc_caps.dsc_dec_caps.is_dsc_supported) + continue; + + if (computed_streams[i]) + continue; + + mutex_lock(&aconnector->mst_mgr.lock); + if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link)) { + mutex_unlock(&aconnector->mst_mgr.lock); + return false; + } + mutex_unlock(&aconnector->mst_mgr.lock); + + for (j = 0; j < dc_state->stream_count; j++) { + if (dc_state->streams[j]->link == stream->link) + computed_streams[j] = true; + } + } + + for (i = 0; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + + if (stream->timing.flags.DSC == 1) + dcn20_add_stream_to_ctx(stream->ctx->dc, dc_state, stream); + } + + return true; +} +#endif diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h index 2da851b40042..3b8bb4ea51c7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h @@ -32,4 +32,9 @@ struct amdgpu_dm_connector; void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, struct amdgpu_dm_connector *aconnector); + +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, + struct dc_state *dc_state); +#endif #endif diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c index 3d5a79ff1151..468db6be5b83 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -1501,6 +1501,9 @@ static enum dc_status add_dsc_to_stream_resource(struct dc *dc, if (pipe_ctx->stream != dc_stream) continue; + if (pipe_ctx->stream_res.dsc) + continue; + acquire_dsc(&dc_ctx->res_ctx, pool, &pipe_ctx->stream_res.dsc); /* The number of DSCs can be less than the number of pipes */ diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h index fa00989584dc..f1cf8a634c9b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h @@ -157,6 +157,7 @@ void dcn20_calculate_dlg_params( enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream); enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); +enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *dc_ctx, struct dc_stream_state *dc_stream); enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); enum dc_status dcn20_get_default_swizzle_mode(struct dc_plane_state *plane_state); From patchwork Thu Nov 7 15:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11233223 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 97EE716B1 for ; Thu, 7 Nov 2019 15:32:59 +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 7FDF3214D8 for ; Thu, 7 Nov 2019 15:32:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FDF3214D8 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 77D056F717; Thu, 7 Nov 2019 15:32:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760055.outbound.protection.outlook.com [40.107.76.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E6A86F70D; Thu, 7 Nov 2019 15:32:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ap/IlPcjjFjpr5VF5j26dgTIJl9gwnF9gFx0M+Y9aHY3yaF9Mu64Z0z92h/7gTKWxpd+uA2x+zRtpkDs6sbjgJI8z+Z8prSDa9a6MLuNi6Kx0zUnmnYj46ugeAq8jK3nzEMBcjDmmw654z3OAJbrm+LEbABMB8NH5OdC+C/kcryYHrgEG5Xbt0QRG1AmnerbANj/ePeQuHBo9V8ZXPOqeVcFWkZ6eDZAYCQh35EMbl552KaK6Bt96C7eOfpPOEjl6MWw4eX+48EtwbqGqQoTpwFKkZ/f8UGNwqjf8oyMg0GJhFSTuRCFJm9JhL3voXZ2ZTVZxzmRZkq1NAixg/3q6Q== 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=mPV+Hb3LpUxzgcisP+S5QBg9Bjt8C1XPVsbe8bGZDKs=; b=av+Woxe+N2U0lTSv/wNj0A2stcx31k9jgKf+6w2M8ZrYD1YIDpe/L5RS/YZla3AKAX4pQNz654E8csmrQFfD1rWRAn0g0qcWsrHxKqQEz+wRlnArZwkiUwUX3sBIgzG9U3gK5Cr/Xnx7gEpgHOg2BKLnztcozwYTpK0rqOzRGC1Ckkk1EEwlEAQgTUpwBELP5nDrioi7sY9b0BpnZ/fzCKHOTsfqCugGgOeEUl1yU+87LQw73LiNzSxYnZtItN6QUmtb2WjsSFzYsAI5WhhHUEjMrZizCEVUChTHgn0pSF8sGeOd5kGd8DsMlCVOkVwVsSKDsdehQXGWEXHBc72vnA== 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 DM5PR12CA0015.namprd12.prod.outlook.com (2603:10b6:4:1::25) by MWHPR12MB1325.namprd12.prod.outlook.com (2603:10b6:300:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 15:32:30 +0000 Received: from DM3NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by DM5PR12CA0015.outlook.office365.com (2603:10b6:4:1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +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 DM3NAM03FT049.mail.protection.outlook.com (10.152.83.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 15:32:30 +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; Thu, 7 Nov 2019 09:32:29 -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; Thu, 7 Nov 2019 09:32:29 -0600 From: To: Subject: [PATCH v6 13/13] drm/amd/display: Recalculate VCPI slots for new DSC connectors Date: Thu, 7 Nov 2019 10:32:12 -0500 Message-ID: <20191107153212.1145-14-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107153212.1145-1-mikita.lipski@amd.com> References: <20191107153212.1145-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)(136003)(396003)(376002)(346002)(428003)(199004)(189003)(76176011)(446003)(476003)(2616005)(16586007)(11346002)(2906002)(486006)(8676002)(126002)(336012)(305945005)(426003)(2351001)(316002)(54906003)(6666004)(356004)(186003)(6916009)(1076003)(2876002)(5660300002)(86362001)(7696005)(50466002)(48376002)(53416004)(81156014)(81166006)(47776003)(4326008)(36756003)(478600001)(50226002)(14444005)(70586007)(70206006)(26005)(51416003)(8936002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1325; 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: 7b54c632-7973-489d-7eab-08d76397b3ec X-MS-TrafficTypeDiagnostic: MWHPR12MB1325: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZB/CDKx/hysQ8JTR1+2aTPYq07ltpCsi3WNhu98bZVJxqxgPEhPhu00WqzQFF2AZZNvheN+MwQIhNpA8jUYSp24ATD2Iy4+P8Okn/EnMJ+NoHhiLgU3IElCEP39PqBjhMpO4CP+NDxMreWc49J8mWTYbyWxPp87hhv1k1w0LicCxuRoWjnNoLUHDvpxEBn3Xziy6CTqyJ2zIYKyM7dLrECdOXi6ITBtWRqy4FKKQ03CM9mbH5wHFsuINoSe0FjBK694/X5m8POAJo4GamepXV+naw0iUl3A8U4GQtdzH1Wgoo0NlOFYSUKmcEt1/EXQjsRnYrfs+T/vkbmAOo6PBPMIC02YeOiLfinQUWB1Xs2ZLLTEFStSSEWb9oMaVsXjs6BYnFRr8IkuuDKWW/7TuzO1xhVRba5oWbKAIx14n1gtMHboUJBsogijIJ0Efuk6E X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 15:32:30.5125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b54c632-7973-489d-7eab-08d76397b3ec 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: MWHPR12MB1325 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=mPV+Hb3LpUxzgcisP+S5QBg9Bjt8C1XPVsbe8bGZDKs=; b=4UDCR7LT7lOL0eOMUXHlu9WkzgiPd+xPFxXuB5zjWzRSm91AXPmUnDi8sh7x1edKkNSiDdNhwAMKVkk31n7W3kx7aUoNlTCaDYaW1aXM+r8+c23nMtA/6KYyTVWMcJU4qgehN80jPx6mQEPekIegdjWJjgu9R+o2VQbeUTX63WQ= 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. v2: use drm_dp_mst_atomic_enable_dsc per port to enable/disable DSC Cc: Jerry Zuo Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 56 +++++++++++++++++-- 1 file changed, 51 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 609020a0549e..9e6dd82506f7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4958,6 +4958,49 @@ 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; + int vcpi = 0, pbn = 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) { + drm_dp_mst_atomic_enable_dsc(state, aconnector->port, dm_conn_state->pbn, false); + continue; + } + + bpp = convert_dc_color_depth_into_bpc(stream->timing.display_color_depth)* 3; + clock = stream->timing.pix_clk_100hz / 10; + pbn = drm_dp_calc_pbn_mode(clock, bpp, true); + vcpi = drm_dp_mst_atomic_enable_dsc(state, aconnector->port, pbn, true); + + if (vcpi < 0) + return vcpi; + + if (vcpi > 0 && dm_conn_state->vcpi_slots != vcpi) { + dm_conn_state->pbn = pbn; + dm_conn_state->vcpi_slots = vcpi; + } + } + return 0; +} + static void dm_drm_plane_reset(struct drm_plane *plane) { struct dm_plane_state *amdgpu_state = NULL; @@ -7991,11 +8034,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 @@ -8067,6 +8105,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(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; @@ -8096,6 +8138,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) {