mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: nouveau@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] drm/nouveau: Hook up dp_mst_info in debugfs
Date: Thu, 12 Jul 2018 13:10:47 -0400	[thread overview]
Message-ID: <20180712171056.26359-3-lyude@redhat.com> (raw)
In-Reply-To: <20180712171056.26359-1-lyude@redhat.com>

This is very useful for checking what nouveau thinks the current state
of each MST topology looks like.

Signed-off-by: Lyude Paul <lyude@redhat.com>
---
 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 <nvif/class.h>
 #include <nvif/if0001.h>
 #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)
 
-- 
2.17.1


  parent reply	other threads:[~2018-07-12 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 17:10 [PATCH 0/2] drm/nouveau: Add support for " Lyude Paul
2018-07-12 17:10 ` [PATCH 1/2] drm/nouveau: Expose nv50 MST structures in disp.h Lyude Paul
2018-07-12 17:10 ` Lyude Paul [this message]
2018-07-12 17:21 ` [PATCH 0/2] drm/nouveau: Add support for dp_mst_info in debugfs Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180712171056.26359-3-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome