From patchwork Sat Nov 16 22:01:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11247769 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 5B27913B2 for ; Sat, 16 Nov 2019 22:02:31 +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 42C1E2071E for ; Sat, 16 Nov 2019 22:02:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42C1E2071E 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 7DCBF6E261; Sat, 16 Nov 2019 22:01:51 +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-eopbgr720060.outbound.protection.outlook.com [40.107.72.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4CA36E207; Sat, 16 Nov 2019 22:01:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=etWtO2TC5h9aon/9aQFoDQcz7DiSxzlmeQ8S56R0YRE67Edhze+DGBca/QjxT2lr/RMfqxhtp0PVHlmXRRGAM04RTyLjYKxPJPh7cXcVH/kN0E+6u/fJKFJLF9/aX+IV+nYjDYTTJVSBkc7bR2okL6sSiMsWwAGNPQ5NqIpVPUlW/E/mB2CNuAYFlWFFAiLHQDzCCw0vitFNBOEq0NStgpmvGCXoZS2uVPYHghA6AcRa/pmjs4i/TVo5L5x6b09HETO3tnKevIP3CLBAT3rNeaQCJtDdk82W0YwNCOAeo4tAcYWZfhhXHb/h7g8FoDi6ZKwabT+HjP23ghi63zKisQ== 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=yqeidiPW9RKLrkVk+vasnI+/QKIxw7b0rfk8/Pv1VOg=; b=JWK23gALXsWNhqbPAcjOfsq5/RHIjP74jGTNov7GToBbFu8pB5ZQKn3eTcr3bIIa6/zo4V/uI2E7ASWcP9Zop/dib7/RyiZnD1v9GSksB27x5+XdpJwvhD66FtHsbXInCKQqMLF2r0f7gKMSMdWrQB9lCBLXyMTEDCjSQe9vQPx5moyihVgfIy/ioAgZnzyplJ1QcAkXEFDnX6/fps+aK/Rl4upqTA0J2uHBL23uyCtqS1IRppoRoNsheEY1HXOEMUT5VDCsIzEpBOekFGlwDSw16PBd7FhjtzTVAVKlikbXoVbGWo6vnwo6+1Df26xaWUEQ9LUNH+5phPGiHnwEpw== 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 CY4PR1201CA0017.namprd12.prod.outlook.com (2603:10b6:910:16::27) by MWHPR12MB1711.namprd12.prod.outlook.com (2603:10b6:300:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Sat, 16 Nov 2019 22:01:39 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::200) by CY4PR1201CA0017.outlook.office365.com (2603:10b6:910:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Sat, 16 Nov 2019 22:01:39 +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 CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2451.23 via Frontend Transport; Sat, 16 Nov 2019 22:01:39 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Sat, 16 Nov 2019 16:01:36 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sat, 16 Nov 2019 16:01:36 -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; Sat, 16 Nov 2019 16:01:35 -0600 From: To: Subject: [PATCH v7 08/17] drm/amd/display: Validate DSC caps on MST endpoints Date: Sat, 16 Nov 2019 17:01:19 -0500 Message-ID: <20191116220128.16598-9-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191116220128.16598-1-mikita.lipski@amd.com> References: <20191116220128.16598-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)(396003)(136003)(376002)(346002)(428003)(189003)(199004)(86362001)(14444005)(5660300002)(1076003)(336012)(81166006)(478600001)(47776003)(8676002)(81156014)(486006)(305945005)(2616005)(8936002)(126002)(426003)(6666004)(356004)(50226002)(11346002)(446003)(186003)(2876002)(54906003)(316002)(53416004)(6916009)(476003)(16586007)(50466002)(4326008)(70206006)(76176011)(36756003)(70586007)(7696005)(2906002)(48376002)(2351001)(26005)(51416003)(15650500001)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1711; 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: d340c302-3a88-4397-8a05-08d76ae08e9c X-MS-TrafficTypeDiagnostic: MWHPR12MB1711: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 02234DBFF6 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EuB4WGOp7BHCX/G6fzhl+vkN1l/nW5t4vE6JJxqWCiSOf8gnmvB998AF/AXX60oGSAvK9Yi+1UsJEyI/EfC0JbkVPq/zYH5UEkmaZ/H0Q+5PQCAH4zUvp9OZezxwjErLZ3MqOu3RPsUTuOBpqOD2m8LjkviFYGV8DOy7XdQK/ovTrJGKMQeD2uhlhaz2OogkivxLyM92FraRIn6BdkU4uHCYbfXuAlGcV30YeJ5TWKJVatqWwod3KGXntpuhIGIEGdxTIe/NjjmCjlR8I+tmI6R8v0TYQ/G0FxsXCuhAbJOhudOn1MGdHCgTLcAqLP8dwsRjFWk21N/BuFok/UhAdjkifIma8ZRyQn3MLd9Fedf+7jtMRrvDaGDMKQ6uvl3p+G+NRMJkzmbyEgCHD08f33YOCBqJkJKFxxf+84gJU8c/wzWN0N4srsQtGwVpcLnU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2019 22:01:39.2475 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d340c302-3a88-4397-8a05-08d76ae08e9c 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: MWHPR12MB1711 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=yqeidiPW9RKLrkVk+vasnI+/QKIxw7b0rfk8/Pv1VOg=; b=KKkjpFC1oXKhzobrd8v0uvNbLKHJYpDNICHZ2wqDv9AnY60ig4fJYjHzok9WnVzA4tO5RYlLdxH4ZglE9NKw7OKnhcCXAplnUKfLx9hcRzNXNLkktBUi3gyegJZixGzSpoQyAAlGT0LZcbKUj4nqmkg496o4xBqAEvfFhKT/y00= 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 | 29 ++++++++++++++++++- 2 files changed, 29 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..9b8f3d59fa30 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 e61eec15a3d0..02f30742d1ee 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" @@ -196,6 +197,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); @@ -238,10 +259,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(