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(