All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915/psr: clarify intel_psr_pre_plane_update() conditions
@ 2025-02-04 14:05 Jani Nikula
  2025-02-04 18:36 ` ✓ CI.Patch_applied: success for drm/i915/psr: clarify intel_psr_pre_plane_update() conditions (rev4) Patchwork
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Jani Nikula @ 2025-02-04 14:05 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: jani.nikula, Jouni Högander, Suraj Kandpal

Make the conditions easier to follow. We don't do anything for
!psr->enabled, so hoist psr->enabled check higher, avoiding all the
checks when !psr->enabled. Stop the bitwise OR abuse on booleans by
removing the temporary variable altogether.

v2: Rebase

Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com> # v1
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 46 +++++++++++-------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 2bdb6c9c2283..861e50ceef85 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -2804,34 +2804,30 @@ void intel_psr_pre_plane_update(struct intel_atomic_state *state,
 					     old_crtc_state->uapi.encoder_mask) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 		struct intel_psr *psr = &intel_dp->psr;
-		bool needs_to_disable = false;
 
 		mutex_lock(&psr->lock);
 
-		/*
-		 * Reasons to disable:
-		 * - PSR disabled in new state
-		 * - All planes will go inactive
-		 * - Changing between PSR versions
-		 * - Region Early Transport changing
-		 * - Display WA #1136: skl, bxt
-		 */
-		needs_to_disable |= intel_crtc_needs_modeset(new_crtc_state);
-		needs_to_disable |= !new_crtc_state->has_psr;
-		needs_to_disable |= !new_crtc_state->active_planes;
-		needs_to_disable |= new_crtc_state->has_sel_update != psr->sel_update_enabled;
-		needs_to_disable |= new_crtc_state->enable_psr2_su_region_et !=
-			psr->su_region_et_enabled;
-		needs_to_disable |= new_crtc_state->has_panel_replay !=
-			psr->panel_replay_enabled;
-		needs_to_disable |= DISPLAY_VER(i915) < 11 &&
-			new_crtc_state->wm_level_disabled;
-
-		if (psr->enabled && needs_to_disable)
-			intel_psr_disable_locked(intel_dp);
-		else if (psr->enabled && new_crtc_state->wm_level_disabled)
-			/* Wa_14015648006 */
-			wm_optimization_wa(intel_dp, new_crtc_state);
+		if (psr->enabled) {
+			/*
+			 * Reasons to disable:
+			 * - PSR disabled in new state
+			 * - All planes will go inactive
+			 * - Changing between PSR versions
+			 * - Region Early Transport changing
+			 * - Display WA #1136: skl, bxt
+			 */
+			if (intel_crtc_needs_modeset(new_crtc_state) ||
+			    !new_crtc_state->has_psr ||
+			    !new_crtc_state->active_planes ||
+			    new_crtc_state->has_sel_update != psr->sel_update_enabled ||
+			    new_crtc_state->enable_psr2_su_region_et != psr->su_region_et_enabled ||
+			    new_crtc_state->has_panel_replay != psr->panel_replay_enabled ||
+			    (DISPLAY_VER(i915) < 11 && new_crtc_state->wm_level_disabled))
+				intel_psr_disable_locked(intel_dp);
+			else if (new_crtc_state->wm_level_disabled)
+				/* Wa_14015648006 */
+				wm_optimization_wa(intel_dp, new_crtc_state);
+		}
 
 		mutex_unlock(&psr->lock);
 	}
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-02-06  5:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 14:05 [PATCH v2] drm/i915/psr: clarify intel_psr_pre_plane_update() conditions Jani Nikula
2025-02-04 18:36 ` ✓ CI.Patch_applied: success for drm/i915/psr: clarify intel_psr_pre_plane_update() conditions (rev4) Patchwork
2025-02-04 18:36 ` ✓ CI.checkpatch: " Patchwork
2025-02-04 18:38 ` ✓ CI.KUnit: " Patchwork
2025-02-04 18:55 ` ✓ CI.Build: " Patchwork
2025-02-04 18:59 ` ✓ CI.Hooks: " Patchwork
2025-02-04 19:02 ` ✓ CI.checksparse: " Patchwork
2025-02-04 19:22 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-02-04 20:04 ` ✗ i915.CI.BAT: failure for drm/i915/psr: clarify intel_psr_pre_plane_update() conditions (rev2) Patchwork
2025-02-05 18:09   ` Jani Nikula
2025-02-06  5:36     ` Ravali, JupallyX
2025-02-04 22:39 ` ✗ Xe.CI.Full: failure for drm/i915/psr: clarify intel_psr_pre_plane_update() conditions (rev4) Patchwork
2025-02-06  5:03 ` ✓ i915.CI.BAT: success for drm/i915/psr: clarify intel_psr_pre_plane_update() conditions (rev2) Patchwork
2025-02-06  5:44 ` ✓ i915.CI.Full: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.