]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/cdclk: Do intel_cdclk_update_crtc_min_cdclk() per-pipe
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 23 Sep 2025 17:19:34 +0000 (20:19 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 10 Oct 2025 23:51:18 +0000 (02:51 +0300)
Currently we call intel_cdclk_update_crtc_min_cdclk() per-plane.
That is rather wasteful, and also won't account for any of the
other per-pipe min_cdclk restrictions from
intel_crtc_compute_min_cdclk(). Change the behaviour to do
do the comparison per-crtc instead, and use the final min cdclk
as computed by intel_crtc_compute_min_cdclk().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250923171943.7319-13-ville.syrjala@linux.intel.com
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
drivers/gpu/drm/i915/display/intel_cdclk.c
drivers/gpu/drm/i915/display/intel_cdclk.h
drivers/gpu/drm/i915/display/intel_plane.c
drivers/gpu/drm/i915/display/intel_plane.h

index e621dbef9c4902b98d15f3f2516ae79670f4e745..7017429506ee14ceab491aa8d6abee9a25d6fd60 100644 (file)
@@ -2837,10 +2837,10 @@ static int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_stat
        return min_cdclk;
 }
 
-int intel_cdclk_update_crtc_min_cdclk(struct intel_atomic_state *state,
-                                     struct intel_crtc *crtc,
-                                     int old_min_cdclk, int new_min_cdclk,
-                                     bool *need_cdclk_calc)
+static int intel_cdclk_update_crtc_min_cdclk(struct intel_atomic_state *state,
+                                            struct intel_crtc *crtc,
+                                            int old_min_cdclk, int new_min_cdclk,
+                                            bool *need_cdclk_calc)
 {
        struct intel_display *display = to_intel_display(state);
        struct intel_cdclk_state *cdclk_state;
@@ -3281,6 +3281,27 @@ static int intel_cdclk_modeset_checks(struct intel_atomic_state *state,
        return 0;
 }
 
+static int intel_crtcs_calc_min_cdclk(struct intel_atomic_state *state,
+                                     bool *need_cdclk_calc)
+{
+       const struct intel_crtc_state *old_crtc_state;
+       const struct intel_crtc_state *new_crtc_state;
+       struct intel_crtc *crtc;
+       int i, ret;
+
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+                                           new_crtc_state, i) {
+               ret = intel_cdclk_update_crtc_min_cdclk(state, crtc,
+                                                       intel_crtc_compute_min_cdclk(old_crtc_state),
+                                                       intel_crtc_compute_min_cdclk(new_crtc_state),
+                                                       need_cdclk_calc);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
 int intel_cdclk_atomic_check(struct intel_atomic_state *state,
                             bool *need_cdclk_calc)
 {
@@ -3300,11 +3321,12 @@ int intel_cdclk_atomic_check(struct intel_atomic_state *state,
         * planes are part of the state. We can now compute the minimum cdclk
         * for each plane.
         */
-       for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
-               ret = intel_plane_calc_min_cdclk(state, plane, need_cdclk_calc);
-               if (ret)
-                       return ret;
-       }
+       for_each_new_intel_plane_in_state(state, plane, plane_state, i)
+               intel_plane_calc_min_cdclk(state, plane);
+
+       ret = intel_crtcs_calc_min_cdclk(state, need_cdclk_calc);
+       if (ret)
+               return ret;
 
        ret = intel_bw_calc_min_cdclk(state, need_cdclk_calc);
        if (ret)
index 25d45c8f059d954323cf11107d5c236c50cc5715..0e67c75ca569fbcd0cfdc44ffc2e295312c2b80a 100644 (file)
@@ -51,10 +51,6 @@ void intel_cdclk_crtc_disable_noatomic(struct intel_crtc *crtc);
 int intel_cdclk_update_bw_min_cdclk(struct intel_atomic_state *state,
                                    int old_min_cdclk, int new_min_cdclk,
                                    bool *need_cdclk_calc);
-int intel_cdclk_update_crtc_min_cdclk(struct intel_atomic_state *state,
-                                     struct intel_crtc *crtc,
-                                     int old_min_cdclk, int new_min_cdclk,
-                                     bool *need_cdclk_calc);
 
 #define to_intel_cdclk_state(global_state) \
        container_of_const((global_state), struct intel_cdclk_state, base)
index aceac2ef28a87f17199dbc890747c16063b89409..a1ca8547a3daf1a91a0f4cd164c6be911e1f3d9c 100644 (file)
@@ -291,34 +291,21 @@ intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
                                   rel_data_rate);
 }
 
-int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
-                              struct intel_plane *plane,
-                              bool *need_cdclk_calc)
+void intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
+                               struct intel_plane *plane)
 {
        const struct intel_plane_state *plane_state =
                intel_atomic_get_new_plane_state(state, plane);
        struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc);
-       const struct intel_crtc_state *old_crtc_state;
        struct intel_crtc_state *new_crtc_state;
-       int ret;
 
        if (!plane_state->uapi.visible || !plane->min_cdclk)
-               return 0;
+               return;
 
-       old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
        new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 
        new_crtc_state->min_cdclk[plane->id] =
                plane->min_cdclk(new_crtc_state, plane_state);
-
-       ret = intel_cdclk_update_crtc_min_cdclk(state, crtc,
-                                               old_crtc_state->min_cdclk[plane->id],
-                                               new_crtc_state->min_cdclk[plane->id],
-                                               need_cdclk_calc);
-       if (ret)
-               return ret;
-
-       return 0;
 }
 
 static void intel_plane_clear_hw_state(struct intel_plane_state *plane_state)
index 8af41ccc0a6945b76be10028dab364da6a509cdf..c6bef1b3471d31421a631ef2823fcb576025dec3 100644 (file)
@@ -69,9 +69,8 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
                                        struct intel_crtc_state *crtc_state,
                                        const struct intel_plane_state *old_plane_state,
                                        struct intel_plane_state *intel_state);
-int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
-                              struct intel_plane *plane,
-                              bool *need_cdclk_calc);
+void intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
+                               struct intel_plane *plane);
 int intel_plane_check_clipping(struct intel_plane_state *plane_state,
                               struct intel_crtc_state *crtc_state,
                               int min_scale, int max_scale,