From patchwork Thu Apr 7 17:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim.bride@linux.intel.com X-Patchwork-Id: 8779361 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 63A079F3D1 for ; Fri, 8 Apr 2016 00:43:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EEB92026D for ; Fri, 8 Apr 2016 00:43:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 05AFD20274 for ; Fri, 8 Apr 2016 00:43:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C9D26E191; Fri, 8 Apr 2016 00:43:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BD116E02D; Thu, 7 Apr 2016 17:30:40 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 07 Apr 2016 10:30:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="780226320" Received: from shiv.jf.intel.com ([10.7.198.162]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2016 10:30:39 -0700 From: Jim Bride To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 2/3] drm/dp/mst: Enhance DP MST debugfs output Date: Thu, 7 Apr 2016 10:30:38 -0700 Message-Id: <1460050239-11770-2-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460050239-11770-1-git-send-email-jim.bride@linux.intel.com> References: <1460050239-11770-1-git-send-email-jim.bride@linux.intel.com> In-Reply-To: <1459887821-8142-1-git-send-email-jim.bride@linux.intel.com> References: <1459887821-8142-1-git-send-email-jim.bride@linux.intel.com> X-Mailman-Approved-At: Fri, 08 Apr 2016 00:43:02 +0000 Cc: dri-devel@lists.freedesktop.org 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Add some additional information (input vs. output port, sink associated with VC, peer device type, max number of VCs supported) and ensure that any embedded '\0' characters in a branch device's devid string are not written to debugfs. v2: Rebase + change drm_edid_get_monitor_name() call to reflect new signature. cc: dri-devel@lists.freedesktop.org Signed-off-by: Jim Bride --- drivers/gpu/drm/drm_dp_mst_topology.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 27fbd79..0d3873e 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2729,7 +2729,7 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m, seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports); list_for_each_entry(port, &mstb->ports, next) { - seq_printf(m, "%sport: %d: ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector); + seq_printf(m, "%sport: %d: input: %d: pdt: %d, ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->input, port->pdt, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector); if (port->mstb) drm_dp_mst_dump_mstb(m, port->mstb); } @@ -2750,6 +2750,18 @@ static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr, return false; } +static void fetch_monitor_name(struct drm_dp_mst_topology_mgr *mgr, + struct drm_dp_mst_port *port, char *name, + int namelen) +{ + struct edid *mst_edid = NULL; + + mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port); + if (mst_edid == NULL) + return; + drm_edid_get_monitor_name(mst_edid, name, namelen); +} + /** * drm_dp_mst_dump_topology(): dump topology to seq file. * @m: seq_file to dump output to @@ -2762,6 +2774,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, { int i; struct drm_dp_mst_port *port; + mutex_lock(&mgr->lock); if (mgr->mst_primary) drm_dp_mst_dump_mstb(m, mgr->mst_primary); @@ -2770,14 +2783,22 @@ void drm_dp_mst_dump_topology(struct seq_file *m, mutex_unlock(&mgr->lock); mutex_lock(&mgr->payload_lock); - seq_printf(m, "vcpi: %lx %lx\n", mgr->payload_mask, mgr->vcpi_mask); + seq_printf(m, "vcpi: %lx %lx %d\n", mgr->payload_mask, mgr->vcpi_mask, + mgr->max_payloads); for (i = 0; i < mgr->max_payloads; i++) { if (mgr->proposed_vcpis[i]) { + char name[13]; + + memset(name, 0, 13 * sizeof(char)); port = container_of(mgr->proposed_vcpis[i], struct drm_dp_mst_port, vcpi); - seq_printf(m, "vcpi %d: %d %d %d\n", i, port->port_num, port->vcpi.vcpi, port->vcpi.num_slots); + fetch_monitor_name(mgr, port, name, 13); + seq_printf(m, "vcpi %d: %d %d %d sink name: %s\n", i, + port->port_num, port->vcpi.vcpi, + port->vcpi.num_slots, + (name[0] != 0) ? name : "Unknown"); } else - seq_printf(m, "vcpi %d:unsed\n", i); + seq_printf(m, "vcpi %d:unused\n", i); } for (i = 0; i < mgr->max_payloads; i++) { seq_printf(m, "payload %d: %d, %d, %d\n", @@ -2818,7 +2839,11 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "%02x", buf[i]); seq_printf(m, " devid: "); for (i = 0x3; i < 0x8; i++) - seq_printf(m, "%c", buf[i]); + if (buf[i] != '\0') + seq_printf(m, "%c", buf[i]); + else + break; + seq_printf(m, " revision: hw: %x.%x sw: %x.%x", buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]); seq_printf(m, "\n"); bret = dump_dp_payload_table(mgr, buf);