diff mbox

[v3,2/3] drm/dp/mst: Enhance DP MST debugfs output

Message ID 1460391262-3367-2-git-send-email-jim.bride@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jim.bride@linux.intel.com April 11, 2016, 4:14 p.m. UTC
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.

v3: Minor changes suggested by Jani + rebase.

cc: dri-devel@lists.freedesktop.org
cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

Comments

Jani Nikula April 14, 2016, 6:47 a.m. UTC | #1
On Mon, 11 Apr 2016, Jim Bride <jim.bride@linux.intel.com> wrote:
> 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.
>
> v3: Minor changes suggested by Jani + rebase.
>
> cc: dri-devel@lists.freedesktop.org
> cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 29 ++++++++++++++++++++++++-----
>  1 file changed, 24 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..06d8b0a 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,16 @@ 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;
> +
> +	mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port);
> +	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 +2772,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 +2781,21 @@ 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[14];
> +
>  			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, sizeof(name));
> +			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) ? 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",
> @@ -2817,8 +2835,9 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
>  		for (i = 0; i < 0x3; i++)
>  			seq_printf(m, "%02x", buf[i]);
>  		seq_printf(m, " devid: ");
> -		for (i = 0x3; i < 0x8; i++)
> +		for (i = 0x3; i < 0x8 && buf[i]; i++)
>  			seq_printf(m, "%c", buf[i]);
> +
>  		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);
Daniel Vetter April 14, 2016, 7:37 a.m. UTC | #2
On Thu, Apr 14, 2016 at 09:47:22AM +0300, Jani Nikula wrote:
> On Mon, 11 Apr 2016, Jim Bride <jim.bride@linux.intel.com> wrote:
> > 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.
> >
> > v3: Minor changes suggested by Jani + rebase.
> >
> > cc: dri-devel@lists.freedesktop.org
> > cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Patch series seems a bit messed up here (I don't have a 3/3 here). Can you
pls resend the entire pile, with nitpicks+reviewed-by and everything
included, in a new thread?

Thanks, Daniel

> 
> 
> > ---
> >  drivers/gpu/drm/drm_dp_mst_topology.c | 29 ++++++++++++++++++++++++-----
> >  1 file changed, 24 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..06d8b0a 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,16 @@ 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;
> > +
> > +	mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port);
> > +	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 +2772,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 +2781,21 @@ 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[14];
> > +
> >  			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, sizeof(name));
> > +			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) ? 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",
> > @@ -2817,8 +2835,9 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
> >  		for (i = 0; i < 0x3; i++)
> >  			seq_printf(m, "%02x", buf[i]);
> >  		seq_printf(m, " devid: ");
> > -		for (i = 0x3; i < 0x8; i++)
> > +		for (i = 0x3; i < 0x8 && buf[i]; i++)
> >  			seq_printf(m, "%c", buf[i]);
> > +
> >  		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);
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 27fbd79..06d8b0a 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,16 @@  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;
+
+	mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port);
+	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 +2772,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 +2781,21 @@  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[14];
+
 			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, sizeof(name));
+			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) ? 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",
@@ -2817,8 +2835,9 @@  void drm_dp_mst_dump_topology(struct seq_file *m,
 		for (i = 0; i < 0x3; i++)
 			seq_printf(m, "%02x", buf[i]);
 		seq_printf(m, " devid: ");
-		for (i = 0x3; i < 0x8; i++)
+		for (i = 0x3; i < 0x8 && buf[i]; i++)
 			seq_printf(m, "%c", buf[i]);
+
 		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);