[2/2] Validate modes against available link bandwidth
diff mbox

Message ID 1470958900-822-2-git-send-email-anusha.srivatsa@intel.com
State New
Headers show

Commit Message

Srivatsa, Anusha Aug. 11, 2016, 11:41 p.m. UTC
drm/dp/mst/i915

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

Validate the modes against available link bandwidth rather than
maximum link bandwidth so that we have a better idea as to whether
a proposed mode can truly run beside existing stream.
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Dhinakaran Pandiyan Aug. 12, 2016, 3:29 a.m. UTC | #1
On Thu, 2016-08-11 at 16:41 -0700, Anusha Srivatsa wrote:
> drm/dp/mst/i915

> 

> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

> 

> Validate the modes against available link bandwidth rather than

> maximum link bandwidth so that we have a better idea as to whether

> a proposed mode can truly run beside existing stream.


The Signed-off line follows the explanation body.
https://www.kernel.org/doc/Documentation/SubmittingPatches

> ---

>  drivers/gpu/drm/i915/intel_dp_mst.c | 14 ++++++++++++--

>  1 file changed, 12 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c

> index 629337d..e7e87d7 100644

> --- a/drivers/gpu/drm/i915/intel_dp_mst.c

> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c

> @@ -352,13 +352,23 @@ static enum drm_mode_status

>  intel_dp_mst_mode_valid(struct drm_connector *connector,

>  			struct drm_display_mode *mode)

>  {

> +	int req_pbn = 0;

> +	int avail_pbn = 0;

> +	struct intel_connector *intel_connector = to_intel_connector(connector);

> +	struct intel_dp *intel_dp = intel_connector->mst_port;

> +	struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr;

> +	struct drm_dp_mst_port *port = (struct drm_dp_mst_port *) (intel_connector->port);

>  	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;

>  

> -	/* TODO - validate mode against available PBN for link */

> +	avail_pbn = drm_dp_mst_get_avail_pbn(mgr, port);

> +	req_pbn = drm_dp_calc_pbn_mode(mode->clock, 24);

> +	if (req_pbn > avail_pbn)

> +		return MODE_H_ILLEGAL;

> +

>  	if (mode->clock < 10000)

>  		return MODE_CLOCK_LOW;

>  

> -	if (mode->flags & DRM_MODE_FLAG_DBLCLK)

> +        if (mode->flags & DRM_MODE_FLAG_DBLCLK)

>  		return MODE_H_ILLEGAL;

>  

>  	if (mode->clock > max_dotclk)

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 629337d..e7e87d7 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -352,13 +352,23 @@  static enum drm_mode_status
 intel_dp_mst_mode_valid(struct drm_connector *connector,
 			struct drm_display_mode *mode)
 {
+	int req_pbn = 0;
+	int avail_pbn = 0;
+	struct intel_connector *intel_connector = to_intel_connector(connector);
+	struct intel_dp *intel_dp = intel_connector->mst_port;
+	struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr;
+	struct drm_dp_mst_port *port = (struct drm_dp_mst_port *) (intel_connector->port);
 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 
-	/* TODO - validate mode against available PBN for link */
+	avail_pbn = drm_dp_mst_get_avail_pbn(mgr, port);
+	req_pbn = drm_dp_calc_pbn_mode(mode->clock, 24);
+	if (req_pbn > avail_pbn)
+		return MODE_H_ILLEGAL;
+
 	if (mode->clock < 10000)
 		return MODE_CLOCK_LOW;
 
-	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
+        if (mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return MODE_H_ILLEGAL;
 
 	if (mode->clock > max_dotclk)