drm/i915/psr: Unify pre/post hooks
authorJouni Högander <jouni.hogander@intel.com>
Wed, 29 Mar 2023 15:06:58 +0000 (18:06 +0300)
committerJouni Högander <jouni.hogander@intel.com>
Fri, 31 Mar 2023 05:42:42 +0000 (08:42 +0300)
pre/post hooks are doing things differently. Unify them.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230329150703.432072-2-jouni.hogander@intel.com
drivers/gpu/drm/i915/display/intel_psr.c

index 31084d9..8dbf452 100644 (file)
@@ -1954,23 +1954,22 @@ static void _intel_psr_post_plane_update(const struct intel_atomic_state *state,
                                             crtc_state->uapi.encoder_mask) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
                struct intel_psr *psr = &intel_dp->psr;
+               bool keep_disabled = false;
 
                mutex_lock(&psr->lock);
 
-               if (psr->sink_not_reliable)
-                       goto exit;
-
                drm_WARN_ON(&dev_priv->drm, psr->enabled && !crtc_state->active_planes);
 
-               /* Only enable if there is active planes */
-               if (!psr->enabled && crtc_state->active_planes)
+               keep_disabled |= psr->sink_not_reliable;
+               keep_disabled |= !crtc_state->active_planes;
+
+               if (!psr->enabled && !keep_disabled)
                        intel_psr_enable_locked(intel_dp, crtc_state);
 
                /* Force a PSR exit when enabling CRC to avoid CRC timeouts */
                if (crtc_state->crc_enabled && psr->enabled)
                        psr_force_hw_tracking_exit(intel_dp);
 
-exit:
                mutex_unlock(&psr->lock);
        }
 }