From: Ville Syrjälä <[email protected]>

Move the scaler assignment into intel_atomic_check_crtcs(). The
scaler assignment and scale factors are needed for the prefill
vs. vblank length checks performed during
intel_compute_global_watermarks().

I think originally the scaler code itself did some current cdclk
vs. scaling factor checks, which explains why it's being called
so late during intel_atomic_check(). But we've long ago switched
the logic on its head so that scaling dictates the minimum cdclk,
not the other way around.

Reviewed-by: Luca Coelho <[email protected]>
Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index b4f5df88d172..2eb714fbc35f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4234,12 +4234,6 @@ static int intel_crtc_atomic_check_late(struct 
intel_atomic_state *state,
                return ret;
        }
 
-       if (DISPLAY_VER(display) >= 9) {
-               ret = intel_atomic_setup_scalers(state, crtc);
-               if (ret)
-                       return ret;
-       }
-
        if (HAS_IPS(display)) {
                ret = hsw_ips_compute_config(state, crtc);
                if (ret)
@@ -5756,13 +5750,23 @@ static void intel_crtc_check_fastset(const struct 
intel_crtc_state *old_crtc_sta
 
 static int intel_atomic_check_crtcs(struct intel_atomic_state *state)
 {
+       struct intel_display *display = to_intel_display(state);
        struct intel_crtc_state *new_crtc_state;
        struct intel_crtc *crtc;
        int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i)
+       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
+               int ret;
+
                new_crtc_state->min_cdclk = 
intel_crtc_min_cdclk(new_crtc_state);
 
+               if (DISPLAY_VER(display) >= 9) {
+                       ret = intel_atomic_setup_scalers(state, crtc);
+                       if (ret)
+                               return ret;
+               }
+       }
+
        return 0;
 }
 
-- 
2.49.1

Reply via email to