diff mbox

drm/i915/psr: Update PSR2 resolution check for Cannonlake

Message ID 20180301203858.9074-1-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan March 1, 2018, 8:38 p.m. UTC
In fact, apply the Cannonlake resolution check for all > Gen-9 platforms to
be safe.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Elio Martinez Monroy <elio.martinez.monroy@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_psr.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Ville Syrjälä March 1, 2018, 8:47 p.m. UTC | #1
On Thu, Mar 01, 2018 at 12:38:58PM -0800, Dhinakaran Pandiyan wrote:
> In fact, apply the Cannonlake resolution check for all > Gen-9 platforms to
> be safe.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Elio Martinez Monroy <elio.martinez.monroy@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_psr.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
> index 05770790a4e9..2a2c696c4109 100644
> --- a/drivers/gpu/drm/i915/intel_psr.c
> +++ b/drivers/gpu/drm/i915/intel_psr.c
> @@ -451,8 +451,8 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> -	const struct drm_display_mode *adjusted_mode =
> -		&crtc_state->base.adjusted_mode;
> +	int crtc_h = crtc_state->base.adjusted_mode.crtc_hdisplay;
> +	int crtc_v = crtc_state->base.adjusted_mode.crtc_vdisplay;
>  
>  	/*
>  	 * FIXME psr2_support is messed up. It's both computed
> @@ -462,9 +462,10 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
>  	if (!dev_priv->psr.psr2_support)
>  		return false;
>  
> -	/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */
> -	if (adjusted_mode->crtc_hdisplay > 3640 ||
> -	    adjusted_mode->crtc_vdisplay > 2304) {
> +	if (crtc_h > 4096 || crtc_v > 2304) {
> +		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
> +		return false;
> +	} else if (IS_GEN9(dev_priv) && (crtc_h > 3640 || crtc_v > 2304)) {

I would suggest introducing max_w/h or something similar so that you
don't have to duplicate the actual code.

When debugging things from logs one might want to know both the requested
size and the max. So printing those out might be a good idea.

>  		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
>  		return false;
>  	}
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dhinakaran Pandiyan March 1, 2018, 8:50 p.m. UTC | #2
On Thu, 2018-03-01 at 22:47 +0200, Ville Syrjälä wrote:
> On Thu, Mar 01, 2018 at 12:38:58PM -0800, Dhinakaran Pandiyan wrote:

> > In fact, apply the Cannonlake resolution check for all > Gen-9 platforms to

> > be safe.

> > 

> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

> > Cc: Elio Martinez Monroy <elio.martinez.monroy@intel.com>

> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> > ---

> >  drivers/gpu/drm/i915/intel_psr.c | 11 ++++++-----

> >  1 file changed, 6 insertions(+), 5 deletions(-)

> > 

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

> > index 05770790a4e9..2a2c696c4109 100644

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

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

> > @@ -451,8 +451,8 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,

> >  {

> >  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);

> >  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);

> > -	const struct drm_display_mode *adjusted_mode =

> > -		&crtc_state->base.adjusted_mode;

> > +	int crtc_h = crtc_state->base.adjusted_mode.crtc_hdisplay;

> > +	int crtc_v = crtc_state->base.adjusted_mode.crtc_vdisplay;

> >  

> >  	/*

> >  	 * FIXME psr2_support is messed up. It's both computed

> > @@ -462,9 +462,10 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,

> >  	if (!dev_priv->psr.psr2_support)

> >  		return false;

> >  

> > -	/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */

> > -	if (adjusted_mode->crtc_hdisplay > 3640 ||

> > -	    adjusted_mode->crtc_vdisplay > 2304) {

> > +	if (crtc_h > 4096 || crtc_v > 2304) {

> > +		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");

> > +		return false;

> > +	} else if (IS_GEN9(dev_priv) && (crtc_h > 3640 || crtc_v > 2304)) {

> 

> I would suggest introducing max_w/h or something similar so that you

> don't have to duplicate the actual code.

> 

> When debugging things from logs one might want to know both the requested

> size and the max. So printing those out might be a good idea.


Agreed on both points.


> 

> >  		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");

> >  		return false;

> >  	}

> > -- 

> > 2.14.1

> > 

> > _______________________________________________

> > Intel-gfx mailing list

> > Intel-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

>
Rodrigo Vivi March 1, 2018, 10:09 p.m. UTC | #3
On Thu, Mar 01, 2018 at 10:47:05PM +0200, Ville Syrjälä wrote:
> On Thu, Mar 01, 2018 at 12:38:58PM -0800, Dhinakaran Pandiyan wrote:
> > In fact, apply the Cannonlake resolution check for all > Gen-9 platforms to
> > be safe.
> > 
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Elio Martinez Monroy <elio.martinez.monroy@intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_psr.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
> > index 05770790a4e9..2a2c696c4109 100644
> > --- a/drivers/gpu/drm/i915/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/intel_psr.c
> > @@ -451,8 +451,8 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
> >  {
> >  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> >  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> > -	const struct drm_display_mode *adjusted_mode =
> > -		&crtc_state->base.adjusted_mode;
> > +	int crtc_h = crtc_state->base.adjusted_mode.crtc_hdisplay;
> > +	int crtc_v = crtc_state->base.adjusted_mode.crtc_vdisplay;
> >  
> >  	/*
> >  	 * FIXME psr2_support is messed up. It's both computed
> > @@ -462,9 +462,10 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
> >  	if (!dev_priv->psr.psr2_support)
> >  		return false;
> >  
> > -	/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */
> > -	if (adjusted_mode->crtc_hdisplay > 3640 ||
> > -	    adjusted_mode->crtc_vdisplay > 2304) {
> > +	if (crtc_h > 4096 || crtc_v > 2304) {
> > +		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
> > +		return false;
> > +	} else if (IS_GEN9(dev_priv) && (crtc_h > 3640 || crtc_v > 2304)) {
> 
> I would suggest introducing max_w/h or something similar so that you
> don't have to duplicate the actual code.

I was going to suggest same thing. So it gets more clear that it is
per platform based and avoid duplication of code

> 
> When debugging things from logs one might want to know both the requested
> size and the max. So printing those out might be a good idea.
> 
> >  		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
> >  		return false;
> >  	}
> > -- 
> > 2.14.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index 05770790a4e9..2a2c696c4109 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -451,8 +451,8 @@  static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-	const struct drm_display_mode *adjusted_mode =
-		&crtc_state->base.adjusted_mode;
+	int crtc_h = crtc_state->base.adjusted_mode.crtc_hdisplay;
+	int crtc_v = crtc_state->base.adjusted_mode.crtc_vdisplay;
 
 	/*
 	 * FIXME psr2_support is messed up. It's both computed
@@ -462,9 +462,10 @@  static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
 	if (!dev_priv->psr.psr2_support)
 		return false;
 
-	/* PSR2 is restricted to work with panel resolutions up to 3640x2304 */
-	if (adjusted_mode->crtc_hdisplay > 3640 ||
-	    adjusted_mode->crtc_vdisplay > 2304) {
+	if (crtc_h > 4096 || crtc_v > 2304) {
+		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
+		return false;
+	} else if (IS_GEN9(dev_priv) && (crtc_h > 3640 || crtc_v > 2304)) {
 		DRM_DEBUG_KMS("PSR2 not enabled, panel resolution too big\n");
 		return false;
 	}