From patchwork Thu Jul 12 17:10:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 10521995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 59A28603D7 for ; Thu, 12 Jul 2018 17:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FFC229B5C for ; Thu, 12 Jul 2018 17:11:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33C4229B61; Thu, 12 Jul 2018 17:11:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E0DB729B5C for ; Thu, 12 Jul 2018 17:11:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 87FC16F08D; Thu, 12 Jul 2018 17:11:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DC0B6F08D; Thu, 12 Jul 2018 17:11:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3F9D401DEC7; Thu, 12 Jul 2018 17:11:08 +0000 (UTC) Received: from whitewolf.lyude.net.com (ovpn-120-214.rdu2.redhat.com [10.10.120.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E7BB2142F20; Thu, 12 Jul 2018 17:11:08 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Subject: [PATCH 2/2] drm/nouveau: Hook up dp_mst_info in debugfs Date: Thu, 12 Jul 2018 13:10:47 -0400 Message-Id: <20180712171056.26359-3-lyude@redhat.com> In-Reply-To: <20180712171056.26359-1-lyude@redhat.com> References: <20180712171056.26359-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 12 Jul 2018 17:11:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 12 Jul 2018 17:11:08 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lyude@redhat.com' RCPT:'' 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 Airlie , Ben Skeggs , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is very useful for checking what nouveau thinks the current state of each MST topology looks like. Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 47 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 963a4dba8213..82f10beed0df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -32,13 +32,19 @@ #include #include #include "nouveau_debugfs.h" +#include "nouveau_encoder.h" #include "nouveau_drv.h" +#include "dispnv50/disp.h" + +static inline struct nouveau_drm *node_to_nouveau(struct drm_info_node *node) +{ + return nouveau_drm(node->minor->dev); +} static int nouveau_debugfs_vbios_image(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct nouveau_drm *drm = nouveau_drm(node->minor->dev); + struct nouveau_drm *drm = node_to_nouveau(m->private); int i; for (i = 0; i < drm->vbios.length; i++) @@ -46,6 +52,42 @@ nouveau_debugfs_vbios_image(struct seq_file *m, void *data) return 0; } +static int +nouveau_debugfs_dp_mst_info(struct seq_file *m, void *unused) +{ + struct nouveau_drm *drm = node_to_nouveau(m->private); + struct drm_device *dev = drm->dev; + struct drm_encoder *encoder; + struct nv50_mstm *mstm; + int ret; + + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0 && ret != -EACCES) + return ret; + + ret = drm_modeset_lock_single_interruptible(&dev->mode_config.connection_mutex); + if (ret) + goto out; + + drm_for_each_encoder(encoder, dev) { + if (encoder->encoder_type != DRM_MODE_ENCODER_TMDS) + continue; + + mstm = nouveau_encoder(encoder)->dp.mstm; + if (!mstm) + continue; + + seq_printf(m, "MST encoder source %s\n", encoder->name); + drm_dp_mst_dump_topology(m, &mstm->mgr); + } + + drm_modeset_unlock(&dev->mode_config.connection_mutex); +out: + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); + return ret; +} + static int nouveau_debugfs_pstate_get(struct seq_file *m, void *data) { @@ -182,6 +224,7 @@ static const struct file_operations nouveau_pstate_fops = { static struct drm_info_list nouveau_debugfs_list[] = { { "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL }, + { "dp_mst_info", nouveau_debugfs_dp_mst_info, 0, NULL }, }; #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)