drm/i915: Start tracking PSR state in crtc state
Subsystems (2)
PATCH 1/1 drm/i915: Start tracking PSR state in crtc state
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more crtc->config usage, which we want to kill off eventually.
--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also
@@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +43 -41
159 lines not on this page · raw message
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 75 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 41 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +4
-6@@ -376,22 +376,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;
drivers/gpu/drm/i915/intel_psr.c static void hsw_psr_activate(struct intel_dp *intel_dp) · line 391
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3
-4int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ; - dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp))
I guess I'd like an intel_dp_is_edp() check here or within is_edp_psr() before touching intel_dp->psr_dpcd.
Quoted 56 lines
drivers/gpu/drm/i915/intel_psr.c +12
-11+return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +405,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) { DRM_DEBUG_KMS("PSR condition failed: PSR setup time (%d us) too long\n",
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 448
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +8
-1psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/
Agreed, yuck.
Quoted 4 lines
drivers/gpu/drm/i915/intel_psr.c +3
-0+if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 457
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3
-5/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" );
This branch doesn't set has_psr = true, shouldn't it? Maybe move that before the if (!dev_priv->psr.psr2_support) condition from within the block?
Quoted 24 lines
drivers/gpu/drm/i915/intel_psr.c +5
-4+return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,13 +538,8 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_psr.c void intel_psr_enable(struct intel_dp *intel_dp, · line 542
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +2
-7-if (!HAS_PSR (dev_priv)) -return ; - -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } +if (!crtc_state->has_psr) + goto unlock;
It's not locked yet...
BR,
Jani.
Quoted 23 lines
drivers/gpu/drm/i915/intel_psr.c +3
-3WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);@@ -546,8 +548,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +670,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 84 lines · Jani Nikula
Quoted 83 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 41 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +6
-9@@ -376,22 +376,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ;
Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c static void hsw_psr_activate(struct intel_dp *intel_dp) · line 391
Quoted 2 lines
drivers/gpu/drm/i915/intel_psr.c +1
-1- dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp))I guess I'd like an
intel_dp_is_edp()check here or withinis_edp_psr()before touchingintel_dp->psr_dpcd.
Hmm. I guess just stuffing it into is_edp_psr() would be a decent idea.
Quoted 75 lines
Quoted 57 lines
drivers/gpu/drm/i915/intel_psr.c +12
-11+return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +405,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) { DRM_DEBUG_KMS("PSR condition failed: PSR setup time (%d us) too long\n",drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 448
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +8
-1psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/ Agreed, yuck.
Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +3
-0+if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }
Quoted 11 lines
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 457
Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +3
-5/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" );This branch doesn't set
has_psr= true, shouldn't it?
The original didn't set dev_priv->psr.source_ok=true until the very end. So I guess the logic here is (for whatever reason) to disable PSR entirely if the sink can do PSR2 but the source can't. I just tried to preserve that behaviour.
Quoted 29 lines
Maybe move that
before the if (!dev_priv->psr.psr2_support) condition from within the block?Quoted 25 lines
drivers/gpu/drm/i915/intel_psr.c +5
-4+return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,13 +538,8 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);
Quoted 11 lines
drivers/gpu/drm/i915/intel_psr.c void intel_psr_enable(struct intel_dp *intel_dp, · line 542
Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +2
-7-if (!HAS_PSR (dev_priv)) -return ; - -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } +if (!crtc_state->has_psr) + goto unlock;It's not locked yet...
Doh. Will fix.
Quoted 30 lines
BR,
Jani.Quoted 23 lines
drivers/gpu/drm/i915/intel_psr.c +3
-3WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);@@ -546,8 +548,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +670,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 180 lines · Ville Syrjälä
Quoted 84 lines · Jani Nikula
Quoted 83 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 41 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +6
-9@@ -376,22 +376,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ;Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c static void hsw_psr_activate(struct intel_dp *intel_dp) · line 391
Quoted 2 lines
drivers/gpu/drm/i915/intel_psr.c +1
-1- dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp))I guess I'd like an
intel_dp_is_edp()check here or withinis_edp_psr()before touchingintel_dp->psr_dpcd.Hmm. I guess just stuffing it into
is_edp_psr()would be a decent idea.Quoted 75 lines
Quoted 57 lines
drivers/gpu/drm/i915/intel_psr.c +12
-11+return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +405,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) { DRM_DEBUG_KMS("PSR condition failed: PSR setup time (%d us) too long\n",drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 448
Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +8
-1psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/ Agreed, yuck.
Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +3
-0+if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }Quoted 11 lines
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 457
Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +3
-5/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" );This branch doesn't set
has_psr= true, shouldn't it?
Quoted 4 lines
The original didn't set dev_priv->psr.source_ok=true until the very end. So I guess the logic here is (for whatever reason) to disable PSR entirely if the sink can do PSR2 but the source can't. I just tried to preserve that behaviour.
Ack on preserving the behaviour.
BR,
Jani.
Quoted 74 lines
Quoted 30 lines
Maybe move that
before the if (!dev_priv->psr.psr2_support) condition from within the block?Quoted 25 lines
drivers/gpu/drm/i915/intel_psr.c +5
-4+return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,13 +538,8 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);Quoted 11 lines
drivers/gpu/drm/i915/intel_psr.c void intel_psr_enable(struct intel_dp *intel_dp, · line 542
Quoted 9 lines
drivers/gpu/drm/i915/intel_psr.c +2
-7-if (!HAS_PSR (dev_priv)) -return ; - -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } +if (!crtc_state->has_psr) + goto unlock;It's not locked yet...
Doh. Will fix.
Quoted 30 lines
BR,
Jani.Quoted 23 lines
drivers/gpu/drm/i915/intel_psr.c +3
-3WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);@@ -546,8 +548,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +670,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Start tracking PSR state in crtc state
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Start tracking PSR state in crtc state
URL : https://patchwork.freedesktop.org/series/31802/
State : success
== Summary ==
Series 31802v1 drm/i915: Start tracking PSR state in crtc state
https://patchwork.freedesktop.org/api/1.0/series/31802/revisions/1/mbox/
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:453s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:472s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:397s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:566s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:289s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:528s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:529s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:540s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:520s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:538s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:431s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:556s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:438s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:461s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:510s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:481s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:505s fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:486s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:564s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:664s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:475s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:624s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:536s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:517s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:478s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:579s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:436s
fi-gdg-551 failed to connect after reboot
a869721e93a51c2bf425f322514527b4dc3944c8 drm-tip: 2017y-10m-12d-08h-30m-31s UTC integration manifest 5e14757dfa1f drm/i915: Start tracking PSR state in crtc state
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6005/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm/i915: Start tracking PSR state in crtc state
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Start tracking PSR state in crtc state
URL : https://patchwork.freedesktop.org/series/31802/
State : success
== Summary ==
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912
Test perf:
Subgroup blocking:
pass -> FAIL (shard-hsw) fdo#102252
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-mmap-wc:
dmesg-warn -> PASS (shard-hsw) fdo#102614fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
shard-hsw total:2551 pass:1437 dwarn:0 dfail:0 fail:11 skip:1103 time:9636s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6005/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Start tracking PSR state in crtc state
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more crtc->config usage, which we want to kill off eventually.
v2: Fix 'goto unlock' fail in intel_psr_enable() (Jani)
Check intel_dp_is_edp() in is_edp_psr() (Jani)
--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 85 +++++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also
@@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);
drivers/gpu/drm/i915/intel_psr.c +45 -40
168 lines not on this page · raw message
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.
Quoted 6 lines
v2: Fix 'goto unlock' fail in
intel_psr_enable()(Jani)
Checkintel_dp_is_edp()inis_edp_psr()(Jani)Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
But I think an ack from Rodrigo might be in order.
There's also some follow-up to do with untanglingdev_priv->psr.psr2_support.
Quoted 220 lines
--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 85 +++++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 40 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +45
-40@@ -58,6 +58,9 @@static bool is_edp_psr (struct intel_dp *intel_dp) { +if (!intel_dp_is_edp (intel_dp)) +return false; +return intel_dp->psr_dpcd[0 ] &DP_PSR_IS_SUPPORTED ; }@@ -376,22 +379,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ; - dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp)) +return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +408,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) {DRM_DEBUG_KMS ("PSR condition failed: PSR setup time (%d us) too long\n" , psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/ +if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" ); +return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,14 +541,9 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!crtc_state->has_psr)return ; -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } -WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);if (dev_priv->psr.enabled) {@@ -546,8 +551,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +673,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
good idea.
Quoted 4 lines
Quoted 4 lines
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.
Quoted 8 lines
Quoted 6 lines
v2: Fix 'goto unlock' fail in
intel_psr_enable()(Jani)
Checkintel_dp_is_edp()inis_edp_psr()(Jani)Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Jani Nikula <[email protected]>
Quoted 5 lines
But I think an ack from Rodrigo might be in order.
There's also some follow-up to do with untangling
dev_priv->psr.psr2_support.
+Vathsala just in case ;)
Quoted 137 lines
Quoted 137 lines
--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 85 +++++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 40 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +22
-21@@ -58,6 +58,9 @@static bool is_edp_psr (struct intel_dp *intel_dp) { +if (!intel_dp_is_edp (intel_dp)) +return false; +return intel_dp->psr_dpcd[0 ] &DP_PSR_IS_SUPPORTED ; }@@ -376,22 +379,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ; - dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp)) +return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +408,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }
Quoted 13 lines
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 451
Quoted 13 lines
drivers/gpu/drm/i915/intel_psr.c +8
-1if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) {DRM_DEBUG_KMS ("PSR condition failed: PSR setup time (%d us) too long\n" , psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/
+Vathsala
Quoted 66 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_psr.c +14
-17+if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" ); +return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,14 +541,9 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!crtc_state->has_psr)return ; -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } -WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);if (dev_priv->psr.enabled) {@@ -546,8 +551,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +673,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_psr.c +1
-1-if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 17 lines · Rodrigo Vivi
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Add the minimal amount of PSR tracking into the crtc state. This allows precomputing the possibility of using PSR correctly, and it means we can safely call the psr enable/disable functions for any DP endcoder.
good idea.
Quoted 7 lines
Quoted 7 lines
As a nice bonus we get rid of some more
crtc->configusage, which we want to kill off eventually.v2: Fix 'goto unlock' fail in
intel_psr_enable()(Jani)
Checkintel_dp_is_edp()inis_edp_psr()(Jani)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Cc Rodrigo Vivi <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Jani Nikula <[email protected]>Acked-by Rodrigo Vivi <[email protected]>
Thank you both. Patch pushed to dinq.
Quoted 236 lines
Quoted 6 lines
But I think an ack from Rodrigo might be in order.
There's also some follow-up to do with untangling
dev_priv->psr.psr2_support.+Vathsala just in case ;)
Quoted 137 lines
Quoted 137 lines
--- drivers/gpu/drm/i915/intel_dp.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_psr.c | 85 +++++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 40 deletions(-)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1832,6 +1832,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (!HAS_DDI (dev_priv))intel_dp_set_clock (encoder, pipe_config); +intel_psr_compute_config (intel_dp, pipe_config); +return true; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -718,6 +718,9 @@ struct intel_crtc_state {struct intel_link_m_n dp_m2_n2;bool has_drrs; +bool has_psr; +bool has_psr2; +/* * Frequence the dpll for the port should run at. Differs from the * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also @@ -1764,6 +1767,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,void intel_psr_init (struct drm_i915_private *dev_priv);void intel_psr_single_frame_update (struct drm_i915_private *dev_priv,unsigned frontbuffer_bits); +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state);/* intel_runtime_pm.c */ int intel_power_domains_init (struct drm_i915_private *);drivers/gpu/drm/i915/intel_psr.c +22
-21@@ -58,6 +58,9 @@static bool is_edp_psr (struct intel_dp *intel_dp) { +if (!intel_dp_is_edp (intel_dp)) +return false; +return intel_dp->psr_dpcd[0 ] &DP_PSR_IS_SUPPORTED ; }@@ -376,22 +379,25 @@ static void hsw_psr_activate(struct intel_dp *intel_dp)hsw_activate_psr1 (intel_dp); } -static bool intel_psr_match_conditions (struct intel_dp *intel_dp) +void intel_psr_compute_config (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) {struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc *crtc = dig_port->base.base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dig_port->base.base.dev);const struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; + &crtc_state->base.adjusted_mode;int psr_setup_time; -lockdep_assert_held (&dev_priv->psr.lock); -WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); -WARN_ON (!drm_modeset_is_locked (&crtc->mutex)); +if (!HAS_PSR (dev_priv)) +return ; - dev_priv->psr.source_ok = false; +if (!is_edp_psr (intel_dp)) +return ; + +if (!i915_modparams.enable_psr) { +DRM_DEBUG_KMS ("PSR disable by flag\n" ); +return ; + }/* * HSW spec explicitly says PSR is tied to port A. @@ -402,66 +408,70 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)*/ if (HAS_DDI (dev_priv) && dig_port->port !=PORT_A ) {DRM_DEBUG_KMS ("PSR condition failed: Port not supported\n" ); -return false; - } - -if (!i915_modparams.enable_psr) { -DRM_DEBUG_KMS ("PSR disable by flag\n" ); -return false; +return ; }if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && !dev_priv->psr.link_standby) {DRM_ERROR ("PSR condition failed: Link off requested but not supported on this platform\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && -I915_READ (HSW_STEREO_3D_CTL (intel_crtc->config->cpu_transcoder)) & +I915_READ (HSW_STEREO_3D_CTL (crtc_state->cpu_transcoder)) &S3D_ENABLE ) {DRM_DEBUG_KMS ("PSR condition failed: Stereo 3D is Enabled\n" ); -return false; +return ; }if (IS_HASWELL (dev_priv) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); -return false; +return ; } psr_setup_time =drm_dp_psr_setup_time (intel_dp->psr_dpcd);if (psr_setup_time <0 ) {DRM_DEBUG_KMS ("PSR condition failed: Invalid PSR setup time (0x%02x)\n" , intel_dp->psr_dpcd[1 ]); -return false; +return ; }Quoted 13 lines
drivers/gpu/drm/i915/intel_psr.c static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · line 451
Quoted 13 lines
drivers/gpu/drm/i915/intel_psr.c +8
-1if (intel_usecs_to_scanlines (adjusted_mode, psr_setup_time) > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay -1 ) {DRM_DEBUG_KMS ("PSR condition failed: PSR setup time (%d us) too long\n" , psr_setup_time); -return false; +return ; + } + +/* +* FIXME psr2_support is messed up. It's both computed +* dynamically during PSR enable, and extracted from sink +* caps during eDP detection. +*/ +Vathsala
Quoted 74 lines
Quoted 71 lines
drivers/gpu/drm/i915/intel_psr.c +15
-18+if (!dev_priv->psr.psr2_support) { + crtc_state->has_psr = true; +return ; }/* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ -if (dev_priv->psr.psr2_support && - (intel_crtc->config->pipe_src_w >3200 || - intel_crtc->config->pipe_src_h >2000 )) { - dev_priv->psr.psr2_support = false; -return false; +if (adjusted_mode->crtc_hdisplay >3200 || + adjusted_mode->crtc_vdisplay >2000 ) { +DRM_DEBUG_KMS ("PSR2 disabled, panel resolution too big\n" ); +return ; }/* * FIXME:enable psr2 only for y-cordinate psr2 panels * After gtc implementation , remove this restriction. */ -if (!dev_priv->psr.y_cord_support && dev_priv->psr.psr2_support) { +if (!dev_priv->psr.y_cord_support) {DRM_DEBUG_KMS ("PSR2 disabled, panel does not support Y coordinate\n" ); -return false; +return ; } - dev_priv->psr.source_ok = true; -return true; + crtc_state->has_psr = true; + crtc_state->has_psr2 = true; }static void intel_psr_activate (struct intel_dp *intel_dp)@@ -531,14 +541,9 @@ void intel_psr_enable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!crtc_state->has_psr)return ; -if (!is_edp_psr (intel_dp)) { -DRM_DEBUG_KMS ("PSR not supported by this panel\n" ); -return ; - } -WARN_ON (dev_priv->drrs.dp);mutex_lock (&dev_priv->psr.lock);if (dev_priv->psr.enabled) {@@ -546,8 +551,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, goto unlock; } -if (!intel_psr_match_conditions (intel_dp)) - goto unlock; + dev_priv->psr.psr2_support = crtc_state->has_psr2; + dev_priv->psr.source_ok = true; dev_priv->psr.busy_frontbuffer_bits =0 ;@@ -668,7 +673,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -if (!HAS_PSR (dev_priv)) +if (!old_crtc_state->has_psr)return ;mutex_lock (&dev_priv->psr.lock);Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Start tracking PSR state in crtc state (rev2)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Start tracking PSR state in crtc state (rev2)
URL : https://patchwork.freedesktop.org/series/31802/
State : success
== Summary ==
Series 31802v2 drm/i915: Start tracking PSR state in crtc state
https://patchwork.freedesktop.org/api/1.0/series/31802/revisions/2/mbox/
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:454s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:474s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:390s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:573s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:285s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:517s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:523s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:530s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:514s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:559s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:437s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:271s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:592s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:450s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:462s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:503s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:473s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:502s fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:490s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:588s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:657s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:471s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:649s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:539s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:514s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:476s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:576s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:434s
a869721e93a51c2bf425f322514527b4dc3944c8 drm-tip: 2017y-10m-12d-08h-30m-31s UTC integration manifest 54e8e4ae3e27 drm/i915: Start tracking PSR state in crtc state
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6008/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915: Start tracking PSR state in crtc state (rev2)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm/i915: Start tracking PSR state in crtc state (rev2)
URL : https://patchwork.freedesktop.org/series/31802/
State : warning
== Summary ==
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-mmap-wc:
dmesg-warn -> PASS (shard-hsw) fdo#102614
Test kms_universal_plane:
Subgroup disable-primary-vs-flip-pipe-A:
pass -> DMESG-WARN (shard-hsw)
Test prime_self_import:
Subgroup reimport-vs-gem_close-race:
fail -> PASS (shard-hsw) fdo#102655
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2551 pass:1438 dwarn:1 dfail:0 fail:9 skip:1103 time:9661s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6008/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx