This patch gives RPM the hability to block PSR whenever needed. It is in a separated patch because besides the credits the RPM part is still uncertaing at this time. This blocker logic was heavily copied from Dhinakaran's patch [3/3] drm/i915/psr: Do not activate PSR when vblank interrupts are enabled Credits-to: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_psr.c | 43 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 65ada5d..4892972 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1020,6 +1020,7 @@ struct i915_psr { bool active; struct delayed_work work; unsigned busy_frontbuffer_bits; + bool rpm_block; bool psr2_support; bool aux_frame_sync; bool link_standby; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 102c858..d26c3fb 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1567,6 +1567,8 @@ void intel_psr_flush(struct drm_i915_private *dev_priv, unsigned frontbuffer_bits, enum fb_op_origin origin); void intel_psr_init(struct drm_i915_private *dev_priv); +void intel_psr_rpm_block(struct drm_i915_private *dev_priv); +void intel_psr_rpm_unblock(struct drm_i915_private *dev_priv); void intel_psr_single_frame_update(struct drm_i915_private *dev_priv, unsigned frontbuffer_bits); diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c index 24e282b..2be94ef 100644 --- a/drivers/gpu/drm/i915/intel_psr.c +++ b/drivers/gpu/drm/i915/intel_psr.c @@ -660,6 +660,49 @@ static void intel_psr_exit(struct drm_i915_private *dev_priv) } /** + * intel_psr_rpm_block - PSR blocker for Runtime PM. + * @dev_priv: DRM i915 private device + * + * This function provides a psr blocker scheme for runtime PM. + * In case runtime PM domains need to block PSR for any reason + * this function needs to be called. + * It will immediately force PSR exit and prevent PSR to get activated. + */ +void intel_psr_rpm_block(struct drm_i915_private *dev_priv) +{ + mutex_lock(&dev_priv->psr.lock); + if (!dev_priv->psr.enabled) + goto unlock; + + dev_priv->psr.rpm_block = true; + + if (dev_priv->psr.active) + intel_psr_exit(dev_priv); +unlock: + mutex_unlock(&dev_priv->psr.lock); +} + +/** + * intel_psr_rpm_unblock - PSR unblocker for Runtime PM. + * @dev_priv: DRM i915 private device + * + * This function unblock PSR. Should only be called by RPM + * after the domain in question had blocked PSR but now is being put. + */ +void intel_psr_rpm_unblock(struct drm_i915_private *dev_priv) +{ + mutex_lock(&dev_priv->psr.lock); + if (!dev_priv->psr.enabled) + goto unlock; + + dev_priv->psr.rpm_block = false; + + schedule_delayed_work(&dev_priv->psr.work, msecs_to_jiffies(100)); +unlock: + mutex_unlock(&dev_priv->psr.lock); +} + +/** * intel_psr_single_frame_update - Single Frame Update * @dev_priv: DRM i915 private device * @frontbuffer_bits: frontbuffer plane tracking bits -- 2.4.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx