From patchwork Tue Oct 1 16:17: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: 11169219 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 BB13417EE for ; Tue, 1 Oct 2019 16:17:52 +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 A336320679 for ; Tue, 1 Oct 2019 16:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A336320679 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 8D12F6E851; Tue, 1 Oct 2019 16:17:38 +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-eopbgr760079.outbound.protection.outlook.com [40.107.76.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 262A56E844; Tue, 1 Oct 2019 16:17:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ul8vW1ScFiNIkWEOFw25/bdeNSShHwl8XE072MzXEIbddaieWdGD/icPWg6XlygzbddW/3LPdESxoo2BUn2kuI747gyxDPRoonRqvHEkAz2kwbLgaxjiCUcFFTS7ABltPY7yUpJ+4RO6TKcI+xmh0l6IHMMYOXHQ6dnmM90trbf8SowQg31p0uG+uIVPXOrGcdgmR5Ih4modUR1bgVCimtBE0PBbf9kD107Yj9fKUA657hHIqulOwLQpoLP5FBJwZLori2nzcSi0iOTKHRtRcg1OXXW+WceOHz9AISa1PbawSK1GA7fyETG6tE3hEY8teBD7R27UhWcAnlLRg6hoUQ== 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=vaMfOZTD4+FHTnydunpCCEvtjmfnLYURPrXrogyVLhw=; b=VLZzS8Y0rQWvAZ3VQUjOeq4THaGB1FhIUIYG1MBZJZXYzRQ4bgpzQmOLzfDMbBfruFsgQ3z4DFlx+BmDBUVdzuYfzHMRqglekkvA6CutpwExTWOboz58s4O2m5a2L0qMa1SIh3xYmrIkddnAYlje9CldRdOo9KNMigBiKYA6KyackkSMUdWAUamqErmdhc55QN0PtA6fH6CKFzGXAKhguJfYVXKlHuMbgo7+Az6sq93RzyBNrymuqsX9zoGPuL01PBrjhwkbSAqwFoU8801zpH/CQ5BvZ/Jp2TY+OBn6ljIe7cHFN4iUZr36S40RaRg5Lbj7/j4ZMX+1X4AoIDfTEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from MN2PR12CA0007.namprd12.prod.outlook.com (2603:10b6:208:a8::20) by SN6PR12MB2622.namprd12.prod.outlook.com (2603:10b6:805:6f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Tue, 1 Oct 2019 16:17:29 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by MN2PR12CA0007.outlook.office365.com (2603:10b6:208:a8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.19 via Frontend Transport; Tue, 1 Oct 2019 16:17:29 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:28 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:26 -0500 From: To: Subject: [PATCH 01/14] drm/amd/display: Add MST atomic routines Date: Tue, 1 Oct 2019 12:17:08 -0400 Message-ID: <20191001161721.13793-2-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-1-mikita.lipski@amd.com> References: <20191001161721.13793-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)(39860400002)(346002)(396003)(428003)(199004)(189003)(53416004)(2351001)(5660300002)(48376002)(4326008)(316002)(8936002)(50466002)(16586007)(478600001)(81166006)(81156014)(54906003)(50226002)(2876002)(476003)(11346002)(356004)(446003)(2906002)(126002)(486006)(2616005)(426003)(186003)(6666004)(76176011)(51416003)(336012)(70586007)(6916009)(47776003)(14444005)(305945005)(36756003)(70206006)(86362001)(26005)(1076003)(8676002)(7696005)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR12MB2622; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e99bcc69-1c2a-4b0e-efa3-08d7468adb09 X-MS-TrafficTypeDiagnostic: SN6PR12MB2622: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ze8njQEGyZKKS9DgfDPHjbQJihvbzudOfim44LkXHj/pu2Fc+bHZ/vf3BGRrl/3JN0Wy8v+XhN4dW0i+1+a/ttdvMeGPtct8+hQ0QE8atiVxQ676uFRtspcVAXqA9XhW4O8oDo9iSZi+vfeHLFdYVE+smfXcCfFcMdQGEoZg+z352v+OJUBv5kTNDCDul/2FgtDTqtWx98LRuEWwIHveds5Se9CLSbpbcBq7QeXgp4LyTqc9GRiIWwXByOmVhzwf5D9rjpkLTx4X9NIXGnOQ1vz94Wjgi5QFEjsN/jV+wDr2i+mFDnwGlbQP3+QYYaxd1Wza6vU1WIHhm43qJdqFNBfLQVvfgf2ZVh1oPUV8L8s2r9O/K4cQXSu6k7J0ZsYqxW5MNml0ISSZvymCme8dYumw4rphD8x1ThIe4Hd1Q6I= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:28.8545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e99bcc69-1c2a-4b0e-efa3-08d7468adb09 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2622 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=vaMfOZTD4+FHTnydunpCCEvtjmfnLYURPrXrogyVLhw=; b=uP90w8LqgEcacHo9r1pNPNQp5YlgQr3lbtR/PC3woQXnczLikty0J7X0SB7a7DAE9hga/vwWBQrPamcMAbGaZMCI9CToX4vj2clXvCejSnlgfEIG+XDwkWUCetyiR3LU5QGgpBno7Gusw6fhsdubRtzh19qU/J6/ak0GnvaJ+E0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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: dri-devel@lists.freedesktop.org, Jerry Zuo , Mikita Lipski , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Mikita Lipski - Adding encoder atomic check to find vcpi slots for a connector - Using DRM helper functions to calculate PBN - Adding connector atomic check to release vcpi slots if connector loses CRTC - Calculate PBN and VCPI slots only once during atomic check and store them on amdgpu connector to eliminate redundant calculation - Call drm_dp_mst_atomic_check to verify validity of MST topology during state atomic check v2: squashed previous 3 separate patches, removed DSC PBN calculation, and added PBN and VCPI slots properties to amdgpu connector Cc: Jerry Zuo Cc: Harry Wentland Cc: Nicholas Kazlauskas Cc: Lyude Paul Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 42 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 4 ++ .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 42 ++----------------- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 32 ++++++++++++++ 4 files changed, 81 insertions(+), 39 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 239b1ae86007..3fc1afccbb33 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4573,6 +4573,41 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct drm_atomic_state *state = crtc_state->state; + struct drm_connector *connector = conn_state->connector; + struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); + struct dm_crtc_state *dm_new_crtc_state = to_dm_crtc_state(crtc_state); + const struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + struct drm_dp_mst_topology_mgr *mst_mgr; + struct drm_dp_mst_port *mst_port; + int clock, bpp = 0; + + if (!dm_new_crtc_state) + return 0; + + if (!aconnector->port || !aconnector->dc_sink) + return 0; + + mst_port = aconnector->port; + mst_mgr = &aconnector->mst_port->mst_mgr; + + if (!crtc_state->connectors_changed && !crtc_state->mode_changed) + return 0; + + if(!state->duplicated) { + bpp = (uint8_t)connector->display_info.bpc * 3; + clock = adjusted_mode->clock; + aconnector->pbn = drm_dp_calc_pbn_mode(clock, bpp); + } + aconnector->vcpi_slots = drm_dp_atomic_find_vcpi_slots(state, + mst_mgr, + mst_port, + aconnector->pbn); + + if (aconnector->vcpi_slots < 0) { + DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", aconnector->vcpi_slots); + return aconnector->vcpi_slots; + } return 0; } @@ -5197,6 +5232,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, aconnector->base.dpms = DRM_MODE_DPMS_OFF; aconnector->hpd.hpd = AMDGPU_HPD_NONE; /* not used */ aconnector->audio_inst = -1; + aconnector->vcpi_slots = 0; + aconnector->pbn = 0; mutex_init(&aconnector->hpd_lock); /* @@ -7592,6 +7629,11 @@ 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 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 c6fdebee7189..3ce104324096 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -280,6 +280,10 @@ struct amdgpu_dm_connector { struct amdgpu_dm_connector *mst_port; struct amdgpu_encoder *mst_encoder; + /* MST specific */ + uint32_t vcpi_slots; + uint32_t pbn; + /* 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_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 11e5784aa62a..5256abe32e92 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 @@ -184,11 +184,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( struct amdgpu_dm_connector *aconnector; struct drm_dp_mst_topology_mgr *mst_mgr; struct drm_dp_mst_port *mst_port; - int slots = 0; bool ret; - int clock; - int bpp = 0; - int pbn = 0; aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; @@ -203,42 +199,10 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( mst_port = aconnector->port; if (enable) { - clock = stream->timing.pix_clk_100hz / 10; - - switch (stream->timing.display_color_depth) { - - case COLOR_DEPTH_666: - bpp = 6; - break; - case COLOR_DEPTH_888: - bpp = 8; - break; - case COLOR_DEPTH_101010: - bpp = 10; - break; - case COLOR_DEPTH_121212: - bpp = 12; - break; - case COLOR_DEPTH_141414: - bpp = 14; - break; - case COLOR_DEPTH_161616: - bpp = 16; - break; - default: - ASSERT(bpp != 0); - break; - } - - bpp = bpp * 3; - - /* TODO need to know link rate */ - - pbn = drm_dp_calc_pbn_mode(clock, bpp); - - slots = drm_dp_find_vcpi_slots(mst_mgr, pbn); - ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots); + ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, + aconnector->pbn, + aconnector->vcpi_slots); if (!ret) return false; 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 3af2b429ff1b..7f3ce29bd14c 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 @@ -250,10 +250,42 @@ dm_mst_atomic_best_encoder(struct drm_connector *connector, return &to_amdgpu_dm_connector(connector)->mst_encoder->base; } +static int dm_dp_mst_atomic_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + struct drm_connector_state *new_conn_state = + drm_atomic_get_new_connector_state(state, connector); + struct drm_connector_state *old_conn_state = + drm_atomic_get_old_connector_state(state, connector); + struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); + struct drm_crtc_state *new_crtc_state; + struct drm_dp_mst_topology_mgr *mst_mgr; + struct drm_dp_mst_port *mst_port; + + mst_port = aconnector->port; + mst_mgr = &aconnector->mst_port->mst_mgr; + + if (!old_conn_state->crtc) + return 0; + + if (new_conn_state->crtc) { + new_crtc_state = drm_atomic_get_old_crtc_state(state, new_conn_state->crtc); + if (!new_crtc_state || + !drm_atomic_crtc_needs_modeset(new_crtc_state) || + new_crtc_state->enable) + return 0; + } + + return drm_dp_atomic_release_vcpi_slots(state, + mst_mgr, + mst_port); +} + static const struct drm_connector_helper_funcs dm_dp_mst_connector_helper_funcs = { .get_modes = dm_dp_mst_get_modes, .mode_valid = amdgpu_dm_connector_mode_valid, .atomic_best_encoder = dm_mst_atomic_best_encoder, + .atomic_check = dm_dp_mst_atomic_check, }; static void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder) From patchwork Tue Oct 1 16:17: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: 11169213 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 D42B61709 for ; Tue, 1 Oct 2019 16:17:44 +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 BC39A20679 for ; Tue, 1 Oct 2019 16:17:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC39A20679 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 A01CE6E844; Tue, 1 Oct 2019 16:17:34 +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-eopbgr700083.outbound.protection.outlook.com [40.107.70.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id E506D6E847; Tue, 1 Oct 2019 16:17:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FpQ3/JjOoofiaIqwHKQ7xENT2/dqO168dMIK7KQ7TgaScEV/nJ7conpUpUFXNlXvNtRCAWxA5W24yRS7AphrfX4VeXN45YfSy9tzXBpyZjmNnqRpkSLidgSlzUZABm1hp7rQ3A6EfCXFI3p026AkRqu3lOKoY3FKa26nk2WAZttypshSC9DxDRNpOh1ZwCUYrbNUvWZgezwBRIzL/t7y4LukAqF5/t3f5z48zqz6NcX5gsjpuXLy3ks9Aewys6jucOKWQjrIFwFFQ+NwR7zVebQ3KECPEFMfpQ2vqfwj4kb4Xr3TC3zWilF9uESHmtGa6n8+2GD6OQ/4KYaxeLm1Tw== 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=9GCUqS+0uv4sx9C9nX6wrBGsAPzOqTah4BvJAivSL0w=; b=RBLkGAuJ/Eokw5ph7oqvgHXxtHUqMKLnOSzpwiv98E9Vu/vOeuSGiZAolVHXFsei3hE/ECIHaNXIDDHgzs7jaZ8ZBEy87Y8iOqpGF2lb6OHqyYDyMLoKdzmWIJum5dGni9u5RLetiYPC9Yr5PvVEARzm9lfSm0PgldJTnD1H6gemb9TyMMufsJuXPeIyzJXeoCP0z96PMeYLHtyBew91v+eiz/ap0FT/JWlaZI3K2R9MeG4nwLb59TjwKuOgPsr/1wJAHE9fKOEm1KuCknNwYPVhh4W1IJoQDtNRecUztOADOUATYNkC5kHZ8CY4j6pt/na9N+NFhDvuwuOFSLNx/Q== 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 BN8PR12CA0030.namprd12.prod.outlook.com (2603:10b6:408:60::43) by DM5PR12MB2486.namprd12.prod.outlook.com (2603:10b6:4:b2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:31 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by BN8PR12CA0030.outlook.office365.com (2603:10b6:408:60::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.20 via Frontend Transport; Tue, 1 Oct 2019 16:17:31 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:29 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:27 -0500 From: To: Subject: [PATCH 02/14] drm/dp_mst: Add PBN calculation for DSC modes Date: Tue, 1 Oct 2019 12:17:09 -0400 Message-ID: <20191001161721.13793-3-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-2-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-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)(356004)(36756003)(53416004)(450100002)(2351001)(6666004)(70206006)(48376002)(76176011)(336012)(1076003)(476003)(6916009)(51416003)(426003)(50226002)(5660300002)(81156014)(81166006)(8936002)(70586007)(186003)(305945005)(2906002)(2876002)(16586007)(26005)(11346002)(316002)(2616005)(86362001)(4326008)(126002)(7696005)(486006)(478600001)(8676002)(47776003)(50466002)(54906003)(446003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2486; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 539bec32-8f81-4ea4-3b29-08d7468adc3d X-MS-TrafficTypeDiagnostic: DM5PR12MB2486: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9fsVBBH9931rYVhIyEVfwBjTh5+jLj9M0kTsAQa3IK27MwFPxquZewosTdaQGGa7mMZjApS3DN7JDTr/6ea0tEawoRU2m5CApLC3kY39iGUGBGzAGQXcKk6skF3tZNUFf7lDI/DbI0pYgE2oLng+5yHtaq98Xq42E3/qNJoRc0epq4TweF5WRLmM0gYkWB+2aQ+rzpw1jafd7GhMk4i2y6f0fPHhEE6dgnltjk6IXalEx/XIwuwjKPAFCVom5pglF/TwJeEI65suV+WxTHT3svotFp29rRyMdHpMUHAYcaxEtDM2f+xbmkP+pULfuqdtYZ9PsgKf7HLk2ghXXpbwDVKA4um9U6pMAd00MSblQoqLZTm+z4onfHzshWjDfJB4nltASNcpTXY3WARewzzxlr6r0LoDUa0tOWdUVbeQ53k= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:29.8095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 539bec32-8f81-4ea4-3b29-08d7468adc3d 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2486 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=9GCUqS+0uv4sx9C9nX6wrBGsAPzOqTah4BvJAivSL0w=; b=xYLSCVPJdYDTegJfElF2GYOnzBa75EWHXDyd88mtGQuEUNF3lbM14ArTL0WNwNywiaBHVt28DEW3QHYyKktH9yoDUFOgM+ffMBYDkNjp3OaFs+mcNir7WDnArCGt1S/cM5p1kVtAyfFgvksoVjDt9OMq4/L06XHGruwu6q4B+tc= 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 3fc1afccbb33..59114b52090d 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4597,7 +4597,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, if(!state->duplicated) { bpp = (uint8_t)connector->display_info.bpc * 3; clock = adjusted_mode->clock; - aconnector->pbn = drm_dp_calc_pbn_mode(clock, bpp); + aconnector->pbn = drm_dp_calc_pbn_mode(clock, bpp, false); } aconnector->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 Tue Oct 1 16:17: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: 11169211 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 9BFA617EE for ; Tue, 1 Oct 2019 16:17:42 +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 842E420679 for ; Tue, 1 Oct 2019 16:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 842E420679 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 3AD996E84C; Tue, 1 Oct 2019 16:17:35 +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-eopbgr790053.outbound.protection.outlook.com [40.107.79.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B2036E846; Tue, 1 Oct 2019 16:17:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h30lW0gBW3ylhKPXBqUI9pOAwVR6ns2YdbyvMKG3BTXNZPXIia1m5Fh1rXq9OJgQkA5TGbR8hAuwXFQgTI7dKF2sDIA7KVts3o4mfNtoJ4XssYU3ooxkeAT0vmW+2Mk+CC41WKYLL+hZI5/Um10ON28Dmu24XubokS5U0wvjqOiscM8nUshsg0cab3YyWxGzCmkY0LvKqBOIsK4ic9t8r6AdvLiff2wGa3ssIYVE8CqS9u6d4dhUUpItnWE/IfsAmRDcyynPnLdYolXjkgRHkhOzSB9/1gRcsei2ouc1+i4Q295gNykCsUNQK8AFv0P6ajjRwc8GE/WFi6MrcS2GAA== 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=fKqAIsxQN+yC1kTp9AJCCEdH3S9Uop0ZsEfCQCORbec71ALQn3JHZwjUol0XrReSiMzaLvfvyfEDhy/rraktDs6uAfwpxklmyyk2Fwe7rVRbfPLxbyxSORpQuSHVDxS9tPckUnvLEvDmlM48GuQe7OeJpt3ww0h6JxmtP8yu1sD6xeRWx3GAZnKBQ5txqI4160WnM1JXbqan3jiny/zp4IdFEfrMNCKvXT8hAelcP/8nml2EPfokzyjA3c2qT7hF/744qybN2DTS8w2tCC/96UAApuACZ1kSe924LNHxSvx0XoUYbLGSaoolWVQ+YD23ml1qlofbqbVkEIuUxeMfnA== 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 MN2PR12CA0021.namprd12.prod.outlook.com (2603:10b6:208:a8::34) by MWHPR12MB1758.namprd12.prod.outlook.com (2603:10b6:300:10f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:30 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by MN2PR12CA0021.outlook.office365.com (2603:10b6:208:a8::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23 via Frontend Transport; Tue, 1 Oct 2019 16:17:30 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:29 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:28 -0500 From: To: Subject: [PATCH 03/14] drm/dp_mst: Parse FEC capability on MST ports Date: Tue, 1 Oct 2019 12:17:10 -0400 Message-ID: <20191001161721.13793-4-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-3-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-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)(39860400002)(136003)(396003)(428003)(189003)(199004)(50466002)(7696005)(47776003)(2351001)(16586007)(316002)(446003)(76176011)(53416004)(51416003)(336012)(1076003)(4326008)(54906003)(486006)(48376002)(5660300002)(6666004)(426003)(2906002)(356004)(11346002)(186003)(126002)(6916009)(36756003)(50226002)(478600001)(26005)(450100002)(86362001)(305945005)(2616005)(81166006)(70206006)(70586007)(2876002)(8936002)(81156014)(8676002)(476003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1758; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c357375d-a50f-4f9f-73e6-08d7468adb9d X-MS-TrafficTypeDiagnostic: MWHPR12MB1758: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TINeW7ifyfCXjOThULXex51R6cM8j34J0WbkHfEe2XKBTaKmfxGOJnHmA0Il5MHAbaJxmzw+2LyQ69ZkuWfHVpqw7/ss21iCPJRML/0xxneWY6meMNK3RMxzkgIkW0ckl6B9kYZFaZNIbCFJLO66ek2ds2tXudC774X/F1dHxjdQ08PJdyEwwFCYy4vkMr2fWOmgMIkf0S0XVRbxLFzrLaZZBwHP1mcRA80VpKMV+JaRxlGQHnl2OMlfBu4w/AxlT1Be6wAMEDGJ6YMSAexT1v1wdcuOjyMETnWen49MqFCKt8gN/bz/UdIkQ/RvZRsCeLka30DAOJYbzi/VaTiudDQ27PMSyFEJMvmac4lFf1CXKgg0AVs+XBzGdyip/k5RtgUhuL9PnPUIzFFmPeqqsUER48/XfubIDDurjq6iSek= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:29.8243 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c357375d-a50f-4f9f-73e6-08d7468adb9d 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1758 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=OzNU1d5k2lUuKeMBF9W7ee5s6VtyzKCzoixrzjMXpvDOfdj6a/mvyE9UcQfMmU5yY/hl6P+u/Db6TbCubZooIY4RUYkK6RW0y9NlPLeu7OJE7YMU1x5ce7qb7Q8pblh5lvAjfLQMh5NjQ9DlbQ58OfjLi3ekbXnZJHIUhv60/74= 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 Tue Oct 1 16:17: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: 11169217 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 3ECD217EE for ; Tue, 1 Oct 2019 16:17: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 26BB020679 for ; Tue, 1 Oct 2019 16:17:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26BB020679 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 6E33B6E84F; Tue, 1 Oct 2019 16:17:37 +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-eopbgr730073.outbound.protection.outlook.com [40.107.73.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id ECD996E844; Tue, 1 Oct 2019 16:17:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kVsvh15oJQyzgYI3DQP3RqAE+6HXysARPTpicpyrmyOG6p60NcVe9NQvmDPDTfDJDbx3wxfaGOsK61TCO6IepLL9fz9qUlarQyKrkxIT6Sb7LNvJiy1MsGCzuufhoAGpzv4GlB/h1rQQ76QdC/iBRFBnPS11mjJKFPUjslumUUSWSn3TATdSwJbl8SDQubNq0dG8LUr/L0ZTV9s6weq+MLuAGjJFD0+V5ZXev5LiwqQLuw13vMuoO1YMnlQbIPqhdp0RBUONZQ5Y6/o4w/WzVFLydIzidFxszsGiARLpUED8ZewTMsdk9xIXUEnIRKNmC+84JU4TZ+PcoaVTld0rrg== 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=iXbiYfljFK+FCxUHfshxYitCtTKCr9KPjrlLso5+a4A=; b=EihZUvd5Os7hVFHMpg/goxkhjuOsrywxbeD+H3shG+2JiwR0ByWDj6QYtstpFOqZFrN4nEQRn7Zzsd1yVuF0LKUU/5TWLukwgQGY3bYTiXv6c3vz3G+/QBWiFm2viEUDoE8EqBk3fic2USZRtl3k0gN3/7fmT2YQ/U/EihChBQ2t59jeIDnRss6hBjxQNx3bRg+ubiSw7wBb5rSh4C55QatLgnhtu5Hvf1jmDYHB3TXG385Xdz8/ov8P2IAWm/G5tmZ2FWvkcXRVEtRj27eLfO+K1MyBQ7TGkDV6TfV6GOxtx2SJqJpZk4x8d3KJimmWHqa3lJ8wo8HOCrJGr3JC9A== 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 MN2PR12CA0021.namprd12.prod.outlook.com (2603:10b6:208:a8::34) by MN2PR12MB3888.namprd12.prod.outlook.com (2603:10b6:208:168::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Tue, 1 Oct 2019 16:17:32 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by MN2PR12CA0021.outlook.office365.com (2603:10b6:208:a8::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23 via Frontend Transport; Tue, 1 Oct 2019 16:17:32 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:31 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:28 -0500 From: To: Subject: [PATCH 04/14] drm/dp_mst: Add MST support to DP DPCD R/W functions Date: Tue, 1 Oct 2019 12:17:11 -0400 Message-ID: <20191001161721.13793-5-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-4-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-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)(376002)(136003)(396003)(428003)(199004)(189003)(4326008)(36756003)(2351001)(2876002)(186003)(76176011)(26005)(7696005)(51416003)(6666004)(356004)(450100002)(2906002)(5660300002)(305945005)(54906003)(86362001)(47776003)(446003)(70206006)(336012)(478600001)(50466002)(70586007)(14444005)(11346002)(426003)(16586007)(8676002)(486006)(476003)(126002)(53416004)(8936002)(50226002)(6916009)(81156014)(81166006)(48376002)(1076003)(2616005)(316002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3888; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1a7e0b9-7bbc-4c15-3206-08d7468adcc2 X-MS-TrafficTypeDiagnostic: MN2PR12MB3888: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZGPQN8hUXZB2t5LQP9RhLyWzC8/sPzjHWOT32ovUDVrEuInrHuHCKyyzDkqacQlmgDb6c2pR166ZJNZw01U4Dq0t8KNsQmYyxcMQ87OobVw8VQwuT/KJZqOkvkvwj5icHIBMD7mYef2GLeGoNfLiDYC+1GVvEXMomzMb6FbxLa9/vp1aIad6jhrqPQN2MAjzqZOx8RK8GceVH1BlICiUZLmzNME83bm4Vi7A/afJXJljffj1e3572/VOZvl+2xY6KCl/uJUzmcYNVB3rf174mfy4RqdMgQPwbG3aR/i6tXQkGSVcB9IwKJBF4e7VS8bdGUdX4YMmzHwig8MkjOcc8XKRMrhhC0ZKgVlNXSJ/Mb9KKLt07nuLwiVLAHQHMJk9omy7UKvTWycEr+oioXQGmAl5q/CTA56Lu6Z8WKxnDeg= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:31.7458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1a7e0b9-7bbc-4c15-3206-08d7468adcc2 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3888 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=iXbiYfljFK+FCxUHfshxYitCtTKCr9KPjrlLso5+a4A=; b=mCCe3gSSk9X4P3pYswmSst0difdGOQmJu75q94tIriwRbf5LHSKOhvo6CPZMa/nvVA1wXqgsgNETYCQsv/2vtRxRFl65MmXE8SrBBS4WTUqbQpAU4BdFuFF1NNHf8JV2pBrpyV1JP82qbwbOLdhWr3mLa+EnrX87NvGnBaHTg9k= 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 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..418cad4f649a 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_mst_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 Tue Oct 1 16:17: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: 11169215 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 A96681709 for ; Tue, 1 Oct 2019 16:17:47 +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 9190220679 for ; Tue, 1 Oct 2019 16:17:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9190220679 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 660E26E84E; Tue, 1 Oct 2019 16:17:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810051.outbound.protection.outlook.com [40.107.81.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D8476E84B; Tue, 1 Oct 2019 16:17:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n9T06qHVm1I0fU4vLn24JIQIsa696ILdgA7JEOag7j63q45uARy6QGO2/uUrPYSRWo8g/bSSTLaUBA/Jv1iy8+NO4pHQsamyDt0+KUpHMRBpUJJjfiv7staBt8E4sjMU5GRl4SAYuMcCFiGcuEp5sXoMVzNEogmPOwR9QIroYmRUGVTkaROsrdc3OrrzQZO1hdWpSynwZxntqYbQDxTmz/YAJIaLz/F2xePLjGfJMrFxDPjrCqFXxyZAWmSk92nPb7XgJYZbGWuJHzIJFmT6c3jVORv2xVethPBvPMLYL8atABaJNwlFoBI/2OnpCUKMogVCrpKimWkQz7YHRXwlsg== 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=HJWxToK+CRnIjf0nHd03jAD6msy2cVfmPowdi/fkobvZLkw9/j7RneUHyIBrNXnetkCyKR4M8gioTzTrGf9yamdM2iIxL8PsX5GBwV4hsmFPfhVRKzpACL9ixDYsmxsy53pjQW25zsYij28kHCqJ5QrhIXNqFhyzS5DRTYTJkz3oHXdZpQj7W3oYSUPN4tMctHFbzYaY/k0cn+fEiTc8XupboT7d3LvgBCwW4VLRpG63FyRheKy4uJilamBQRDbNCu3z8EX4B9kSk3ww/8nObd7p1xKEvPTkdRZ6+wAw1V2RhuG0uLXV7RpbflbkSFo7a7M2uJosUXrtyo15+i/LQw== 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 MN2PR12CA0023.namprd12.prod.outlook.com (2603:10b6:208:a8::36) by MWHPR12MB1743.namprd12.prod.outlook.com (2603:10b6:300:113::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:33 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by MN2PR12CA0023.outlook.office365.com (2603:10b6:208:a8::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17 via Frontend Transport; Tue, 1 Oct 2019 16:17:33 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:32 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:30 -0500 From: To: Subject: [PATCH 05/14] drm/dp_mst: Fill branch->num_ports Date: Tue, 1 Oct 2019 12:17:12 -0400 Message-ID: <20191001161721.13793-6-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-5-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-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)(346002)(396003)(39860400002)(428003)(199004)(189003)(336012)(7696005)(446003)(11346002)(2351001)(6916009)(126002)(478600001)(2616005)(426003)(86362001)(51416003)(5660300002)(48376002)(476003)(50466002)(70206006)(70586007)(76176011)(26005)(6666004)(186003)(47776003)(356004)(14444005)(8676002)(1076003)(450100002)(316002)(54906003)(16586007)(36756003)(4326008)(486006)(8936002)(305945005)(81156014)(81166006)(2876002)(2906002)(50226002)(53416004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1743; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5e0d6a4-7afd-43eb-f418-08d7468add49 X-MS-TrafficTypeDiagnostic: MWHPR12MB1743: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FEUa8y9WGoN2o6EbAv+ZtUd4+3ovkIxrMSypKLNvcU6TrTPlobVaSO8kUjllGyQKJjswRuV/ccmoHYTaRb4b1j0Hz/yAICFblXNwEFuAWzKMNoDGcriTPUpua+FckFcGmYAMDNCw10pXIYuH1LziJhpkPkSIp88fW2gCdyn0DtWqWzqV+zajOSt9xFWinRcN9QaxqPAE7BXTARo3nU0eU3m5c6uWiO8fHOB2Dnk1Du27nklAOH4pUNQ4lxMY0pf5Src3Dbl0pzzobrMi7OEiSJPoIlU1z4k1QVbrguzoOEq+QBGwoTK1HEqNCggBPC+PBwBFxx4SUQZ7Ekkc8ikitbKKuYspJCgXoL8hP7PQESd3o72fxe3VMWNBZA/qOQ5Khqm7Yhhsg7gk4rSxA1mVjC+aIufFQbq/6AMYdCV3aes= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:32.6195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5e0d6a4-7afd-43eb-f418-08d7468add49 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1743 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=uAgADQ6PSLN+pcLi165mePsEA2TMF3hbQ2GNuCHIPbWz33dcZmVIBsTFNWVXDrFu9vKREK2vK3pIOFwl/ikt6P+bo67CVgy8FQsik6drvT4p+zhQzXLMOF5fIMd4ImyHsAPwSfxbechju/N81QQSHWZTq6nTlk8WBueDLVAfv4o= 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 Tue Oct 1 16:17:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169229 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 0EFBA1709 for ; Tue, 1 Oct 2019 16:18:06 +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 EB66A20679 for ; Tue, 1 Oct 2019 16:18:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB66A20679 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 666116E857; Tue, 1 Oct 2019 16:17:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810052.outbound.protection.outlook.com [40.107.81.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 211B56E854; Tue, 1 Oct 2019 16:17:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hcy8O8w88AKbEyDXn8pddwvcS0gqur1rwengFS/ca33Gvu6kxFyouk3lPBP9wr4DoTNdzqSwZteTdkqaohPD9tuPz1fnCmLVETRnn8M6OFiw82fjViIUhcxXnYtrdzG0gHtCUrtY7dZfSIZBS9NUim+mj3YrTErkZXhRf+5CdltID+kB1WCoffgORSp9MocflozQ/uSiqxZLbXuy40ZKdoMuJ11tB7LbqAJb/abVBcMeNKO5+j38eBV/3SNKwuFvYLO5hm47GWstI5ot8k7Z3rPXnEnGWAHa0xJEIxa4XS9yM1iCxxMkoAVcq40fsvLjYXamgGh2BXsOAeflvADtjw== 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=YhncK+nzwDxej7K0CFa9hDi3dBk4AOl8tjfxXxkjKGGEw5+EzNdoQNe70/d63AG7S8a3MxF2+1tSY4raLmMmTjmbbkobbHFRlPu0jQeimJr7o7uV/qDwAtRMtjNxWEIBOXgkQX4mgOySKcfwwRJSeVknItGxWB/QLPzGroNOBvn7cTq22xJ6Y8b+oPpvGm38xin5J9pLJeoV6BOll5bhYzgrJV+EZo9/WW/TUn4n3mscyvwgkLMuv/BUr8OHKfJA+Pbz9IGREBSvwQUM+88FTLjNyQVBo38K7TQsei3sPHFIWiw20QBRCbHZXeiPtEHYP+nB9fb6WGkdJkIRT7o9SA== 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 BN8PR12CA0022.namprd12.prod.outlook.com (2603:10b6:408:60::35) by BY5PR12MB3939.namprd12.prod.outlook.com (2603:10b6:a03:1a5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Tue, 1 Oct 2019 16:17:36 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by BN8PR12CA0022.outlook.office365.com (2603:10b6:408:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.20 via Frontend Transport; Tue, 1 Oct 2019 16:17:34 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:32 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:31 -0500 From: To: Subject: [PATCH 06/14] drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux Date: Tue, 1 Oct 2019 12:17:13 -0400 Message-ID: <20191001161721.13793-7-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-6-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-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)(376002)(136003)(346002)(428003)(199004)(189003)(48376002)(1076003)(50466002)(36756003)(316002)(356004)(5024004)(6916009)(4326008)(14444005)(16586007)(2906002)(2876002)(6666004)(53416004)(5660300002)(478600001)(86362001)(2351001)(126002)(486006)(7696005)(336012)(305945005)(11346002)(476003)(8676002)(47776003)(26005)(70206006)(8936002)(76176011)(81166006)(450100002)(70586007)(50226002)(51416003)(81156014)(186003)(2616005)(446003)(426003)(54906003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY5PR12MB3939; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71c21260-c14b-4c0e-ba8d-08d7468ade46 X-MS-TrafficTypeDiagnostic: BY5PR12MB3939: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U1U3K3BVTXopBl5X5yFFY4O3t8nSPeUHW5PxrleWtfvac+Xi1Vv/2NEVZSJNTBATPmVL1A2Enzq8D1VcfK1RfahldNuo6PODIs8+mdCui/aGRZp6/WlsJrJXMaGUDwHLyAwcitI66FK7c+l+fgvnSUj5I2J5E3GUIO86C2G3HpqDAlJXzW3ulOU6YCMoIqDwH/gCOSQrilh52eW+UsTU+gotyd4KOKAfpiSgVctJ3vK+E+7dhiCWSXeYeofwcPCWjxj/pggdq3slk/LT7RybtSucCOOJK2h2Cj4wrZQD3wd14GQDo3j5NE4oWiAohi9krXItBrLyFs+151+Ie9bYIiw7GU/QYWBnKzvaD4M2H1X74Cy3RnnHeBtYx2GLH9DaS2kWht7j1LDFGhU5PrTKEZGDF/UKVh7D87E5ae1vFY4= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:32.9640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71c21260-c14b-4c0e-ba8d-08d7468ade46 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3939 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=cp6SyhNs+dg49R06I+gK1dF4QyJfx+VR348EtF0AMVjKeyy9M5ukHWH7yQpTLiNyksOWLcKeBKOeN1SJOQbYCtqejkzGpFSaHbpZwmF4SHyxvepXtpnFlVq+5Z2+wrmvjdkReiaJKpDJpvIqaCtG28lDVnL1nZJyYLrs0wN3jg0= 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 Tue Oct 1 16:17:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169221 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 CFF9D1709 for ; Tue, 1 Oct 2019 16:17:54 +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 B83CF20679 for ; Tue, 1 Oct 2019 16:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B83CF20679 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 A97ED6E850; Tue, 1 Oct 2019 16:17:38 +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-eopbgr720042.outbound.protection.outlook.com [40.107.72.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 28A8D6E84B; Tue, 1 Oct 2019 16:17:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ImjmfSCFElzQHDG5devgSObcv3JAiMOEUri5A/04HoU0YilAwJNwEuuPwXYL+RGKvJfLllnOIGrlvzSL9IIuCCJ8Av1BnVilId5Fs3YEr3YaGw2vUN/mxp7vmZsgE2mYnldwy1nGTFq/T3rpU+f/jxKtuxu9/zN1iqh9Zj3/XX9xwB3rFBXGIQZSwnnGt+zix0mWqDddsJCWhTG52WKgc94kf+sTTEwBpwNoL/RErS08c7UulWKp+7P2vpp0pvNzF5XrxabWwXk4MXbsvEPMdodyNyspicEy9ffsoDXzRUS12fTN9hqlPGuE7PW3rLLeNaxUvQQ5Ql6MItlMTW15Kg== 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=K7xA58T2hbz0F/NcnJeC72jc4UVZ6stnu1hOnr43Geg=; b=ejlVRPf7lEiRTveH0BLsBiYVf/sirVBztVAcLfdrC5w3AXNTB7YvfOGAvRFQpodiFZ1HkwVxiB7EH8eQ7K4j+F1ihGCQB4py7z3a5mHmsvzyKRUj2NFTbDpgbUwl+A+k1uP02rBlk0SYTdqRy7FiViOveMzentitIRxQpOq/+fporkRmwK+/ZUAzSKgIZXViL0OB6oTEWy53P2dcHzwpSJ1ghNADTh3ANGXhD0CRDG3E5P8IF5Fp/N+sOaq6mZi2wS+YcRLdkDT1Fi/C9lJQohPLjjPbuLUoodpY85czwLNGQyJD8uh4UXK9RzfcATKWrS2hnljfVceJvdMIjSRfhg== 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 MN2PR12CA0021.namprd12.prod.outlook.com (2603:10b6:208:a8::34) by BN8PR12MB2914.namprd12.prod.outlook.com (2603:10b6:408:95::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:34 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by MN2PR12CA0021.outlook.office365.com (2603:10b6:208:a8::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23 via Frontend Transport; Tue, 1 Oct 2019 16:17:34 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:33 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:33 -0500 From: To: Subject: [PATCH 07/14] drm/dp_mst: Add new quirk for Synaptics MST hubs Date: Tue, 1 Oct 2019 12:17:14 -0400 Message-ID: <20191001161721.13793-8-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-7-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-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)(346002)(396003)(376002)(428003)(189003)(199004)(8936002)(450100002)(51416003)(126002)(478600001)(8676002)(2876002)(16586007)(5660300002)(6916009)(2616005)(476003)(486006)(50466002)(4326008)(7696005)(36756003)(305945005)(186003)(70206006)(70586007)(14444005)(54906003)(86362001)(76176011)(47776003)(2906002)(336012)(356004)(446003)(48376002)(26005)(426003)(53416004)(316002)(81156014)(81166006)(6666004)(1076003)(50226002)(2351001)(11346002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR12MB2914; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc54d833-2caa-4146-c2ba-08d7468addfe X-MS-TrafficTypeDiagnostic: BN8PR12MB2914: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZEoFogv1klxs8c2eluXaUBHuxU7VEqOrKSTlJ744UkthcNz9KJGgCWd41IJzJTl0XByv9AyN04mwJPLjYMbAP2sSoxPfWzoSZCUow5ebKeFUnJIVC0vpP2kW6NdYSt+MzesHfc81qEs1FXFUBlbXtzgzs0YV3yHyMCJ9jPxfpQnxM427KhFXYox40gUuFW7jlY4XZWHGNipAm3FTuPKo7ekGN7lW9MaY6bA0JuOD5Q+f0t77DZmDiqbyxYg99/5KOVQSeQ3x1oiPRCuofkOPlehxfvPp1tyhZLUQk/NGGBH+oF6pcl3wBcgMA6idY6F/OXK/h7qkD7tuQm9Pi/J/hI3obOi88FHNDfA5uT1knx33kDbZRQJNi69DQS8Sa+WnaGANUQVu/itoGoREv65x5iuykv4BbNgBAJdHWSf5PTM= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:33.8104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc54d833-2caa-4146-c2ba-08d7468addfe 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2914 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=K7xA58T2hbz0F/NcnJeC72jc4UVZ6stnu1hOnr43Geg=; b=l2hSiFF2T/6J+qYJiegxwnmBLDH6v5L00jei8fzhPcOygIj0PNNJQCyhMvGwEs6kCptRLWvDxX60667PZC4+hVDIZsnGGoZ745n7okLTt02xMYAJCMlH7WnwktPBfr7Zlt6w2AybcGUBXhPkoluBibW0l1PTPJHf86EyyJJdHig= 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 8364502f92cf..a1331b08705f 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1434,6 +1434,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 Tue Oct 1 16:17:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169223 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 A359917EE for ; Tue, 1 Oct 2019 16:17:57 +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 8BCD82086A for ; Tue, 1 Oct 2019 16:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BCD82086A 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 78CE96E853; Tue, 1 Oct 2019 16:17:43 +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-eopbgr680079.outbound.protection.outlook.com [40.107.68.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF1E66E852; Tue, 1 Oct 2019 16:17:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SRRhxUiof5MfZd8ERy+sDov9IxAY5vBl/5zJVPFXH15B/JsBm2amD4I2DmxoSAdQleF0YkXXKzW8d+5fUW7PpZXHlzCPtWms89iI5hBfSKMnO3UNMRUDmqa6yXIEwzjOgvh+NaAyTfyKQzGU84XYwcArCGML6sK1pf/rA+ubXyZyqyWsHvFFODesRFf+YNLP9UgBCfEmoJIO7NvhsgPRVehNrPkucGNQcrXqsb7u5kJBwmLpP81UyBvqlRn82IAhPlLEly5FitxOjp4tAZMvwucsNlBPZ+JnyEA3gtcHl15fnI0gerzvASLCaNy2FNQubc8BYD2RAn0XW273IrFY+w== 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=PnBHuuiuQ1sajCrfHlq7oqhaie/z4McnjjT9VodgMm4=; b=gIOev/cuTfMa7JlXiWuQIVifzp0s6g2Xibgs5j1haeGgiNYmjPNv0G/LDTdU/TvpzG8pyyo9BzG0vHqIO+R8GlIr9lM/c6cnL2zB7D37SBzvsQccpKNTalwjJ7wayZsV62oIdL7sNqXm+imPloanldLX+lE/wqgrUZYkX8LHlp05aMFvVZpK9j9ynXtV1MV6PJRqpFCqG6N+BvcHf3dDogtwQOuD7hWcyMB3xxzfa2L/PuwXQr/jUnohlnAmULIWf1y879jzHOW5t0RNfxPa8Y4f++DRCsCf6e85tpkSI/KSd0b+9X0p/o0f3Joz5oAxrnkHHmZskVOJOAwVrbtryg== 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 BN8PR12CA0016.namprd12.prod.outlook.com (2603:10b6:408:60::29) by DM6PR12MB2635.namprd12.prod.outlook.com (2603:10b6:5:4a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Tue, 1 Oct 2019 16:17:39 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by BN8PR12CA0016.outlook.office365.com (2603:10b6:408:60::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.18 via Frontend Transport; Tue, 1 Oct 2019 16:17:38 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:37 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:34 -0500 From: To: Subject: [PATCH 08/14] drm/amd/display: Use correct helpers to compute timeslots Date: Tue, 1 Oct 2019 12:17:15 -0400 Message-ID: <20191001161721.13793-9-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-8-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-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)(346002)(376002)(396003)(428003)(189003)(199004)(81156014)(8676002)(1076003)(426003)(186003)(2876002)(356004)(6666004)(336012)(5660300002)(8936002)(47776003)(81166006)(50226002)(48376002)(2351001)(53416004)(50466002)(86362001)(316002)(16586007)(76176011)(305945005)(70206006)(70586007)(478600001)(54906003)(4326008)(486006)(450100002)(11346002)(446003)(476003)(14444005)(126002)(2616005)(6916009)(26005)(2906002)(7696005)(51416003)(36756003)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2635; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d415ff6c-1a45-4611-2215-08d7468ae03f X-MS-TrafficTypeDiagnostic: DM6PR12MB2635: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZUexOwgyT6YFZtk7O7mvN3JiNPO8OIGpAjxxr/ywSYlMHkDfCHTKdFd3/GylqxqZRC+/631J3/+kVU9MZj29b7qVXhJ4SDbcbf0BaeYRU8RBBlLvStqWozt7wz72OQtpkxNYwsLjaQJDQDO1NbTtnBe8XWiG0rgIUAdtHwADlk4chevZOxKYZchd4OJCXlZlwXSV7ZoRQGxcjmhvLlJ2Y1JCJqJJJPICkcEzpfI84xxOWql6ZQL07DTOKGQIphUW8HokXK8r7e6Llt7HzBAF4RbqxGxJuheAzX5OsQvvXqZlzoM7DmqRNwsjiEE67GHQFFlVNhbQsiHrUuPiH1c2v0tSQpPOOfn5YOlByPOiym5okTq64wfVEGHMf3RHMqvScPaHU6MdH4RJTdpVpPgP3hrsPy7EZyAmv95VMBBirnE= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:37.5998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d415ff6c-1a45-4611-2215-08d7468ae03f 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2635 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=PnBHuuiuQ1sajCrfHlq7oqhaie/z4McnjjT9VodgMm4=; b=k6m2Ew77T77qGxotYCY7Pnc5mYkV1mXoeJnGztOdJ5jbHHuszzwBuMSoGoTIf/KzKwiVgMCKfKJrh/Ygch3UWWe+kIXmLXjm0KdrUQDsGQBksVZ+6NRRlOl3KwMDgDh+klj/g4pLloc3n3n3t7ZaZ0mGu4mhEzjwHE3gFC+F+94= 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 , Jerry Zuo , dri-devel@lists.freedesktop.org, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis We were using drm helpers to convert a timing into its bandwidth, its bandwidth into pbn, and its pbn into timeslots These helpers -Did not take DSC timings into account -Used the link rate and lane count of the link's aux device, which are not the same as the link's current cap -Did not take FEC into account (FEC reduces the PBN per timeslot) For converting timing into PBN, use the new function drm_dp_calc_pbn_mode_dsc that handles the DSC case For converting PBN into time slots, amdgpu doesn't use the 'correct' atomic method (drm_dp_atomic_find_vcpi_slots), so don't add a new helper to cover our approach. Use the same means of calculating pbn per time slot as the DSC code. Cc: Jerry Zuo Cc: Nicholas Kazlauskas Signed-off-by: David Francis --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 5256abe32e92..fc537ae25eeb 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 @@ -185,6 +185,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( struct drm_dp_mst_topology_mgr *mst_mgr; struct drm_dp_mst_port *mst_port; bool ret; + int pbn_per_timeslot = 0; aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; @@ -200,6 +201,11 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( if (enable) { + /* Convert kilobits per second / 64 (for 64 timeslots) to pbn (54/64 megabytes per second) */ + pbn_per_timeslot = dc_link_bandwidth_kbps( + stream->link, dc_link_get_link_cap(stream->link)) / (8 * 1000 * 54); + aconnector->vcpi_slots = DIV_ROUND_UP(aconnector->pbn, pbn_per_timeslot); + ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, aconnector->pbn, aconnector->vcpi_slots); From patchwork Tue Oct 1 16:17:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169227 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 4CE5F1709 for ; Tue, 1 Oct 2019 16:18:04 +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 34B2620679 for ; Tue, 1 Oct 2019 16:18:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34B2620679 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 94BB56E854; Tue, 1 Oct 2019 16:17:48 +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-eopbgr700083.outbound.protection.outlook.com [40.107.70.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA5D26E854; Tue, 1 Oct 2019 16:17:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lWeYOiY5EwlJHSJ9a52VaxH2q00gU95XYlY2le2B1r9Fe2A0nQ680/gOeYPwPblQXy7P2khbmcmt7liIwrISmHEasRBsZv4oSR+Wqc6HNuOibIhv0FSJD3StATrvhZ9bRVgTMoPvYkicnKzhEwUMDW3m8BoFxuPqdmfrJmC3psZAiyVQs1W6dq4nrc07Czqe0/tqkj5kMO1+z1Sklun40lA/BuewDLiBp85F5noH3FcyTeENTVN1z58DxV3xsOzoT16t22hDX3ZcJJUqjuUdRTMJtfxKyutHAZtZfRu1Zc7ZClQgcEdqZ5vZ2nOgdFqPaqilgyIJV2qRZ8X9yr+lbw== 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=YtUHwiSB+5ThPSMYYFafCbyqjBOcl+keepUKwIkBAYA=; b=SVaMFDOQSBxKpQTKMme+U0AE0D/gdZKtujd6CZT8a90BRD96UMNv32OH47nKGp7mFe/cigCfTgmU1T3qfDDanqxs8Eu4XxFjkigkDiPVeJiDWVAN5de29I5zCP5TnfbQHzAyFZwU6IWD/8698a+lfJpvUMtcivbMX7dVvbfAVkMiq8MPMXIFuh6Q9gCszI6VUvtCOKNSOhPni5ldRIQSv6KbYQmLvT8JSiXu47fR7+mHfKXqMYc+/BHGksj4V8VQclboyJRwI2gxXL3KOufqaFAnxx3x1D2KPUp3XGSjxW9o5lDegZhu9rAIOtRg5/s8bbnFJl9WBsFaH6R+YVynpA== 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 DM3PR12CA0101.namprd12.prod.outlook.com (2603:10b6:0:55::21) by DM5PR12MB2358.namprd12.prod.outlook.com (2603:10b6:4:b3::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Tue, 1 Oct 2019 16:17:44 +0000 Received: from CO1NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by DM3PR12CA0101.outlook.office365.com (2603:10b6:0:55::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.17 via Frontend Transport; Tue, 1 Oct 2019 16:17:44 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT051.mail.protection.outlook.com (10.152.80.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:43 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:35 -0500 From: To: Subject: [PATCH 09/14] drm/amd/display: Initialize DSC PPS variables to 0 Date: Tue, 1 Oct 2019 12:17:16 -0400 Message-ID: <20191001161721.13793-10-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-9-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-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)(376002)(136003)(39860400002)(346002)(428003)(199004)(189003)(336012)(186003)(11346002)(1076003)(450100002)(426003)(5660300002)(86362001)(305945005)(446003)(2616005)(53416004)(2351001)(50466002)(26005)(4326008)(6666004)(356004)(6916009)(48376002)(54906003)(51416003)(50226002)(486006)(8676002)(8936002)(2876002)(2906002)(126002)(81166006)(81156014)(76176011)(70206006)(47776003)(36756003)(16586007)(316002)(70586007)(478600001)(476003)(7696005)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2358; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 90de3c1c-9076-472c-ad96-08d7468ae41e X-MS-TrafficTypeDiagnostic: DM5PR12MB2358: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:345; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Wt2lCMHbN2Q+S6tTLL4KV/uiIqHAKwIOiKDuVDavdCEzOqyooLIW6j+4b6mVkwdoVw0+1HiqtDIGN+eL7TUL9YKsmhXIBV0fm/ynO7wsn8nyw2XSCXf4r/gcg3aPzFehEMB8rN2ofv5K2CTiOqX/P+q6dQDIyxiTrVk5J47g8pnoUaQnBOv9h7yfw+uU4ulZlfD0rVmnDsdjcTzXwxXfYs7GBjkt6iVIKXctvpF5FuFBiVTj4BvRcUad8qYFy1cKZ6houAXSOOwJU2/JnoARo3PdipdXdy8lgCdN01cCtk2mBHSOecxRHNvtwjoy7R2cU0bCu2bKP9PdrFNX8dQR2G0iD5nZxYKjvXnb0vyzI4vwvCrybTLqL6PGKfVBI7pSCuePLITAkO1VVr1prSNu1sEWyMRtRLLvTKaaz5I+cE= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:43.2173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90de3c1c-9076-472c-ad96-08d7468ae41e 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2358 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=YtUHwiSB+5ThPSMYYFafCbyqjBOcl+keepUKwIkBAYA=; b=ETsvTXo/clTKTvllM9irsbOttEoKOSeZLUtIpojZcyzl+xA5JoooHMAjkHpuouQSD0E2k/dKU7a1Iaw8bV0l238R7gcO0w0KhmaNS0NsT8/SHqXHiQzVZ8b2JWQve4Lhcvy2ftJTT+L4GFaRrPcx54t9NqmSo2DAwWyb+hmLWYA= 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 a519dbc5ecb6..5d6cbaebebc0 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 @@ -496,6 +496,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 63eb377ed9c0..296eeff00296 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c @@ -207,6 +207,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 Tue Oct 1 16:17:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169225 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 058281902 for ; Tue, 1 Oct 2019 16:18:00 +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 E1E4820679 for ; Tue, 1 Oct 2019 16:17:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1E4820679 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 56ED86E855; Tue, 1 Oct 2019 16:17:46 +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-eopbgr790089.outbound.protection.outlook.com [40.107.79.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 617846E854; Tue, 1 Oct 2019 16:17:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CsALBvQhY2LoAZP5c/H4y6xDjaEJQDFSj299qP+H3mZJ6SgepzePH+fNffUHxM2R7s23OL2XYQYoyaop13HoU3Vr9W0wNqh//bVERE0kTFDGHYL8LRxSyO70Y1b0QivXauGu3WH9+d4g1Llm9brJGWJIY6Kwp8A2dSGY54sBDPI+3XX+Uf1U1Br1eNUHQtwLqYPRSwOk4OBBHHLqLoATM7KZwp1IFwBB3OgJnuWDJldcDJVngu1xoc0opiENwtMOV2fj8h4W3niertUHdXsJ9vpwdx7U5/gqPFT+0oV0YRfuyPQjzZscrQM9G60dBU/Lknr+ejPizbVvCua9hL6vAA== 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=klLwLc0qRYCDWNg+laesVThdIWL/F/MRC+QP7wI6e2s=; b=m2/HOfIjUaegwgbd8+C6fFM6aUyXJG3pvAqMLlVJ9JJ51pnCQpOkhvHTykgoTgsiDHEdSVUROUQmGR33WBajXv8RsiPOuvW/OCt4IJN9+EGfVCzGN7RsMYrAokGhZR394duWAKLSlTf3MTCeYea10fgFwdlBUq2BUmYDyEXJXqqe09z9oxC9R32QeRLv8iTd8U20NMeZZN8rwWB+zxLu0EWqZkXDdnVkZ1UsQhNFpxnVZZm9nNarNor1JcViPD+hG0bEJk+SkMG0nWAmuio2l/xvv5I5Knjzasfw8qTjVfwiOLkVaqSgZsBS1oOKlil/I929ZhAVRGNeUfYhojutmw== 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 BN8PR12CA0017.namprd12.prod.outlook.com (2603:10b6:408:60::30) by CY4PR1201MB0216.namprd12.prod.outlook.com (2603:10b6:910:18::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Tue, 1 Oct 2019 16:17:42 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by BN8PR12CA0017.outlook.office365.com (2603:10b6:408:60::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.18 via Frontend Transport; Tue, 1 Oct 2019 16:17:42 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:40 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:36 -0500 From: To: Subject: [PATCH 10/14] drm/amd/display: Validate DSC caps on MST endpoints Date: Tue, 1 Oct 2019 12:17:17 -0400 Message-ID: <20191001161721.13793-11-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-10-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-mikita.lipski@amd.com> <20191001161721.13793-10-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)(316002)(16586007)(54906003)(8936002)(50466002)(70586007)(70206006)(15650500001)(8676002)(81166006)(81156014)(50226002)(86362001)(14444005)(2906002)(305945005)(36756003)(2876002)(47776003)(48376002)(478600001)(186003)(6916009)(26005)(2351001)(76176011)(7696005)(51416003)(356004)(6666004)(450100002)(1076003)(5660300002)(53416004)(11346002)(2616005)(476003)(126002)(426003)(486006)(4326008)(446003)(336012)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0216; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b703967c-b07b-48eb-596c-08d7468ae227 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0216: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WvHz18OEbIO0Ul3eltSBfqDrTRrd5RJFVOTYyX3WjOuQt4OPzslkg0lzPG77Zb4J8Zw7B7sz/ilTRW9l/ild3nadxvRyOl2rX3q735ot794kXQOxt/Pry2fNaYC5+zxgjURgJQPn3YTcnKMlF/paFUtoJuVI+laGZDXKdI3g/QXJdHLNH5Ht3h/QAMD/Q1watHt9VmhLZkr0j58Q0DUWq6YVuyotxdnfusjtP94OBtSXXnIwtgVOtOK5ne7aV2EEKtRkonjzXZYXtOxTYLRCXbPhWTElgf4CGESFlsjHzEyCQTqLtV+RNtpBNWGy1U2AK5QEOJw0J84zeW+ML6K1sl8/hcqJc7d/Sd9JOoP7fkbMC512BZzcyN29ByNA856jsik+7Z/TQt1AplrPet7MvLTd0SLlfAH3wtY/6yP9KwE= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:40.7963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b703967c-b07b-48eb-596c-08d7468ae227 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0216 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=klLwLc0qRYCDWNg+laesVThdIWL/F/MRC+QP7wI6e2s=; b=FoQhpb5AS0qMbXHbeFQNeyc7IL1Md+psokreDTJS/WiKZy2kcZmxJxRVeBhjYFIiTbNgWAO8HSaXAyIw60Fd79XATeKNUJNrn5MQ+sll7xqlMWZ+Nhnw4uaCoxs/eBUuvRQSFN0arxSR2D1eFmIdoDtj3BK3zNMhyIGZXjExoAk= 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 3ce104324096..8bae6f264ef1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -279,6 +279,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 /* MST specific */ uint32_t vcpi_slots; 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 7f3ce29bd14c..270d972c9c3c 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" @@ -187,6 +188,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); @@ -229,10 +252,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 Tue Oct 1 16:17:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169233 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 F070E1709 for ; Tue, 1 Oct 2019 16:18:10 +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 D856421783 for ; Tue, 1 Oct 2019 16:18:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D856421783 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 484036E85D; Tue, 1 Oct 2019 16:17:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810087.outbound.protection.outlook.com [40.107.81.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C9016E85D; Tue, 1 Oct 2019 16:17:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a22KC4EjSBruv+7qLH4L49k9V+3vGm2VHuWdbtz0fyQ1wwSFJOBWT9/va7vvNZ098mBwAFMjN9rSLXP5+u5ZbQujjOe8MDCaGKlkEi7uIPHlgo+G4v3r0dGH3um+G7H48ENAChEAPBU19GUQaMqa8toAvhQNXRcP2UYi0O3XAsnRh36VrH+gB6K4I/FHVfY66koMe+ILTqFPmkARjwRRnI7RdZEe0BS27n20FKMaL6lRJTlm/bZXLUPrO9IUzTtSm8moIF4C28Pf3BrPsAA2MNnRHIPuxTXqIzi9EVKF7TNNJBUSGQ99jH/OGainGOssDrJfXdx1qhPxwENQX2CNGg== 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=zFI8dwOAXIyxzqrG2zQrictp2X9M0Vha2J2j662sJJs=; b=WBhZgPZSyMbWzQ8nA1UKYugc3jPc2iCp38uTa4VJUD5vqhrqGHY23znNEKVop/NNbj7bttcnkGBpPcqRIZfGvWJwvbGuZJqy6gHQuW3D7sqRGezCJrio/0l4BrNWwtMUys3FuhVLDsavVEwOz2w5habf0uCM415T5J79hN/Cu46b8Fouo+hPxHVeeEQ5weupuReiNpYz39OJkFTpmNt8iQs8aLVgeZLO4qAP8dIhfOaNE/OQpvhm/rYiaMnAVN8sKFLys1xebHmoSBTOF2JxfCX5uaXUb+Z4SF36HaC7xDAY74lW2GKzqcHkLsnHTcUP8kEL8OOw8NijkW5jIHSSsg== 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 BN8PR12CA0030.namprd12.prod.outlook.com (2603:10b6:408:60::43) by MN2PR12MB3582.namprd12.prod.outlook.com (2603:10b6:208:cd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:47 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by BN8PR12CA0030.outlook.office365.com (2603:10b6:408:60::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.20 via Frontend Transport; Tue, 1 Oct 2019 16:17:45 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:44 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:37 -0500 From: To: Subject: [PATCH 11/14] drm/amd/display: Write DSC enable to MST DPCD Date: Tue, 1 Oct 2019 12:17:18 -0400 Message-ID: <20191001161721.13793-12-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-11-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-mikita.lipski@amd.com> <20191001161721.13793-10-mikita.lipski@amd.com> <20191001161721.13793-11-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)(136003)(39860400002)(428003)(199004)(189003)(76176011)(36756003)(336012)(450100002)(53416004)(7696005)(14444005)(5660300002)(51416003)(26005)(1076003)(47776003)(186003)(2351001)(50226002)(86362001)(305945005)(356004)(2906002)(81166006)(81156014)(4326008)(48376002)(70206006)(50466002)(70586007)(54906003)(8676002)(446003)(11346002)(476003)(2616005)(6916009)(478600001)(426003)(316002)(2876002)(126002)(486006)(16586007)(6666004)(8936002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3582; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4033ff19-3a12-4046-3575-08d7468ae4e5 X-MS-TrafficTypeDiagnostic: MN2PR12MB3582: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A1xm3H9uLZ/ERBh8TZnFs8k5FydsmdKDfQRD3gGAnbneCyoz02jk6awu+GO32DLuoAcpOPP0byzFtdCUQq4SbMSwHPd4Gp5M6aV+L0Ki7iITCir31LuKQjK0M5EpB9Z2LVTYYRG+BKwhzJl3no/ohGjsl+84/kce3nFB76y9taBK9h16ddlBCh+uRZaF+xESntD5JWPIg5VddjY9Ez0kMYSrZRXwUODHoDeWTUkoE/VbRXZTxo35UoMHdymzfiC53kA7TWerKekpFmWEX96lPovnpu1vWPs9w4FpjqL+eeeYDw51Pl985qBEvfB6hBtWgRQrkEiQeQzKuIsFa0Bd/1N5ng/CgrYH4pWBastFocWXy9rrWuh2i2WVdB6MTNfOpMRHVN+ZXAR3NZdpxKyEmIM2HOsGQuT7Sza/nBOOBkg= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:44.1560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4033ff19-3a12-4046-3575-08d7468ae4e5 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3582 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=zFI8dwOAXIyxzqrG2zQrictp2X9M0Vha2J2j662sJJs=; b=XykyIERh9xI4u4rcewYqpMMD0z0RrXXBdz0aWoAycUeO9P1+pyTPllberUv+wT3Z6O92DkspUVpXyeO+2wdNY31Hm46cCtP9u1cF2wyj73941ku8l6ZFGt+A0GPCbH7xOizz0HUTPczoB2JXtYA9y2jpTjNCoEb0yUjJatjwRDc= 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 fc537ae25eeb..bd694499e3de 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" @@ -518,8 +519,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; } #endif From patchwork Tue Oct 1 16:17: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: 11169237 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 0114E17EE for ; Tue, 1 Oct 2019 16:18:15 +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 DC54C21783 for ; Tue, 1 Oct 2019 16:18:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC54C21783 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 7DC566E85F; Tue, 1 Oct 2019 16:17:59 +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-eopbgr820085.outbound.protection.outlook.com [40.107.82.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 237556E85C; Tue, 1 Oct 2019 16:17:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B9EAD0Qm8afvdChnofC2sF6uK9ImHhEMS6mvFX6fDjjzeu8OzeMiKLxBXzElCYpfhajhpgNa3FkKPHQla+g+aqX1AzktnLtFtJug1YOdfqgPMT0Gx/TpwWetp6PFmjir7oFaUY/qAed6WrpsToCIqiF4Umj8Y/jxwvQGx0O0HeZF0qzrog0ZJ2GHdPRaZWkEj5uBDmafr1z3DYLAnhMjR7OeBf0kWacRexbkjKKNmZhBoh20sBDPSt81jn+/FItZHUp8pM7OrxH6GFDisxy+NE7A6CZnt1bEoAxTD+KqJmixxP8Oqo2orbSLopeHm8WTw4B6PYrwGg6J+3xULnjoKw== 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=agOJCQWCcFpY+X91yX0TDqkWQaOPs1wmytUzsXC52TI=; b=PtxI2ES15neZJME4b1G3Sz9CvjJHnkCfT09+eNMaXCTF3LddaT8CeiPVeTZNwjXwxbDJ9ytWVZ7zjVRKInXJXzM+5DnWfOoe5vkIKKwuQcOoaGlROr+h4lkJiWuVEi2CFaH/fH44jjkdZ/NDrBv0E3yVx4UqIhiuqynlv0zXtEQrSGwxDiZO1IpJ3c4nVpHE7Squ6pCS6Jdcu7+svQxEWNitN2RkGSMSAnutWu0PC15yWa7ZuRzcZ5f8eMyctuDn4NbxigHmOvK6jPGBREow5jrmrHW41lOkPu55aW13nwyn2waJUkyywpJ1BC4Pwh3pbAScbv3/rOqc+0XTKXyKyQ== 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 DM3PR12CA0108.namprd12.prod.outlook.com (2603:10b6:0:55::28) by CY4PR12MB1143.namprd12.prod.outlook.com (2603:10b6:903:38::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:47 +0000 Received: from CO1NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::202) by DM3PR12CA0108.outlook.office365.com (2603:10b6:0:55::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.20 via Frontend Transport; Tue, 1 Oct 2019 16:17:47 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT051.mail.protection.outlook.com (10.152.80.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:46 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:38 -0500 From: To: Subject: [PATCH 12/14] drm/amd/display: MST DSC compute fair share Date: Tue, 1 Oct 2019 12:17:19 -0400 Message-ID: <20191001161721.13793-13-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-12-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-mikita.lipski@amd.com> <20191001161721.13793-10-mikita.lipski@amd.com> <20191001161721.13793-11-mikita.lipski@amd.com> <20191001161721.13793-12-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)(376002)(39860400002)(396003)(428003)(189003)(199004)(76176011)(50226002)(51416003)(7696005)(16586007)(316002)(81166006)(81156014)(8676002)(36756003)(8936002)(26005)(54906003)(186003)(2876002)(4326008)(86362001)(2906002)(14444005)(356004)(6666004)(336012)(426003)(47776003)(48376002)(50466002)(70586007)(476003)(2351001)(1076003)(30864003)(486006)(11346002)(126002)(2616005)(446003)(450100002)(305945005)(5660300002)(6916009)(70206006)(478600001)(53416004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1143; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00942597-a2ae-48bc-6eb8-08d7468ae5dc X-MS-TrafficTypeDiagnostic: CY4PR12MB1143: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNK0Hd/tsSPJ85rwGQ9BMOoiLpDReA6EqSkD+wQKzfzvm0vFW7hRwrJtKe3rm+XVgXN5vAcxmN+7rM7yNaUJZ5+O1hbrKvGAGo5Y+6Po4nKfhRmqCobR8qAjULT8BNutvqpryYINgO4IR3GZaL/L61R/NOavYvtUYWENeMmF+3YZx/nmCxpfxZvATrtwJYHuMYXkDen21SNwcj5HaJ9UIbFz82AckuZm9fD/AfeznUlE4YEV4nRTTRQT1DwNELDXrFulEh7YfryeNRq82giBbBqXBv0WxVNLs2Bx+0NHiMAPl9n52nJN/aAzAPoPWUenLMNEnoo43eZlCZokKNRbdsfK8KBdB2QZi2REskhqf6paFhnb3CCeLTnzxLuChaGpkq03yRJbwIabq/h06H1rNIm3/sGpSK9y38v30iBUzLE= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:46.0165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00942597-a2ae-48bc-6eb8-08d7468ae5dc 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1143 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=agOJCQWCcFpY+X91yX0TDqkWQaOPs1wmytUzsXC52TI=; b=3BL4qdD3PL6PclxhjHsVPHsiGtHZZ9+IPfzRsPW/5d/Pcj5sNLg5D287W4tbO2xr9M/hzmCh7XwbeXvH6q4z5wUIG849SezYYcZugjfIbeov4heDJFJr2jJ4XfzXy+JtULJL+RPB7k/l70H/1FKf/CKT+gw6KBW/+2qhJiIP6nk= 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 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. Reviewed-by: Wenjing Liu Signed-off-by: David Francis --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 386 ++++++++++++++++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 4 + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 7 +- .../drm/amd/display/dc/dcn20/dcn20_resource.h | 1 + 5 files changed, 400 insertions(+), 2 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 59114b52090d..81e30918f9ec 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7702,6 +7702,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(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 270d972c9c3c..6b9696889668 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 @@ -490,3 +492,387 @@ 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 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; + } + + if (check_bandwidth_limits(dc_link, params, vars, count)) { + 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; + } + } + + if (!check_bandwidth_limits(dc_link, params, vars, count)) + 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 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(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_dsc_to_stream_resource(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..da957611214a 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,8 @@ 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 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 f57c686398fe..98ad803ff224 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -1447,7 +1447,7 @@ static void release_dsc(struct resource_context *res_ctx, #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT -static enum dc_status add_dsc_to_stream_resource(struct dc *dc, +enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *dc_ctx, struct dc_stream_state *dc_stream) { @@ -1462,6 +1462,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 */ @@ -1513,7 +1516,7 @@ enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT /* Get a DSC if required and available */ if (result == DC_OK && dc_stream->timing.flags.DSC) - result = add_dsc_to_stream_resource(dc, new_ctx, dc_stream); + result = dcn20_add_dsc_to_stream_resource(dc, new_ctx, dc_stream); #endif if (result == DC_OK) 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 44f95aa0d61e..2209ebda6ef6 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h @@ -131,6 +131,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 Tue Oct 1 16:17:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11169235 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 D10E81709 for ; Tue, 1 Oct 2019 16:18: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 B8F2821924 for ; Tue, 1 Oct 2019 16:18:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8F2821924 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 C4EBE6E861; Tue, 1 Oct 2019 16:17:55 +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-eopbgr720083.outbound.protection.outlook.com [40.107.72.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE71A6E85C; Tue, 1 Oct 2019 16:17:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YYsIJOtwi/7NB1aRoARZxLSqsp+u5Tzl7hTY1dXZ9tlDLRkwRCmZtZI1hp0dxXPhsJN1r/vTf0tGSpplYG24JC72bGpcS0j5AvncZdrfCxcXZncf9/NlbEiLa4MWTaKU4MhET7CGw2dx8+ZZEJbXOQq2DozkeHAZJHr2/pT2m9tKjM5luYVmabf2BRkwe8lHsH4hd814oFNKKnn2CVYKsndhzgi7i54glLA6Tv0HT++N70fNuzUpiZsAckYrG0SIHBXafkvrdRjbLiAnYnU4JVkOxYjxTQAxxQNKwyKkYZwqlncILUk5+H90+vOoPRVNUGypqyJaVMCbIhu3xhxOuw== 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=zhgE7SnYNUh+YgxEXWIAEBbXDLkxlHvQje5tJoKA9yQ=; b=VYj8sZT9TGXvDfL/C86KVUsb/DlxiQvgPs0Cg8Z12sbTxrxCMwEHeRR9iaPPb9xtrfOCSP3jxZR219ZtPk76pU9HJV0YjQXtg0ndGds2nKg7AZm6L9KWZL4B9pkQSM/fgP7jc8v+oWWoClqmSnjoelrtLoNGhT47vPkjfScSSSlTBasP7wh5+BSQMs9IPn1AY468AP7npG/RyYDTCK4gHqv3Sd3uggVlZy/crVhpgYCux5Bbrya41X40Y/QU2C3MPjxGTZBidq22IJnkOlGB6grlq9UOeVL1FxwHcEXxCpUETVxQDjpuQ28WKCzgZQBBniMfPSXrlvcsZpK4Ew6MBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from DM3PR12CA0108.namprd12.prod.outlook.com (2603:10b6:0:55::28) by DM6PR12MB3212.namprd12.prod.outlook.com (2603:10b6:5:185::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:50 +0000 Received: from CO1NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::202) by DM3PR12CA0108.outlook.office365.com (2603:10b6:0:55::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.20 via Frontend Transport; Tue, 1 Oct 2019 16:17:50 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT051.mail.protection.outlook.com (10.152.80.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:48 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:39 -0500 From: To: Subject: [PATCH 13/14] drm/amd/display: Recalculate VCPI slots for new DSC connectors Date: Tue, 1 Oct 2019 12:17:20 -0400 Message-ID: <20191001161721.13793-14-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-13-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-mikita.lipski@amd.com> <20191001161721.13793-10-mikita.lipski@amd.com> <20191001161721.13793-11-mikita.lipski@amd.com> <20191001161721.13793-12-mikita.lipski@amd.com> <20191001161721.13793-13-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)(39860400002)(396003)(136003)(346002)(428003)(189003)(199004)(50466002)(2876002)(5660300002)(16586007)(50226002)(14444005)(2906002)(8676002)(316002)(1076003)(54906003)(81166006)(8936002)(81156014)(186003)(426003)(336012)(446003)(11346002)(486006)(53416004)(7696005)(6666004)(51416003)(76176011)(2616005)(476003)(126002)(70586007)(356004)(47776003)(2351001)(36756003)(6916009)(305945005)(70206006)(478600001)(48376002)(26005)(86362001)(4326008)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3212; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 457c4435-fdb9-4aae-8d4c-08d7468ae773 X-MS-TrafficTypeDiagnostic: DM6PR12MB3212: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5xJ13gjURsn/LZBGpDME2LIqiXE4b22Aj7Zw9RbG6aL3OQ123RXQhh1S6hGbUldW+gESjceVGYSFEW+OzvMErRBdr0LyIVmitHbwXSMfHAewL65IRYMAkaZra/jjd79D9xUEs03twrYv/EgDibEXiEXHoM1gjrPourKjpdF5Y0W6/ok9CU3VUANCqqbnVG3PEwtwSekkm/P4bITb0hQb+Hl0eUSR1ZRSzrN27VGwaUBt5bgppoMTO26xLHaAyA2jNDUE1OrcRDw06nU5nNkm/ZVZnn8EVQjgz4eSPHz8hwHXRfkRnI+GjjbEnI9yMrvs/lSE53L4xK6G2cNXOmg7E3z/E/VMDOiepdIf+tzGfyETqWohbuwnHgknJtUaBpS0b2w3+DfuC9Fhc+EzO0eVolp1O0hWRv3Z/XtMWTiVIT8= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:48.7166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 457c4435-fdb9-4aae-8d4c-08d7468ae773 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3212 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=zhgE7SnYNUh+YgxEXWIAEBbXDLkxlHvQje5tJoKA9yQ=; b=3N3YCDZLD/6vIzZldHKbQeaRsop47Svb2WhdSNCGDYGambnnWQEG3B16200fbp+4KUqqZGi49zSF5zIS7eok3F2WBHDe5P/fcz/QKGHAjGJ99It3rtYXr86+JGL4e379o2XtnEmrCuCzyzmJ8Kjqao+b9Zt7asE5IB3rMe6lly8= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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. This patch proposes to use similair logic as in dm_encoder_helper_atomic_chek, but since we do not know which connectors will have DSC enabled we have to recalculate PBN only after that's determined, which is done in compute_mst_dsc_configs_for_state. Cc: Jerry Zuo Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Mikita Lipski --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 64 +++++++++++++++++-- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 6 -- 2 files changed, 59 insertions(+), 11 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 81e30918f9ec..7501ce2233ed 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4569,6 +4569,27 @@ static void dm_encoder_helper_disable(struct drm_encoder *encoder) } +static int convert_dc_color_depth_into_bpc (enum dc_color_depth display_color_depth) +{ + switch (display_color_depth) { + case COLOR_DEPTH_666: + return 6; + case COLOR_DEPTH_888: + return 8; + case COLOR_DEPTH_101010: + return 10; + case COLOR_DEPTH_121212: + return 12; + case COLOR_DEPTH_141414: + return 14; + case COLOR_DEPTH_161616: + return 16; + default: + break; + } + return 0; +} + static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) @@ -4616,6 +4637,36 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = { .atomic_check = dm_encoder_helper_atomic_check }; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +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; + int i, clock = 0, bpp = 0; + + for (i = 0; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + + if (stream && stream->timing.flags.DSC == 1) { + bpp = convert_dc_color_depth_into_bpc(stream->timing.display_color_depth)* 3; + clock = stream->timing.pix_clk_100hz / 10; + + aconnector->pbn = drm_dp_calc_pbn_mode(clock, bpp, true); + + aconnector->vcpi_slots = drm_dp_atomic_find_vcpi_slots(state, + &aconnector->mst_port->mst_mgr, + aconnector->port, + aconnector->pbn); + if (aconnector->vcpi_slots < 0) + return aconnector->vcpi_slots; + } + } + return 0; +} +#endif + static void dm_drm_plane_reset(struct drm_plane *plane) { struct dm_plane_state *amdgpu_state = NULL; @@ -7629,11 +7680,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 @@ -7705,6 +7751,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(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; @@ -7734,6 +7784,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) { 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 bd694499e3de..3e44e2da2d0d 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 @@ -201,12 +201,6 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( mst_port = aconnector->port; if (enable) { - - /* Convert kilobits per second / 64 (for 64 timeslots) to pbn (54/64 megabytes per second) */ - pbn_per_timeslot = dc_link_bandwidth_kbps( - stream->link, dc_link_get_link_cap(stream->link)) / (8 * 1000 * 54); - aconnector->vcpi_slots = DIV_ROUND_UP(aconnector->pbn, pbn_per_timeslot); - ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, aconnector->pbn, aconnector->vcpi_slots); From patchwork Tue Oct 1 16:17: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: 11169231 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 43E6617EE for ; Tue, 1 Oct 2019 16:18:09 +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 2C0FA20679 for ; Tue, 1 Oct 2019 16:18:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C0FA20679 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 C96776E862; Tue, 1 Oct 2019 16:17:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770055.outbound.protection.outlook.com [40.107.77.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D4896E85F; Tue, 1 Oct 2019 16:17:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AC2EpuHKmrgl9HGET1LnEtL1tlUPJj1TV1nWbGLBuE6b4W5uyi7sxLqWFGrOnvbzNBwmKSiXAcxMC7m/5NkaFzV4UpyZtVWVt4JvMx67iK3CvblpU61+NT3E2d5LR5lFu6GBg/Rf1HnO/GKn+GbfdpqZvAAOFD6kvLL+ARd8u9f5IC47cGy7kXjdx8mhshwGrXha1ulYxzb1GZ4VA5xW6XfIHriF935XDQf+OcowcAdINrO0PMjgrDEOjjFWWpovyadg4SDE+8dmMV7AYmh2TV8F78i2mWPhxj+zC65FnRZWGKthHQ37Jqm48eJf/f4x4y1zuTjJp9F6zOAI4LCL1Q== 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=sggqry2rHdBKGLVlluhu/5dBl0eopBo0TyVURrldDDI=; b=OnXPPjnuHk2ZXUpuq5o+lx9OkhCJvVsbljwYPBaGY9NiBjYgqhZqeWS6T2u42R1jLnh7Hla5FL7NSJDOtkEW0twgCUKm6I2VqSyACk7E6XipjA6ii4G2g9zju/xGrhahDhc4WXw2uRdcmHbnrkhgpzZPrzaPEujcKMmLwJJDXTHNLw0S/y/bHy5MwolTb1cDQ+ZB3vAhf5UJUV5Fg71cQc6kWrfP6S7QLgKckNUMeodm+OXLLYo6GWWeUcO4dah1+eKSp2I91NAVGD8QXD52vC8KL+7m2TlEjqdcAOV1TpZf9e7MsdldvyMqCr1Cg3k/EgkZT9f8FOd3hy7oGX/vdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN8PR12CA0016.namprd12.prod.outlook.com (2603:10b6:408:60::29) by DM6PR12MB3196.namprd12.prod.outlook.com (2603:10b6:5:184::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Tue, 1 Oct 2019 16:17:50 +0000 Received: from CO1NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by BN8PR12CA0016.outlook.office365.com (2603:10b6:408:60::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.18 via Frontend Transport; Tue, 1 Oct 2019 16:17:49 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT027.mail.protection.outlook.com (10.152.80.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 1 Oct 2019 16:17:48 +0000 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Tue, 1 Oct 2019 11:17:41 -0500 From: To: Subject: [PATCH 14/14] drm/amd/display: Trigger modesets on MST DSC connectors Date: Tue, 1 Oct 2019 12:17:21 -0400 Message-ID: <20191001161721.13793-15-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001161721.13793-14-mikita.lipski@amd.com> References: <20191001161721.13793-1-mikita.lipski@amd.com> <20191001161721.13793-2-mikita.lipski@amd.com> <20191001161721.13793-3-mikita.lipski@amd.com> <20191001161721.13793-4-mikita.lipski@amd.com> <20191001161721.13793-5-mikita.lipski@amd.com> <20191001161721.13793-6-mikita.lipski@amd.com> <20191001161721.13793-7-mikita.lipski@amd.com> <20191001161721.13793-8-mikita.lipski@amd.com> <20191001161721.13793-9-mikita.lipski@amd.com> <20191001161721.13793-10-mikita.lipski@amd.com> <20191001161721.13793-11-mikita.lipski@amd.com> <20191001161721.13793-12-mikita.lipski@amd.com> <20191001161721.13793-13-mikita.lipski@amd.com> <20191001161721.13793-14-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)(346002)(376002)(39860400002)(428003)(199004)(189003)(76176011)(70586007)(7696005)(486006)(5660300002)(476003)(26005)(11346002)(50466002)(446003)(6666004)(126002)(356004)(305945005)(51416003)(70206006)(1076003)(478600001)(2616005)(36756003)(47776003)(336012)(16586007)(86362001)(8936002)(8676002)(2906002)(81166006)(81156014)(4326008)(53416004)(186003)(48376002)(426003)(2351001)(50226002)(54906003)(316002)(2876002)(6916009)(14444005)(5024004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3196; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e3a807f-4be2-4e2b-32f3-08d7468ae6f6 X-MS-TrafficTypeDiagnostic: DM6PR12MB3196: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0177904E6B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DVB8tJpU2YoI2x1AbWKfKAuDy8NkfgA1ZPEScMctLAKOaKBQjBHJeLGZDyU//FhYi77ewAB4hi9YVuY3CcLvkiDgeYP1Vk0TtDj4C0Mula2wQeMmHB80rnkEx6hj+QnGkn3FT5IhwrfJiD/2QocKBSYtX6GbrjXfY1zBSJ6Fhp0JL3g4PQtpd57CYmX//Ug50ibwgFdUal3DpYISUrYWejNMfEsKhUNNYxFYDgwmaR9Y4FRseLhhLQuf6S4zYBXQVa2K58C82LkOVbm+HGMmOlir/4kU/MfNzC8NlCCx8Yi7QLHVEx5caI2QsjvwYrtKM0jpegDY9g67GVNfQkEhB0jEky70saB+jCbuHoD++omKgRY4JnUDXevj0RthXVX2f5yN1jcNOMd5myFE0zmhswHzbr6sXN5RsKLMxYRovfY= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2019 16:17:48.8428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e3a807f-4be2-4e2b-32f3-08d7468ae6f6 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3196 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=sggqry2rHdBKGLVlluhu/5dBl0eopBo0TyVURrldDDI=; b=1v3gfv4wfKCMhF90KrX/C6K1ZfEE5Kb/DpHdi0oorbpIXjrJ4UN5XHxyPJnk2PB3yYYm67Xay5Zka3rQbLgtMkKP2Y2LhUck9wtOe/O3RSG7sgfomenJ88keUKxzwKzLzzk4bIUV7tIgoKO/U4nRE/CP0TmTvjRmEq6+sVNAbwk= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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: Leo Li , David Francis , Nicholas Kazlauskas , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: David Francis Whenever a connector on an MST network is attached, detached, or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing. Therefore, whenever a crtc has drm_atomic_crtc_needs_modeset, for each crtc that shares a MST topology with that stream and supports DSC, add that crtc (and all affected connectors and planes) to the atomic state and set mode_changed on its state v2: Do this check only on Navi and before adding connectors and planes on modesetting crtcs Cc: Leo Li Cc: Nicholas Kazlauskas Cc: Lyude Paul Signed-off-by: David Francis --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 79 +++++++++++++++++++ 1 file changed, 79 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 7501ce2233ed..371086a67c68 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6888,6 +6888,74 @@ static int do_aquire_global_lock(struct drm_device *dev, return ret < 0 ? ret : 0; } +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +/* + * TODO: This logic should at some point be moved into DRM + */ +static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm_crtc *crtc) +{ + struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct drm_connector_list_iter conn_iter; + struct drm_crtc_state *new_crtc_state; + struct amdgpu_dm_connector *aconnector = NULL, *aconnector_to_add; + int i, j; + struct drm_crtc *crtcs_affected[AMDGPU_MAX_CRTCS] = { 0 }; + + for_each_new_connector_in_state(state, connector, conn_state, i) { + if (conn_state->crtc != crtc) + continue; + + aconnector = to_amdgpu_dm_connector(connector); + if (!aconnector->port) + aconnector = NULL; + else + break; + } + + if (!aconnector) + return 0; + + i = 0; + drm_connector_list_iter_begin(state->dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (!connector->state || !connector->state->crtc) + continue; + + aconnector_to_add = to_amdgpu_dm_connector(connector); + if (!aconnector_to_add->port) + continue; + + if (aconnector_to_add->port->mgr != aconnector->port->mgr) + continue; + + if (!aconnector_to_add->dc_sink) + continue; + + if (!aconnector_to_add->dc_sink->sink_dsc_caps.dsc_dec_caps.is_dsc_supported) + continue; + + if (i >= AMDGPU_MAX_CRTCS) + continue; + + crtcs_affected[i] = connector->state->crtc; + i++; + } + drm_connector_list_iter_end(&conn_iter); + + for (j = 0; j < i; j++) { + new_crtc_state = drm_atomic_get_crtc_state(state, crtcs_affected[j]); + if (IS_ERR(new_crtc_state)) + return PTR_ERR(new_crtc_state); + + new_crtc_state->mode_changed = true; + } + + return 0; + +} +#endif + static void get_freesync_config_for_crtc( struct dm_crtc_state *new_crtc_state, struct dm_connector_state *new_con_state) @@ -7577,6 +7645,17 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT + if (adev->asic_type >= CHIP_NAVI10) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) { + ret = add_affected_mst_dsc_crtcs(state, crtc); + if (ret) + goto fail; + } + } + } +#endif for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed &&