dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10 078/120] drm/dp/mst: Export drm_dp_get_vc_payload_bw()
       [not found] <20210208145818.395353822@linuxfoundation.org>
@ 2021-02-08 15:01 ` Greg Kroah-Hartman
  2021-02-10 12:25   ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-08 15:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jani Nikula, Greg Kroah-Hartman, dri-devel, stable, Ville Syrjala

From: Imre Deak <imre.deak@intel.com>

commit 83404d581471775f37f85e5261ec0d09407d8bed upstream.

This function will be needed by the next patch where the driver
calculates the BW based on driver specific parameters, so export it.

At the same time sanitize the function params, passing the more natural
link rate instead of the encoding of the same rate.

v2:
- Fix function documentation. (Lyude)

Cc: Lyude Paul <lyude@redhat.com>
Cc: Ville Syrjala <ville.syrjala@intel.com>
Cc: <stable@vger.kernel.org>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210125173636.1733812-1-imre.deak@intel.com
(cherry picked from commit a321fc2b4e60fc1b39517d26c8104351636a6062)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/drm_dp_mst_topology.c |   24 ++++++++++++++++++------
 include/drm/drm_dp_mst_helper.h       |    1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3629,14 +3629,26 @@ static int drm_dp_send_up_ack_reply(stru
 	return 0;
 }
 
-static int drm_dp_get_vc_payload_bw(u8 dp_link_bw, u8  dp_link_count)
+/**
+ * drm_dp_get_vc_payload_bw - get the VC payload BW for an MST link
+ * @link_rate: link rate in 10kbits/s units
+ * @link_lane_count: lane count
+ *
+ * Calculate the total bandwidth of a MultiStream Transport link. The returned
+ * value is in units of PBNs/(timeslots/1 MTP). This value can be used to
+ * convert the number of PBNs required for a given stream to the number of
+ * timeslots this stream requires in each MTP.
+ */
+int drm_dp_get_vc_payload_bw(int link_rate, int link_lane_count)
 {
-	if (dp_link_bw == 0 || dp_link_count == 0)
-		DRM_DEBUG_KMS("invalid link bandwidth in DPCD: %x (link count: %d)\n",
-			      dp_link_bw, dp_link_count);
+	if (link_rate == 0 || link_lane_count == 0)
+		DRM_DEBUG_KMS("invalid link rate/lane count: (%d / %d)\n",
+			      link_rate, link_lane_count);
 
-	return dp_link_bw * dp_link_count / 2;
+	/* See DP v2.0 2.6.4.2, VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */
+	return link_rate * link_lane_count / 54000;
 }
+EXPORT_SYMBOL(drm_dp_get_vc_payload_bw);
 
 /**
  * drm_dp_read_mst_cap() - check whether or not a sink supports MST
@@ -3692,7 +3704,7 @@ int drm_dp_mst_topology_mgr_set_mst(stru
 			goto out_unlock;
 		}
 
-		mgr->pbn_div = drm_dp_get_vc_payload_bw(mgr->dpcd[1],
+		mgr->pbn_div = drm_dp_get_vc_payload_bw(drm_dp_bw_code_to_link_rate(mgr->dpcd[1]),
 							mgr->dpcd[2] & DP_MAX_LANE_COUNT_MASK);
 		if (mgr->pbn_div == 0) {
 			ret = -EINVAL;
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -783,6 +783,7 @@ drm_dp_mst_detect_port(struct drm_connec
 
 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_get_vc_payload_bw(int link_rate, int link_lane_count);
 
 int drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc);
 


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5.10 078/120] drm/dp/mst: Export drm_dp_get_vc_payload_bw()
  2021-02-08 15:01 ` [PATCH 5.10 078/120] drm/dp/mst: Export drm_dp_get_vc_payload_bw() Greg Kroah-Hartman
@ 2021-02-10 12:25   ` Pavel Machek
  2021-02-10 12:40     ` Imre Deak
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2021-02-10 12:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ville Syrjala, Jani Nikula, linux-kernel, dri-devel, stable


[-- Attachment #1.1: Type: text/plain, Size: 590 bytes --]

Hi!

> commit 83404d581471775f37f85e5261ec0d09407d8bed upstream.
> 
> This function will be needed by the next patch where the driver
> calculates the BW based on driver specific parameters, so export it.
> 
> At the same time sanitize the function params, passing the more natural
> link rate instead of the encoding of the same rate.

> Cc: <stable@vger.kernel.org>

This adds exports, but there's no user of the export, neither in
5.10-stable nor in linux-next. What is the plan here?

Best regards,
								Pavel
								
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5.10 078/120] drm/dp/mst: Export drm_dp_get_vc_payload_bw()
  2021-02-10 12:25   ` Pavel Machek
@ 2021-02-10 12:40     ` Imre Deak
  0 siblings, 0 replies; 3+ messages in thread
From: Imre Deak @ 2021-02-10 12:40 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Jani Nikula, Greg Kroah-Hartman, linux-kernel, dri-devel, stable,
	Ville Syrjala

Hi,

On Wed, Feb 10, 2021 at 01:25:17PM +0100, Pavel Machek wrote:
> Hi!
> 
> > commit 83404d581471775f37f85e5261ec0d09407d8bed upstream.
> > 
> > This function will be needed by the next patch where the driver
> > calculates the BW based on driver specific parameters, so export it.
> > 
> > At the same time sanitize the function params, passing the more natural
> > link rate instead of the encoding of the same rate.
> 
> > Cc: <stable@vger.kernel.org>
> 
> This adds exports, but there's no user of the export, neither in
> 5.10-stable nor in linux-next. What is the plan here?

the export is used by the upstream 
commit 882554042d138dbc6fb1a43017d0b9c3b38ee5f5
Author: Imre Deak <imre.deak@intel.com>
Date:   Mon Jan 25 19:36:36 2021 +0200

    drm/i915: Fix the MST PBN divider calculation

which I can also see now applied to 5.10.15:

commit 0fe98e455784a6c11e0dd48612acd343f4a46fce
Author:     Imre Deak <imre.deak@intel.com>
AuthorDate: Mon Jan 25 19:36:36 2021 +0200
Commit:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CommitDate: Wed Feb 10 09:29:18 2021 +0100

    drm/i915: Fix the MST PBN divider calculation

    commit 882554042d138dbc6fb1a43017d0b9c3b38ee5f5 upstream.

--Imre
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-10 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210208145818.395353822@linuxfoundation.org>
2021-02-08 15:01 ` [PATCH 5.10 078/120] drm/dp/mst: Export drm_dp_get_vc_payload_bw() Greg Kroah-Hartman
2021-02-10 12:25   ` Pavel Machek
2021-02-10 12:40     ` Imre Deak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).