From patchwork Wed Sep 18 20:26:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11151243 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 3A4B513BD for ; Wed, 18 Sep 2019 20:28:19 +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 220EA21920 for ; Wed, 18 Sep 2019 20:28:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 220EA21920 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 3B4C472B03; Wed, 18 Sep 2019 20:27:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-eopbgr800044.outbound.protection.outlook.com [40.107.80.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1653572B09; Wed, 18 Sep 2019 20:27:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iw/+PZPFJpafIlKXcHVwVrIoVFiMJ5ZpCaOP8XEt9VtS0ooDKXXF8SHMvhorN9T8ny11vfPNz88PJRGl4uhy18Htzs40zqWpCoSWae0VUmEiVZSrTwzB4slR6oeqXyV9lxixifLPoa9JQuxQCFGW2QJ1VYhmhp1oy8EMOAN1dzOPP4W4j9iNlpv1IJn+y/u6Fi/MkYth+igpxh/6O0Oc6vKZAGaRJdjcXM8YhmOZoD3soJkdIFNIjErlkcRacF6IPU+om2TCCDDZOXsEN+d5YHndXA8WIXVr8xOEnKTWys7a1PfglyNhVAlPXPlM7bqo/+F70SW858P7jtM6RPeWOQ== 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=tirSsMSav1b2VyGxkBgD1AfuhmnvkWhyMtjylKyBOy4=; b=EfVYBfeZ5a6mn7Wvc381UxE2Sn+7hWTy5EoKKql+xpfU4ltikWYlKzEta6yTQFBBo7/0t72tiF0A1kT5uCl/r81M1x75ZnUZsTltwA43WHSGIDPj2Gh2h3MLctoJWFgxRa3qXXrsiTHcUsZMgEcPduzHWMFbWRV9SMEhmHcRBMMYOX/rNsj2U3Svde5kxPOKhj8jKuQtogKsS0lilq5urXH49keq5MDD+dDdKUXNclPMz25USRgm9P8817jMtA+oHPbcBPJqqxq+jkA6YU8HM0HBjRSZl3pgmBMlBNkbtAQbkEvAyKfR1c1ye5IpcviONQ+flTZn5q7bX1wfBiGjbw== 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 CH2PR12CA0028.namprd12.prod.outlook.com (2603:10b6:610:57::38) by CH2PR12MB4039.namprd12.prod.outlook.com (2603:10b6:610:a8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Wed, 18 Sep 2019 20:27:34 +0000 Received: from DM3NAM03FT014.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CH2PR12CA0028.outlook.office365.com (2603:10b6:610:57::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.19 via Frontend Transport; Wed, 18 Sep 2019 20:27:34 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT014.mail.protection.outlook.com (10.152.82.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.14 via Frontend Transport; Wed, 18 Sep 2019 20:27:34 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 18 Sep 2019 15:27:32 -0500 From: To: Subject: [PATCH 12/15] drm/amd/display: Validate DSC caps on MST endpoints Date: Wed, 18 Sep 2019 16:26:49 -0400 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(136003)(39860400002)(396003)(428003)(199004)(189003)(426003)(2876002)(15650500001)(316002)(2616005)(5660300002)(16586007)(305945005)(2351001)(50466002)(36756003)(118296001)(11346002)(48376002)(446003)(53416004)(54906003)(450100002)(4326008)(186003)(86362001)(76176011)(7696005)(51416003)(8936002)(336012)(81166006)(8676002)(126002)(81156014)(356004)(26005)(47776003)(476003)(50226002)(70206006)(70586007)(14444005)(478600001)(6916009)(2906002)(6666004)(486006)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR12MB4039; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0aafa3e4-2dec-4d56-570f-08d73c76a36c X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328); SRVR:CH2PR12MB4039; X-MS-TrafficTypeDiagnostic: CH2PR12MB4039: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 01644DCF4A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: jo9AvsL9pxn1wTNdPChbqLQFKtPWpP5HQEliIQ3lu5j43MA0pa6ZXgPfEFap6fvay6lXBCz4IlHnSqJ6ms2w5CYi3Kf2qeal7tQl8+tRfRzkyUKmeABn89g7dUuRPeMzm1W85e6UmHcdnPGgFVeiQiBwJRd/ZCGa9UQZcAba3c7T4vmmddKkBYZU09RpgPippIbdAB+Rf/NfXavNURMugyimyfV8HsThAKWtBUUURZbMo6aZx0pDqFHgCbFqKdIPQ4uPPyzLbV/7d9k0wqnYIQLxv3Y5V0mI+Nla+w1ZgN182fen5TsXKFCimBwOTvVgypuaToK9S8WjnBh2uWpf1NJgfeQkK+MGkIp2pac8kHqK+Y4shJNy0yTRPJN4tDJq3IWGL9pd+d4riE+72FbemnmhHDsui+zwZdBDAKOttvc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2019 20:27:34.0787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0aafa3e4-2dec-4d56-570f-08d73c76a36c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4039 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=tirSsMSav1b2VyGxkBgD1AfuhmnvkWhyMtjylKyBOy4=; b=0qi+CIDSnEXMTnQK5HIQ2lKtm+y+xwkS0BX2Ys9un/5nbSHxhT8utIUHEjEoDCGVuya5tCIZGFY+B9saywQOO1fsS97D1U/9fEVlWy62BobGG0v3uWWryJQJ/4Zz1xIXTMtZBJy+qMjPMU4yeYyv9eFiJQRLO2zIgeOopIoX5XY= 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 c36fe617eac4..1228449bca84 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -268,6 +268,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 4e1bbf5bbe77..379bc5f388f7 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" @@ -189,6 +190,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); @@ -231,10 +254,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(