[Intel-gfx] [PATCH 09/15] drm/i915: Fix intel_psr_is_enabled function and document it.
R, Durgadoss
durgadoss.r at intel.com
Tue Nov 18 19:24:30 CET 2014
>-----Original Message-----
>From: Intel-gfx [mailto:intel-gfx-bounces at lists.freedesktop.org] On Behalf Of Rodrigo Vivi
>Sent: Friday, November 14, 2014 10:23 PM
>To: intel-gfx at lists.freedesktop.org
>Cc: Vivi, Rodrigo
>Subject: [Intel-gfx] [PATCH 09/15] drm/i915: Fix intel_psr_is_enabled function and document it.
>
>This function can be used to check if psr feature got enabled.
>However on HSW and BDW we currently force psr exit by disabling
>EDP_PSR_ENABLE bit at EDP_PSR_CTL(dev). So this function was actually
>returning the active/inactive state that is different from the enable/disable
>meaning and had the risk of false negative.
>
>So let's just return the presence of intel_dp at dev_priv->psr.enabled.
>
>It would be more easy to just check this presence directly but let's keep
>it more organized.
Agreed, but shouldn't we protect it using psr.lock ?
Thanks,
Durga
>
>Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
>---
> drivers/gpu/drm/i915/intel_psr.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
>index 66d24c2..c296a89 100644
>--- a/drivers/gpu/drm/i915/intel_psr.c
>+++ b/drivers/gpu/drm/i915/intel_psr.c
>@@ -61,6 +61,16 @@ static bool is_edp_psr(struct intel_dp *intel_dp)
> return intel_dp->psr_dpcd[0] & DP_PSR_IS_SUPPORTED;
> }
>
>+/**
>+ * intel_psr_is_enabled - Is PSR enabled?
>+ * @dev: DRM Device
>+ *
>+ * This function can be used to verify if PSR feature is enabled.
>+ * Since on Haswell+ we force the exit by disabling
>+ * EDP_PSR_ENABLE bit at EDP_PSR_CTL(dev)
>+ * the most reliable way to export if psr feature is enabled is to
>+ * check the presence of intel_dp at dev_priv->psr.enabled.
>+ */
> bool intel_psr_is_enabled(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
>@@ -68,7 +78,7 @@ bool intel_psr_is_enabled(struct drm_device *dev)
> if (!HAS_PSR(dev))
> return false;
>
>- return I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE;
>+ return (bool)dev_priv->psr.enabled;
> }
>
> static void intel_psr_write_vsc(struct intel_dp *intel_dp,
>--
>1.9.3
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list