From patchwork Tue Sep 9 06:28:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 4866311 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91933C033A for ; Tue, 9 Sep 2014 06:28:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADA07200ED for ; Tue, 9 Sep 2014 06:28:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E656620145 for ; Tue, 9 Sep 2014 06:28:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B80D36E3A3; Mon, 8 Sep 2014 23:28:31 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 669E36E39A; Mon, 8 Sep 2014 23:28:28 -0700 (PDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s896SR6q030925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 Sep 2014 02:28:27 -0400 Received: from tyrion-bne-redhat-com.bne.redhat.com (dhcp-41-68.bne.redhat.com [10.64.41.68]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s896SIOv023257; Tue, 9 Sep 2014 02:28:25 -0400 From: Dave Airlie To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 9 Sep 2014 16:28:10 +1000 Message-Id: <1410244096-9854-6-git-send-email-airlied@gmail.com> In-Reply-To: <1410244096-9854-1-git-send-email-airlied@gmail.com> References: <1410244096-9854-1-git-send-email-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Subject: [Intel-gfx] [PATCH 05/11] drm/dp/mst: add concept of base connector id X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 From: Dave Airlie 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 --- 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);