From patchwork Tue Dec 3 14:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11271423 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 B4E6D138D for ; Tue, 3 Dec 2019 14:36:12 +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 9DA6B20659 for ; Tue, 3 Dec 2019 14:36:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DA6B20659 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 164EA6E7A3; Tue, 3 Dec 2019 14:35:53 +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-eopbgr720063.outbound.protection.outlook.com [40.107.72.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D64A6E79E; Tue, 3 Dec 2019 14:35:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eaxHuG08XDq2RLJjjdD36EekvU6hyNyowzhWmlWWslZcSoCh2mYZal4PwVv7+l+KpHAJvhnriYfhU/fui9GVwtA9bwcuI5DTd4JGIaD+MxYmgQyMsmOQYhqRJGkSK/MUpA/fP7z7P44dx2FTpbBQT61WHNiiRLnZG+3J2jDYYXa3+CVSOc213o5X4YuP3v+cWELxhmLRkwE//tCddVB7TT5lgzDIGJA+ONmEAoHnWdwbKICWh4nYNSwahIpw3fcVV9AuyP9TThLMUIys4CEKOzoxrG/Fioqge0pBzopVijnMS/FHVwKot4TX77sjHam7YiJVa+EnrpaL1+6uWdVcnw== 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=+bAGsSniVhFgIW3uf4W2luVTmKF9bUZ/zY5deUTc8DM=; b=mbN3moCN3FmiCTFQHOzM0cGSqH1auzRZieTq1Zm7VZ7v/FnhhFRH9jvTM2nsd1cKfW15z4u70fSl1eq32HqdrUHE7U/YQBlcgwJ9bokJjLIsHXyzHR7YvcebNrMJcvnX3nqG5+rP6T/EJJ68JtomT2xGr+JE4X+WH1zzzGet9Qfd0jMq1HcotgMvdYBm8oZTcHswXUmRwpL8UDoXcoUsW1kpFQtcz6jGKkGvVYC8o/4CH7+ohZpLoK7LSIwxLADS4VoqWtLY1X6fU/cPb0WKvX/pmt7GStHG6q6w415zkKb85UXVaz/iajwBtnmF/jEAjgMrwMAwdM/juRyOn1P6jA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from DM6PR12CA0022.namprd12.prod.outlook.com (2603:10b6:5:1c0::35) by BN8PR12MB3377.namprd12.prod.outlook.com (2603:10b6:408:46::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.12; Tue, 3 Dec 2019 14:35:46 +0000 Received: from DM6NAM11FT054.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::205) by DM6PR12CA0022.outlook.office365.com (2603:10b6:5:1c0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2495.18 via Frontend Transport; Tue, 3 Dec 2019 14:35:46 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by DM6NAM11FT054.mail.protection.outlook.com (10.13.173.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Tue, 3 Dec 2019 14:35:46 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 3 Dec 2019 08:35:44 -0600 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 3 Dec 2019 08:35:44 -0600 From: To: Subject: [PATCH v8 08/17] drm/amd/display: Validate DSC caps on MST endpoints Date: Tue, 3 Dec 2019 09:35:21 -0500 Message-ID: <20191203143530.27262-9-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203143530.27262-1-mikita.lipski@amd.com> References: <20191203143530.27262-1-mikita.lipski@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(376002)(396003)(428003)(199004)(189003)(16586007)(26005)(54906003)(186003)(86362001)(316002)(15650500001)(356004)(70586007)(14444005)(76176011)(50466002)(51416003)(7696005)(70206006)(478600001)(1076003)(2906002)(11346002)(5660300002)(2876002)(336012)(426003)(446003)(48376002)(2616005)(8676002)(8936002)(50226002)(81156014)(4326008)(81166006)(2351001)(6666004)(36756003)(6916009)(450100002)(305945005)(53416004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR12MB3377; 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: cd3bfc05-54be-494a-cceb-08d777fe15b6 X-MS-TrafficTypeDiagnostic: BN8PR12MB3377: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 02408926C4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MPb7iE3O20OcaPu7tsQj7Ye4QN1rWH2ENn0RKO7SXh1GHIdcxyvAEvDdRzNIF0bcSQSx6oBMY5Z02ETJdPvTIbl4pJxzU32QR5cLJXspn9YxioCsIjF+iyTj6hlp5PrI2qU2w8XokTaDadwTLh48alyMU39KW313H9lH90Fej2qGdsSB7hJzITBtJ59x8qJBGI/8CP9y8Kof5p7JtEmOh5Hso5XOHuQf3fGDbmTdR/5gXtlbCBFl8ovUCelnA9xyFWYflWZ3GxfVLkkUVGG3gpkK9oVwzOkje1hUSqAqCHNe2VqF5VPcwDGpT1UT7q7VwIZNIKYh6OE4Y4VP4CQ5ZcfHFYuHwCPxAzixHd0R9UaGKIQGvGbSU4+P3TdItA9oo4FBAcqW17yR6sP7mLocOr68YZMRxxtdS7bLKpUK34slUMiWxVMLuhJy5ePecPXfndDJGeTCAVi+OUAKhAi1WS9r7FG5CDbuo9sFpclRe0akny/ci3fE3x2Pkk0d+LR9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2019 14:35:46.5094 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd3bfc05-54be-494a-cceb-08d777fe15b6 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: BN8PR12MB3377 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=+bAGsSniVhFgIW3uf4W2luVTmKF9bUZ/zY5deUTc8DM=; b=g6N4g1c9zShHy4NEca2PZpvjXDfqIbQVVGBt4JNqMhCW1nz3lhxLk526HIQzawTJWSKDi/x6XkFNAJbzP86jXoLInVOe+QkIsnbtT0nQDehNHcS44ZHoQicppba5rYMOpTt6ceNx3CJgdE6XfqSNe4wdz+l4jbATN70Rz+o0P4Q= 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 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 Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 27 ++++++++++++++++++- 2 files changed, 27 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 ae36d99d0fb2..b544498d435e 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,7 @@ struct amdgpu_dm_connector { struct drm_dp_mst_port *port; struct amdgpu_dm_connector *mst_port; struct amdgpu_encoder *mst_encoder; + struct drm_dp_aux *dsc_aux; /* 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 81367c869134..7557edee7db0 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" @@ -180,6 +181,26 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = { .early_unregister = amdgpu_dm_mst_connector_early_unregister, }; +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; +} + static int dm_dp_mst_get_modes(struct drm_connector *connector) { struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); @@ -222,10 +243,14 @@ 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); + if (!validate_dsc_caps_on_connector(aconnector)) + memset(&aconnector->dc_sink->sink_dsc_caps, + 0, sizeof(aconnector->dc_sink->sink_dsc_caps)); + } } drm_connector_update_edid_property(