From patchwork Wed May 18 22:37:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 9122911 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8C62BF29F for ; Wed, 18 May 2016 23:09:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFFE420340 for ; Wed, 18 May 2016 23:09:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C418920306 for ; Wed, 18 May 2016 23:09:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D00316E0BA; Wed, 18 May 2016 23:09:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1928 seconds by postgrey-1.35 at gabe; Wed, 18 May 2016 23:09:48 UTC Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0059.outbound.protection.outlook.com [65.55.169.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3C406E0BA for ; Wed, 18 May 2016 23:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kMIiuDLUba8fFX0zMeExFiseCPy4nBm+4eAC8vYpJqQ=; b=yz9tDl/DbQZ0pwUBBahyWG9HAiLB4mFnZ0YOdE4Z/O5ogSd1EHADzGrpz9cOFk45lbntEQ56n0QUAs6ZhJ0Pq9AXQRety/TYNW7qoh2s+HxDTSkBlkZJA0L8cdpQLnFm2Tl4edZkv6CiwAeTdAQIS2CsmQ0QgVk4RPioh72Z9wE= Received: from CY1PR1201CA0028.namprd12.prod.outlook.com (10.169.17.166) by CY1PR12MB0713.namprd12.prod.outlook.com (10.163.238.19) with Microsoft SMTP Server (TLS) id 15.1.501.7; Wed, 18 May 2016 22:37:37 +0000 Received: from DM3NAM03FT048.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by CY1PR1201CA0028.outlook.office365.com (2a01:111:e400:5b9a::38) with Microsoft SMTP Server (TLS) id 15.1.497.12 via Frontend Transport; Wed, 18 May 2016 22:37:38 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.21) 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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.21) by DM3NAM03FT048.mail.protection.outlook.com (10.152.83.143) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Wed, 18 May 2016 22:37:37 +0000 Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.266.1; Wed, 18 May 2016 17:37:32 -0500 Received: from SCYBEXDAG04.amd.com (10.34.11.14) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server (TLS) id 14.3.266.1; Wed, 18 May 2016 18:37:31 -0400 Received: from agrodzovsky-All-Series.amd.com (172.29.227.109) by SCYBEXDAG04.amd.com (10.34.11.14) with Microsoft SMTP Server id 14.3.266.1; Thu, 19 May 2016 06:37:26 +0800 From: Andrey Grodzovsky To: Subject: drm/dp/mst: change MST detection scheme (v2) Date: Wed, 18 May 2016 18:37:10 -0400 Message-ID: <1463611030-21448-1-git-send-email-Andrey.Grodzovsky@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.21; IPV:CAL; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(36756003)(105586002)(229853001)(2351001)(106466001)(586003)(2870700001)(92566002)(101416001)(5008740100001)(50466002)(110136002)(2906002)(4326007)(50986999)(189998001)(77096005)(5820100001)(23676002)(19580405001)(19580395003)(50226002)(53416004)(8676002)(450100001)(8936002)(1220700001)(5003600100002)(87936001)(6806005)(47776003)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0713; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 7e113172-cd71-41df-5614-08d37f6d03b9 X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0713; 2:ZbxH81LcH2gX7NXgx6+Hau3ubh0sc8M5fZb6lFRUEEddKI7zdiNLupQ1ewBY1EfUHeaDij9IZ1tuXICloxx8FJ9afORUZU021A5TJRl661CdOf3iabdX5HsG+ZGWuOdNZSEsssU/IBcoB1solT0WqPhpfcGOJ1GzuC62x/uQGJCGP9VYbsoRRLcsRXT49V7S; 3:TZD1L5qDUtHpuvmjkGblCG/JB4yKsOMKXmnQIWHhcOHU+cZU2cd3Ulr3EfkiErabzoxJM4Mt5BNTp4iBFsr168xfiFjmF9e1GZaGJ8h9w9aH2bPSQZb7bHDznNRPA9sE+wXF+NzG1PsVAXfq1LPAwMkjUsOsGWWiV9OEMeb9A53tYHsOf7bQ5HKpH1zQCc6lKa6HzR2amchy/rRJQnwBEx01XoE/vWTi+roHYS6kkf8=; 25:c2ieC3XB2Wj8XOKMqEppzWDZ55fCrC6TemywvhEL+zvxX+x9TODo/K+IT1kmrqCcLNhi9tb2M5Hip2WDYZlGWaJPeYad7PQqW2/US+erSzLmcys50Ufu8P/sEMAiyMHgpmxw4+AgMpp/0x5KcSfZFIaniHTuiPJoJ9db7SyS5pJgidduK4iEfop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QBGM4c5/JzoYtDdy1VnVD2+TofNkGjXivulDFQxF8oIsoWQzg0Xjrcr6LeTrWSwWMUBVQ8MereeKWeL1QAlNbw/Z+EYUzvdoRVORg6zXAWFVM6QJnNq8gO0IyLlqtW3O5Zj6HlOHmcLMUgXnSeSlpptADtgtIR1O1NItlF8Zlq6Qds11NlTV2HtN8bF22NBbq494UbMth3mIPz+JHmyew9QKEPR1VNro9pX32+35x9xzriqWVkB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(13023025)(13013025)(13021025)(10201501046)(3002001)(6055026); SRVR:CY1PR12MB0713; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0713; X-Forefront-PRVS: 0946DC87A1 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjEyTUIwNzEzOzIzOjJ1bWZWU2V6MXBaL1pjTW9tT29Pd2FJaWx4?= =?utf-8?B?cW5MeVg3Zkp5YUJaWXo0ZDUxUHBkV0FsOXZXL3p3eGMyZzlrTHpLYnNWVTJi?= =?utf-8?B?eGZyd0RBWFhZT25zZ0h0V01hUWljVnNmOEVUaHZYend1cVQzemtKcXJtMG4v?= =?utf-8?B?bWh0UVVuL2szVnI4OWkyejlrYVlFQXZNRnEzbHhzUWhBMWZNSWJ0VWdHbllk?= =?utf-8?B?TlJ4OU5ZYWRYaGRwdng2dWhveFR5OGRGMzdxNjVJUEwrYlBzSDF5R2NoQlJI?= =?utf-8?B?MXd6YUZ5OE0rVVlUREpMZ0ZVWCs2YisrRmc1bTg5WG9KVElkcDZxZCtWV3Rq?= =?utf-8?B?Y1FQRkpKYktIL3kzbDNTeG5xc25TaDRhM1RXWlBVMnZGT1VUWFluZS93MXRY?= =?utf-8?B?Y3BiWHhOV1Aza3h1bEwwandQaXRSa0FIaXM5U0huL2ZyTERNWkFiWjY0SmJ6?= =?utf-8?B?Ul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diagnostics: 1; CY1PR12MB0713; 5:q0xANzG9XgHqI/UtLHZquR5gzZC+sQeNMF+rR3+y1b0OHaFL8vKjTZ5Itu2Eu/2fvES6G3eZpu9LV5/JsCsyAEW3LKy1eynVrOppQqb/g/00QJlTYQUZ/Pwwc5hsWNCQFbnrWU0KQsYYhhTNpkwhkg==; 24:cm9Ib3OAjwwANY0ZGsfKN+kQkweYlE+RbbD9SmnD8guREv3651VwjAbyvRyK0k+VbL9OaVvecGWNQoYkE3i1MbEfBUh6UCZgfecMQXG2V/U=; 7:aR58Zxs6g8pa/lMQvlPzEg+OfLuugYfl0+6ZmbVLNCNWK7Kg99K0qPT0b9mLQxpfDSimc+NGlijFR3G9G7eNTeKnPlEmMplT9iqNCIcWgI3Cn9ffnI9WQ2lXDsSoGKtEvYEiSb6TQWBrsfgY4FR0cjhm0PJE0bdO1sqK36yCjdiSR6S/iggfZ4HjvKWgQmV4; 20:c4JWrhP4SRf3hX0YX4q8KaAV0jAYoPzLFmcsdtXS0St5hWl6mcfVn/lzOQOso3SZI7bnhuvAvvERrwAdPnmcZXwiHMKyriWuBiMnYL/kmX5zkQP96RzvmyfTW/CRys0qiHNZEJ0cKzF8dO7gXI7//2MKtD/ywyuWOBEjeSKeVtlF7ulH1UryUa7lZ1HTte9KriygOcJ/TjInvlDdUjenPLofyEvSyFEI1BzAPKIzpX9TiuMVPo2bXuprsPKQxX60 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2016 22:37:37.8762 (UTC) 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.21]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0713 Cc: Mykola Lysenko X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mykola Lysenko 1. Get edid for all connected MST displays, not only on logical ports, in the same thread as MST topology detection is done: There are displays that have branches inside w/o logical ports. So in case another SST display connected downstream system can end-up in situation when 3 DOWN requests sent: two for ‘remote i2c read’ and one for ‘enum path resources’, making slots full. 2. Call notification callback in one place in the end of topology discovery/update: This is done to reduce number of events sent to userspace in case complex topology discovery is going, adding multiple number of connectors; 3. Remove notification callback call from short pulse interrupt processing function: This is done in order not to block interrupt processing function, in case any MST request will be made from it. Notification will be send from topology discovery/update work item. v2: This change also includes tile property set fix which caused regression in i915 driver. Reviewed-by: Alex Deucher Signed-off-by: Mykola Lysenko --- drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 27fbd79..9971c46 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1159,13 +1159,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, drm_dp_put_port(port); goto out; } - if (port->port_num >= DP_MST_LOGICAL_PORT_0) { - port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); - drm_mode_connector_set_tile_property(port->connector); - } + (*mstb->mgr->cbs->register_connector)(port->connector); } - out: /* put reference to this port */ drm_dp_put_port(port); @@ -1190,8 +1186,8 @@ static void drm_dp_update_port(struct drm_dp_mst_branch *mstb, port->ddps = conn_stat->displayport_device_plug_status; if (old_ddps != port->ddps) { + dowork = true; if (port->ddps) { - dowork = true; } else { port->available_pbn = 0; } @@ -1296,8 +1292,13 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m if (port->input) continue; - if (!port->ddps) + if (!port->ddps) { + if (port->cached_edid) { + kfree(port->cached_edid); + port->cached_edid = NULL; + } continue; + } if (!port->available_pbn) drm_dp_send_enum_path_resources(mgr, mstb, port); @@ -1308,6 +1309,13 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m drm_dp_check_and_send_link_address(mgr, mstb_child); drm_dp_put_mst_branch_device(mstb_child); } + } else if (port->pdt == DP_PEER_DEVICE_SST_SINK || + port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV) { + if (!port->cached_edid) { + port->cached_edid = + drm_get_edid(port->connector, &port->aux.ddc); + drm_mode_connector_set_tile_property(port->connector); + } } } } @@ -1327,6 +1335,8 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work) drm_dp_check_and_send_link_address(mgr, mstb); drm_dp_put_mst_branch_device(mstb); } + + (*mgr->cbs->hotplug)(mgr); } static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr, @@ -1586,7 +1596,6 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) { drm_dp_add_port(mstb, mgr->dev, &txmsg->reply.u.link_addr.ports[i]); } - (*mgr->cbs->hotplug)(mgr); } } else { mstb->link_address_sent = false; @@ -2283,8 +2292,6 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) drm_dp_update_port(mstb, &msg.u.conn_stat); DRM_DEBUG_KMS("Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", msg.u.conn_stat.port_number, msg.u.conn_stat.legacy_device_plug_status, msg.u.conn_stat.displayport_device_plug_status, msg.u.conn_stat.message_capability_status, msg.u.conn_stat.input_port, msg.u.conn_stat.peer_device_type); - (*mgr->cbs->hotplug)(mgr); - } else if (msg.req_type == DP_RESOURCE_STATUS_NOTIFY) { drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, msg.req_type, seqno, false); if (!mstb) @@ -2371,10 +2378,6 @@ enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector case DP_PEER_DEVICE_SST_SINK: status = connector_status_connected; - /* for logical ports - cache the EDID */ - if (port->port_num >= 8 && !port->cached_edid) { - port->cached_edid = drm_get_edid(connector, &port->aux.ddc); - } break; case DP_PEER_DEVICE_DP_LEGACY_CONV: if (port->ldps) @@ -2429,10 +2432,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_ if (port->cached_edid) edid = drm_edid_duplicate(port->cached_edid); - else { - edid = drm_get_edid(connector, &port->aux.ddc); - drm_mode_connector_set_tile_property(connector); - } + port->has_audio = drm_detect_monitor_audio(edid); drm_dp_put_port(port); return edid;