[Intel-gfx] [PATCH 05/11] drm/dp/mst: add concept of base connector id

Dave Airlie airlied at gmail.com
Tue Sep 9 08:28:10 CEST 2014


From: Dave Airlie <airlied at redhat.com>

This gives us a base identifier to group tiled outputs from.

However after reading about the Dell 5k monitor I expect this
is probably too little, and we need some sort of hash table
from the monitor EDID serial number.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 30 ++++++++++++++++++++++++++----
 include/drm/drm_dp_mst_helper.h       |  4 ++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 234a82c..5d2a08e 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -778,14 +778,14 @@ out:
 	return ret;
 }
 
-static struct drm_dp_mst_branch *drm_dp_add_mst_branch_device(u8 lct, u8 *rad)
+static struct drm_dp_mst_branch *drm_dp_add_mst_branch_device(u8 lct, u8 *rad, u8 conn_base_id)
 {
 	struct drm_dp_mst_branch *mstb;
 
 	mstb = kzalloc(sizeof(*mstb), GFP_KERNEL);
 	if (!mstb)
 		return NULL;
-
+	mstb->conn_base_id = conn_base_id;
 	mstb->lct = lct;
 	if (lct > 1)
 		memcpy(mstb->rad, rad, lct / 2);
@@ -983,7 +983,7 @@ static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 	case DP_PEER_DEVICE_MST_BRANCHING:
 		lct = drm_dp_calculate_rad(port, rad);
 
-		port->mstb = drm_dp_add_mst_branch_device(lct, rad);
+		port->mstb = drm_dp_add_mst_branch_device(lct, rad, 0);
 		port->mstb->mgr = port->mgr;
 		port->mstb->port_parent = port;
 
@@ -1097,6 +1097,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
 		build_mst_prop_path(port, mstb, proppath);
 		port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath);
 
+		if (port->mstb) {
+			port->mstb->conn_base_id = port->connector->base.id;
+		}
 		if (port->port_num >= 8)
 			port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc);
 	}
@@ -1849,7 +1852,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
 		mgr->avail_slots = mgr->total_slots;
 
 		/* add initial branch device at LCT 1 */
-		mstb = drm_dp_add_mst_branch_device(1, NULL);
+		mstb = drm_dp_add_mst_branch_device(1, NULL, mgr->conn_base_id);
 		if (mstb == NULL) {
 			ret = -ENOMEM;
 			goto out_unlock;
@@ -2216,6 +2219,25 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
 }
 EXPORT_SYMBOL(drm_dp_mst_get_edid);
 
+int drm_dp_mst_get_base_id(struct drm_dp_mst_topology_mgr *mgr,
+			   struct drm_dp_mst_port *port)
+{
+	int val;
+	/* we need to search for the port in the mgr in case its gone */
+	port = drm_dp_get_validated_port_ref(mgr, port);
+	if (!port)
+		return 0;
+
+	if (!port->parent) {
+		drm_dp_put_port(port);
+		return 0;
+	}
+
+	val = port->parent->conn_base_id;
+	drm_dp_put_port(port);
+	return val;
+}
+EXPORT_SYMBOL(drm_dp_mst_get_base_id);
 /**
  * drm_dp_find_vcpi_slots() - find slots for this PBN value
  * @mgr: manager to use
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index ee6fbad..e28d6763 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -131,6 +131,8 @@ struct drm_dp_mst_branch {
 	struct drm_dp_sideband_msg_tx *tx_slots[2];
 	int last_seqno;
 	bool link_address_sent;
+
+	int conn_base_id;
 };
 
 
@@ -480,6 +482,8 @@ enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector
 
 struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
+int drm_dp_mst_get_base_id(struct drm_dp_mst_topology_mgr *mgr,
+			   struct drm_dp_mst_port *port);
 
 int drm_dp_calc_pbn_mode(int clock, int bpp);
 
-- 
1.9.3




More information about the Intel-gfx mailing list