]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/display: stop passing i to for_each_*_intel_crtc_in_state() macros
authorJani Nikula <jani.nikula@intel.com>
Wed, 13 May 2026 07:58:39 +0000 (10:58 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 26 May 2026 22:08:11 +0000 (01:08 +0300)
None of the for_each_*_intel_crtc_in_state() macros or their users
actually need the CRTC index i variable anymore. Remove them.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/edb9dc76cb9cad50622a1f425abaf076d1509888.1778659089.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
14 files changed:
drivers/gpu/drm/i915/display/i9xx_wm.c
drivers/gpu/drm/i915/display/intel_atomic.c
drivers/gpu/drm/i915/display/intel_bw.c
drivers/gpu/drm/i915/display/intel_cdclk.c
drivers/gpu/drm/i915/display/intel_crtc.c
drivers/gpu/drm/i915/display/intel_dbuf_bw.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_dp_tunnel.c
drivers/gpu/drm/i915/display/intel_fdi.c
drivers/gpu/drm/i915/display/intel_plane.c
drivers/gpu/drm/i915/display/intel_pmdemand.c
drivers/gpu/drm/i915/display/intel_vrr.c
drivers/gpu/drm/i915/display/skl_watermark.c

index 19b61d4c1fae300115126571ad92aefb1c6c6a84..86d1c9f7f0ff01f1f331aee092e0663c6e724a93 100644 (file)
@@ -3582,7 +3582,6 @@ void ilk_wm_sanitize(struct intel_display *display)
        struct intel_crtc_state *crtc_state;
        struct drm_modeset_acquire_ctx ctx;
        int ret;
-       int i;
 
        /* Only supported on platforms that use atomic watermark design */
        if (!display->wm.funcs->optimize_watermarks)
@@ -3620,7 +3619,7 @@ retry:
                goto fail;
 
        /* Write calculated watermark values back */
-       for_each_new_intel_crtc_in_state(intel_state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(intel_state, crtc, crtc_state) {
                crtc_state->wm.need_postvbl_update = true;
                intel_optimize_watermarks(intel_state, crtc);
 
index 38bbd6964d8ee4587576637648a7cab671d38ea2..0e4f0678c53cd34145f756669580e1a376f612d4 100644 (file)
@@ -200,9 +200,8 @@ bool intel_any_crtc_needs_modeset(struct intel_atomic_state *state)
 {
        struct intel_crtc *crtc;
        struct intel_crtc_state *crtc_state;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (intel_crtc_needs_modeset(crtc_state))
                        return true;
        }
index 07f711d6c7626b7510f18a911abc6c8eda18969d..d5aac5abea6f9fcd3025acdd65aac535b8f542a6 100644 (file)
@@ -1270,10 +1270,8 @@ static int intel_bw_check_data_rate(struct intel_atomic_state *state, bool *chan
        struct intel_display *display = to_intel_display(state);
        const struct intel_crtc_state *new_crtc_state, *old_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                unsigned int old_data_rate =
                        intel_crtc_bw_data_rate(old_crtc_state);
                unsigned int new_data_rate =
@@ -1319,10 +1317,9 @@ static int intel_bw_check_sagv_mask(struct intel_atomic_state *state)
        const struct intel_bw_state *old_bw_state = NULL;
        struct intel_bw_state *new_bw_state = NULL;
        struct intel_crtc *crtc;
-       int ret, i;
+       int ret;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (intel_crtc_can_enable_sagv(old_crtc_state) ==
                    intel_crtc_can_enable_sagv(new_crtc_state))
                        continue;
index 2fa7e8c3bb264a8960095f6d4310469e01f3e3f7..189ae2d3cfc9e44eae5473cb4ef853f70716c48e 100644 (file)
@@ -3124,10 +3124,9 @@ static int bxt_compute_min_voltage_level(struct intel_atomic_state *state)
        struct intel_crtc *crtc;
        struct intel_crtc_state *crtc_state;
        u8 min_voltage_level;
-       int i;
        enum pipe pipe;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                int ret;
 
                if (crtc_state->hw.enable)
@@ -3219,13 +3218,13 @@ static int skl_dpll0_vco(struct intel_atomic_state *state)
                intel_atomic_get_new_cdclk_state(state);
        struct intel_crtc *crtc;
        struct intel_crtc_state *crtc_state;
-       int vco, i;
+       int vco;
 
        vco = cdclk_state->logical.vco;
        if (!vco)
                vco = display->cdclk.skl_preferred_vco_freq;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (!crtc_state->hw.enable)
                        continue;
 
@@ -3424,10 +3423,9 @@ static int intel_crtcs_calc_min_cdclk(struct intel_atomic_state *state,
        const struct intel_crtc_state *old_crtc_state;
        const struct intel_crtc_state *new_crtc_state;
        struct intel_crtc *crtc;
-       int i, ret;
+       int ret;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                ret = intel_cdclk_update_crtc_min_cdclk(state, crtc,
                                                        old_crtc_state->min_cdclk,
                                                        new_crtc_state->min_cdclk,
index f3403128a313b7b89b0b7ae78eeb1bd271906191..7ce2b52297d17215bb35920573e174669d114704 100644 (file)
@@ -538,9 +538,8 @@ void intel_wait_for_vblank_workers(struct intel_atomic_state *state)
 {
        struct intel_crtc_state *crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (!intel_crtc_needs_vblank_work(crtc_state))
                        continue;
 
@@ -832,10 +831,8 @@ bool intel_any_crtc_enable_changed(struct intel_atomic_state *state)
 {
        const struct intel_crtc_state *old_crtc_state, *new_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (intel_crtc_enable_changed(old_crtc_state, new_crtc_state))
                        return true;
        }
@@ -853,10 +850,8 @@ bool intel_any_crtc_active_changed(struct intel_atomic_state *state)
 {
        const struct intel_crtc_state *old_crtc_state, *new_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (intel_crtc_active_changed(old_crtc_state, new_crtc_state))
                        return true;
        }
index 1f38317b38bbc2ccf08ad8949927eedcc176dcb7..6cf674c586dc48a1a3fc1275b83524470a382916 100644 (file)
@@ -184,13 +184,12 @@ int intel_dbuf_bw_calc_min_cdclk(struct intel_atomic_state *state,
        const struct intel_crtc_state *old_crtc_state;
        const struct intel_crtc_state *new_crtc_state;
        struct intel_crtc *crtc;
-       int ret, i;
+       int ret;
 
        if (DISPLAY_VER(display) < 9)
                return 0;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                struct intel_dbuf_bw old_dbuf_bw, new_dbuf_bw;
 
                skl_crtc_calc_dbuf_bw(&old_dbuf_bw, old_crtc_state);
index af9a9bc52d114f35f29c0ad752184ea487238440..290bbefece4ac260748211ad56797575f2058e65 100644 (file)
@@ -1317,14 +1317,13 @@ static void intel_encoders_update_prepare(struct intel_atomic_state *state)
        struct intel_display *display = to_intel_display(state);
        struct intel_crtc_state *new_crtc_state, *old_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
        /*
         * Make sure the DPLL state is up-to-date for fastset TypeC ports after non-blocking commits.
         * TODO: Update the DPLL state for all cases in the encoder->update_prepare() hook.
         */
        if (display->dpll.mgr) {
-               for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+               for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                        if (intel_crtc_needs_modeset(new_crtc_state))
                                continue;
 
@@ -5708,10 +5707,9 @@ static int hsw_mode_set_planes_workaround(struct intel_atomic_state *state)
        struct intel_crtc_state *first_crtc_state = NULL;
        struct intel_crtc_state *other_crtc_state = NULL;
        enum pipe first_pipe = INVALID_PIPE, enabled_pipe = INVALID_PIPE;
-       int i;
 
        /* look at all crtc's that are going to be enabled in during modeset */
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (!crtc_state->hw.active ||
                    !intel_crtc_needs_modeset(crtc_state))
                        continue;
@@ -5761,9 +5759,8 @@ u8 intel_calc_enabled_pipes(struct intel_atomic_state *state,
 {
        const struct intel_crtc_state *crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (crtc_state->hw.enable)
                        enabled_pipes |= BIT(crtc->pipe);
                else
@@ -5778,9 +5775,8 @@ u8 intel_calc_active_pipes(struct intel_atomic_state *state,
 {
        const struct intel_crtc_state *crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                if (crtc_state->hw.active)
                        active_pipes |= BIT(crtc->pipe);
                else
@@ -5851,9 +5847,8 @@ static int intel_atomic_check_crtcs(struct intel_atomic_state *state)
        struct intel_display *display = to_intel_display(state);
        struct intel_crtc_state __maybe_unused *crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                int ret;
 
                ret = intel_crtc_atomic_check(state, crtc);
@@ -5873,9 +5868,8 @@ static bool intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,
 {
        const 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) {
                if (new_crtc_state->hw.enable &&
                    transcoders & BIT(new_crtc_state->cpu_transcoder) &&
                    intel_crtc_needs_modeset(new_crtc_state))
@@ -5890,9 +5884,8 @@ static bool intel_pipes_need_modeset(struct intel_atomic_state *state,
 {
        const 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) {
                if (new_crtc_state->hw.enable &&
                    pipes & BIT(crtc->pipe) &&
                    intel_crtc_needs_modeset(new_crtc_state))
@@ -6263,7 +6256,7 @@ static int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state)
        }
 
        /* Now pull in all joined crtcs */
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                affected_pipes |= crtc_state->joiner_pipes;
                if (intel_crtc_needs_modeset(crtc_state))
                        modeset_pipes |= crtc_state->joiner_pipes;
@@ -6291,7 +6284,7 @@ static int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state)
                        return ret;
        }
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                /* Kill old joiner link, we may re-establish afterwards */
                if (intel_crtc_needs_modeset(crtc_state) &&
                    intel_crtc_is_joiner_primary(crtc_state))
@@ -6309,7 +6302,6 @@ static int intel_atomic_check_config(struct intel_atomic_state *state,
        struct intel_crtc_state *new_crtc_state;
        struct intel_crtc *crtc;
        int ret;
-       int i;
 
        *failed_pipe = INVALID_PIPE;
 
@@ -6321,7 +6313,7 @@ static int intel_atomic_check_config(struct intel_atomic_state *state,
        if (ret)
                return ret;
 
-       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) {
                if (!intel_crtc_needs_modeset(new_crtc_state)) {
                        if (!intel_crtc_is_joiner_secondary(new_crtc_state))
                                intel_crtc_copy_uapi_to_hw_state_nomodeset(state, crtc);
@@ -6343,7 +6335,7 @@ static int intel_atomic_check_config(struct intel_atomic_state *state,
                        goto fail;
        }
 
-       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) {
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
 
@@ -6415,13 +6407,12 @@ int intel_atomic_check(struct drm_device *dev,
        struct intel_atomic_state *state = to_intel_atomic_state(_state);
        struct intel_crtc_state *old_crtc_state, *new_crtc_state;
        struct intel_crtc *crtc;
-       int ret, i;
+       int ret;
 
        if (!intel_display_driver_check_access(display))
                return -ENODEV;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                /*
                 * crtc's state no longer considered to be inherited
                 * after the first userspace/client initiated commit.
@@ -6447,7 +6438,7 @@ int intel_atomic_check(struct drm_device *dev,
        if (ret)
                goto fail;
 
-       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) {
                ret = intel_async_flip_check_uapi(state, crtc);
                if (ret)
                        return ret;
@@ -6457,7 +6448,7 @@ int intel_atomic_check(struct drm_device *dev,
        if (ret)
                goto fail;
 
-       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) {
                if (!intel_crtc_needs_modeset(new_crtc_state)) {
                        if (intel_crtc_is_joiner_secondary(new_crtc_state))
                                copy_joiner_crtc_state_nomodeset(state, crtc);
@@ -6474,8 +6465,7 @@ int intel_atomic_check(struct drm_device *dev,
                        goto fail;
        }
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
 
@@ -6495,7 +6485,7 @@ int intel_atomic_check(struct drm_device *dev,
         * needs a full modeset, all other synced crtcs should be
         * forced a full modeset.
         */
-       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) {
                if (!new_crtc_state->hw.enable || intel_crtc_needs_modeset(new_crtc_state))
                        continue;
 
@@ -6525,8 +6515,7 @@ int intel_atomic_check(struct drm_device *dev,
                }
        }
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
 
@@ -6543,7 +6532,7 @@ int intel_atomic_check(struct drm_device *dev,
        if (ret)
                goto fail;
 
-       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)
                new_crtc_state->min_cdclk = intel_crtc_min_cdclk(new_crtc_state);
 
        ret = intel_compute_global_watermarks(state);
@@ -6576,8 +6565,7 @@ int intel_atomic_check(struct drm_device *dev,
        if (ret)
                goto fail;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                intel_color_assert_luts(new_crtc_state);
 
                ret = intel_async_flip_check_hw(state, crtc);
@@ -6608,8 +6596,7 @@ int intel_atomic_check(struct drm_device *dev,
         * FIXME would probably be nice to know which crtc specifically
         * caused the failure, in cases where we can pinpoint it.
         */
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i)
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state)
                intel_crtc_state_dump(new_crtc_state, state, "failed");
 
        return ret;
@@ -6925,10 +6912,8 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
        const struct intel_crtc_state *new_crtc_state, *old_crtc_state;
        struct intel_crtc *crtc;
        u8 disable_pipes = 0;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
 
@@ -6944,7 +6929,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
                disable_pipes |= BIT(crtc->pipe);
        }
 
-       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) {
+       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state) {
                if ((disable_pipes & BIT(crtc->pipe)) == 0)
                        continue;
 
@@ -6954,7 +6939,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
        }
 
        /* Only disable port sync and MST slaves */
-       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) {
+       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state) {
                if ((disable_pipes & BIT(crtc->pipe)) == 0)
                        continue;
 
@@ -6976,7 +6961,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
        }
 
        /* Disable everything else left on */
-       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) {
+       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state) {
                if ((disable_pipes & BIT(crtc->pipe)) == 0)
                        continue;
 
@@ -6995,9 +6980,8 @@ static void intel_commit_modeset_enables(struct intel_atomic_state *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) {
                if (!new_crtc_state->hw.active)
                        continue;
 
@@ -7005,7 +6989,7 @@ static void intel_commit_modeset_enables(struct intel_atomic_state *state)
                intel_pre_update_crtc(state, crtc);
        }
 
-       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) {
                if (!new_crtc_state->hw.active)
                        continue;
 
@@ -7020,9 +7004,8 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
        struct intel_crtc_state *old_crtc_state, *new_crtc_state;
        struct skl_ddb_entry entries[I915_MAX_PIPES] = {};
        u8 update_pipes = 0, modeset_pipes = 0;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                enum pipe pipe = crtc->pipe;
 
                if (!new_crtc_state->hw.active)
@@ -7046,7 +7029,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
         * So first lets enable all pipes that do not need a fullmodeset as
         * those don't have any external dependency.
         */
-       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) {
                enum pipe pipe = crtc->pipe;
 
                if ((update_pipes & BIT(pipe)) == 0)
@@ -7062,8 +7045,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
                 * Commit in reverse order to make joiner primary
                 * send the uapi events after secondaries are done.
                 */
-               for_each_oldnew_intel_crtc_in_state_reverse(state, crtc, old_crtc_state,
-                                                           new_crtc_state, i) {
+               for_each_oldnew_intel_crtc_in_state_reverse(state, crtc, old_crtc_state, new_crtc_state) {
                        enum pipe pipe = crtc->pipe;
 
                        if ((update_pipes & BIT(pipe)) == 0)
@@ -7099,7 +7081,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
         * Enable all pipes that needs a modeset and do not depends on other
         * pipes
         */
-       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) {
                enum pipe pipe = crtc->pipe;
 
                if ((modeset_pipes & BIT(pipe)) == 0)
@@ -7121,7 +7103,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
         * Then we enable all remaining pipes that depend on other
         * pipes: MST slaves and port sync masters
         */
-       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) {
                enum pipe pipe = crtc->pipe;
 
                if ((modeset_pipes & BIT(pipe)) == 0)
@@ -7138,7 +7120,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
        /*
         * Finally we do the plane updates/etc. for all pipes that got enabled.
         */
-       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) {
                enum pipe pipe = crtc->pipe;
 
                if ((update_pipes & BIT(pipe)) == 0)
@@ -7151,7 +7133,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
         * Commit in reverse order to make joiner primary
         * send the uapi events after secondaries are done.
         */
-       for_each_new_intel_crtc_in_state_reverse(state, crtc, new_crtc_state, i) {
+       for_each_new_intel_crtc_in_state_reverse(state, crtc, new_crtc_state) {
                enum pipe pipe = crtc->pipe;
 
                if ((update_pipes & BIT(pipe)) == 0)
@@ -7216,9 +7198,8 @@ static void intel_atomic_cleanup_work(struct work_struct *work)
        struct intel_display *display = to_intel_display(state);
        struct intel_crtc_state *old_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i)
+       for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state)
                intel_atomic_dsb_cleanup(old_crtc_state);
 
        drm_atomic_helper_cleanup_planes(display->drm, &state->base);
@@ -7448,9 +7429,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
        struct intel_crtc *crtc;
        struct intel_power_domain_mask put_domains[I915_MAX_PIPES] = {};
        struct ref_tracker *wakeref = NULL;
-       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)
                intel_atomic_dsb_prepare(state, crtc);
 
        intel_atomic_commit_fence_wait(state);
@@ -7459,10 +7439,10 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 
        intel_atomic_prepare_plane_clear_colors(state);
 
-       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)
                intel_fbc_prepare_dirty_rect(state, crtc);
 
-       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)
                intel_atomic_dsb_finish(state, crtc);
 
        drm_atomic_helper_wait_for_dependencies(&state->base);
@@ -7498,8 +7478,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
         */
        wakeref = intel_display_power_get(display, POWER_DOMAIN_DC_OFF);
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (intel_crtc_needs_modeset(new_crtc_state) ||
                    intel_crtc_needs_fastset(new_crtc_state))
                        intel_modeset_get_crtc_power_domains(new_crtc_state, &put_domains[crtc->pipe]);
@@ -7510,7 +7489,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
        intel_dp_tunnel_atomic_alloc_bw(state);
 
        /* FIXME: Eventually get rid of our crtc->config pointer */
-       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)
                crtc->config = new_crtc_state;
 
        /*
@@ -7532,7 +7511,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
        intel_sagv_pre_plane_update(state);
 
        /* Complete the events for pipes that have now been disabled */
-       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) {
                bool modeset = intel_crtc_needs_modeset(new_crtc_state);
 
                /* Complete events for now disable pipes here. */
@@ -7550,7 +7529,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 
        intel_dbuf_pre_plane_update(state);
 
-       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) {
                if (new_crtc_state->do_async_flip)
                        intel_crtc_enable_flip_done(state, crtc);
        }
@@ -7574,7 +7553,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
         */
        drm_atomic_helper_wait_for_flip_done(display->drm, &state->base);
 
-       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) {
                if (new_crtc_state->do_async_flip)
                        intel_crtc_disable_flip_done(state, crtc);
 
@@ -7594,8 +7573,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
         *
         * TODO: Move this (and other cleanup) to an async worker eventually.
         */
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                /*
                 * Gen2 reports pipe underruns whenever all planes are disabled.
                 * So re-enable underrun reporting after some planes get enabled.
@@ -7612,7 +7590,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 
        intel_dbuf_post_plane_update(state);
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                intel_post_plane_update(state, crtc);
 
                intel_modeset_put_crtc_power_domains(crtc, &put_domains[crtc->pipe]);
@@ -7756,9 +7734,8 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_commit *_state
        if (DISPLAY_VER(display) < 9 && state->base.legacy_cursor_update) {
                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)
                        if (new_crtc_state->wm.need_postvbl_update ||
                            new_crtc_state->update_wm_post)
                                state->base.legacy_cursor_update = false;
index 82c4aa9de7d36361c9e16220154e9d6f40b940f4..a24d16d02f96bd16f60b3b156ffad09a02b517fd 100644 (file)
@@ -287,31 +287,26 @@ enum phy_fia {
             (__i)++) \
                for_each_if(plane)
 
-#define for_each_old_intel_crtc_in_state(__state, crtc, old_crtc_state, __i) \
+#define for_each_old_intel_crtc_in_state(__state, crtc, old_crtc_state) \
        for_each_intel_crtc(to_intel_display(__state), (crtc)) \
-               for_each_if(((__i) = drm_crtc_index(&(crtc)->base), (void)(__i), \
-                            (old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc))))
+               for_each_if((old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc)))
 
-#define for_each_new_intel_crtc_in_state(__state, crtc, new_crtc_state, __i) \
+#define for_each_new_intel_crtc_in_state(__state, crtc, new_crtc_state) \
        for_each_intel_crtc(to_intel_display(__state), (crtc)) \
-               for_each_if(((__i) = drm_crtc_index(&(crtc)->base), (void)(__i), \
-                            (new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc))))
+               for_each_if((new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc)))
 
-#define for_each_new_intel_crtc_in_state_reverse(__state, crtc, new_crtc_state, __i) \
+#define for_each_new_intel_crtc_in_state_reverse(__state, crtc, new_crtc_state) \
        for_each_intel_crtc_reverse(to_intel_display(__state), (crtc)) \
-               for_each_if(((__i) = drm_crtc_index(&(crtc)->base), (void)(__i), \
-                            (new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc))))
+               for_each_if((new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc)))
 
-#define for_each_oldnew_intel_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state, __i) \
+#define for_each_oldnew_intel_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state) \
        for_each_intel_crtc(to_intel_display(__state), (crtc)) \
-               for_each_if(((__i) = drm_crtc_index(&(crtc)->base), (void)(__i), \
-                            (old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc)), \
+               for_each_if(((old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc)), \
                             (new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc))))
 
-#define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc, old_crtc_state, new_crtc_state, __i) \
+#define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc, old_crtc_state, new_crtc_state) \
        for_each_intel_crtc_reverse(to_intel_display(__state), (crtc)) \
-               for_each_if(((__i) = drm_crtc_index(&(crtc)->base), (void)(__i), \
-                            (old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc)), \
+               for_each_if(((old_crtc_state) = intel_atomic_get_old_crtc_state((__state), (crtc)), \
                             (new_crtc_state) = intel_atomic_get_new_crtc_state((__state), (crtc))))
 
 #define intel_atomic_crtc_state_for_each_plane_state( \
index 10d47faa69963caa38836b524ca3662d8f274822..d6bd1f7e01e1830c7668af9ca093d4c23f3c5922 100644 (file)
@@ -740,9 +740,8 @@ static void atomic_decrease_bw(struct intel_atomic_state *state)
        struct intel_crtc *crtc;
        const struct intel_crtc_state *old_crtc_state;
        const struct intel_crtc_state *new_crtc_state;
-       int i;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                const struct drm_dp_tunnel_state *new_tunnel_state;
                struct drm_dp_tunnel *tunnel;
                int old_bw;
@@ -795,9 +794,8 @@ static void atomic_increase_bw(struct intel_atomic_state *state)
 {
        struct intel_crtc *crtc;
        const struct intel_crtc_state *crtc_state;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                struct drm_dp_tunnel_state *tunnel_state;
                struct drm_dp_tunnel *tunnel = crtc_state->dp_tunnel_ref.tunnel;
                int bw;
index f8876aa23c9ff537d11a9b9488f85d649a02314a..c170d3104e4cb85699b2f6f907cdb3ab13f2ebc1 100644 (file)
@@ -368,9 +368,8 @@ int intel_fdi_atomic_check_link(struct intel_atomic_state *state,
 {
        struct intel_crtc *crtc;
        struct intel_crtc_state *crtc_state;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                int ret;
 
                if (!crtc_state->has_pch_encoder ||
index e191a57f02cdbe6d64f2ca05a696ca39af8678bb..2a52b36c646c76503d9ac31cfd5e49371f4b2fbf 100644 (file)
@@ -1831,9 +1831,8 @@ static int intel_add_affected_planes(struct intel_atomic_state *state)
 {
        const struct intel_crtc_state *crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                int ret;
 
                ret = intel_joiner_add_affected_planes(state, intel_crtc_joined_pipe_mask(crtc_state));
@@ -1867,8 +1866,7 @@ int intel_plane_atomic_check(struct intel_atomic_state *state)
                }
        }
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                u8 old_active_planes, new_active_planes;
 
                ret = icl_check_nv12_planes(state, crtc);
index 7819b724795bb53a4e58cc11d4b8ffb56e0cf188..6d32c52269a66fada384d7884f81c46aaef56548 100644 (file)
@@ -190,7 +190,7 @@ intel_pmdemand_update_max_ddiclk(struct intel_display *display,
        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)
                intel_pmdemand_update_port_clock(display, pmdemand_state,
                                                 crtc->pipe,
                                                 new_crtc_state->port_clock);
@@ -299,7 +299,6 @@ static bool intel_pmdemand_needs_update(struct intel_atomic_state *state)
 {
        const struct intel_crtc_state *new_crtc_state, *old_crtc_state;
        struct intel_crtc *crtc;
-       int i;
 
        if (intel_bw_pmdemand_needs_update(state))
                return true;
@@ -310,8 +309,7 @@ static bool intel_pmdemand_needs_update(struct intel_atomic_state *state)
        if (intel_cdclk_pmdemand_needs_update(state))
                return true;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i)
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state)
                if (new_crtc_state->port_clock != old_crtc_state->port_clock)
                        return true;
 
index 1b09992ce9fddd0aa5c7e77ea247b6a73f6ffc54..e03b5daac5be011b6eddd7bb5b0a1efd09d46a10 100644 (file)
@@ -94,12 +94,10 @@ bool intel_vrr_possible(const struct intel_crtc_state *crtc_state)
 void
 intel_vrr_check_modeset(struct intel_atomic_state *state)
 {
-       int i;
        struct intel_crtc_state *old_crtc_state, *new_crtc_state;
        struct intel_crtc *crtc;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                if (new_crtc_state->uapi.vrr_enabled !=
                    old_crtc_state->uapi.vrr_enabled)
                        new_crtc_state->uapi.mode_changed = true;
index 346e97d91d928f4a32fae5e772c732406d0dd88b..5a3677ea25b071f16f32479043f3b9e857577eb3 100644 (file)
@@ -2495,9 +2495,9 @@ skl_compute_ddb(struct intel_atomic_state *state)
        struct intel_dbuf_state *new_dbuf_state = NULL;
        struct intel_crtc_state *new_crtc_state;
        struct intel_crtc *crtc;
-       int ret, i;
+       int ret;
 
-       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) {
                new_dbuf_state = intel_atomic_get_dbuf_state(state);
                if (IS_ERR(new_dbuf_state))
                        return PTR_ERR(new_dbuf_state);
@@ -2561,7 +2561,7 @@ skl_compute_ddb(struct intel_atomic_state *state)
                            str_yes_no(new_dbuf_state->joined_mbus));
        }
 
-       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) {
                enum pipe pipe = crtc->pipe;
 
                new_dbuf_state->weight[pipe] = intel_crtc_ddb_weight(new_crtc_state);
@@ -2580,7 +2580,7 @@ skl_compute_ddb(struct intel_atomic_state *state)
                        return ret;
        }
 
-       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) {
                ret = skl_crtc_allocate_plane_ddb(state, crtc);
                if (ret)
                        return ret;
@@ -2687,13 +2687,11 @@ skl_print_wm_changes(struct intel_atomic_state *state)
        const struct intel_crtc_state *new_crtc_state;
        struct intel_plane *plane;
        struct intel_crtc *crtc;
-       int i;
 
        if (!drm_debug_enabled(DRM_UT_KMS))
                return;
 
-       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-                                           new_crtc_state, i) {
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
                const struct skl_pipe_wm *old_pipe_wm, *new_pipe_wm;
 
                old_pipe_wm = &old_crtc_state->wm.skl.optimal;
@@ -2833,13 +2831,13 @@ static int pkgc_max_linetime(struct intel_atomic_state *state)
        struct intel_display *display = to_intel_display(state);
        const struct intel_crtc_state *crtc_state;
        struct intel_crtc *crtc;
-       int i, max_linetime;
+       int max_linetime;
 
        /*
         * Apparenty the hardware uses WM_LINETIME internally for
         * this stuff, compute everything based on that.
         */
-       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state) {
                display->pkgc.disable[crtc->pipe] = crtc_state->vrr.enable;
                display->pkgc.linetime[crtc->pipe] = DIV_ROUND_UP(crtc_state->linetime, 8);
        }
@@ -2909,9 +2907,9 @@ skl_compute_wm(struct intel_atomic_state *state)
        struct intel_display *display = to_intel_display(state);
        struct intel_crtc *crtc;
        struct intel_crtc_state __maybe_unused *new_crtc_state;
-       int ret, i;
+       int ret;
 
-       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) {
                ret = skl_build_pipe_wm(state, crtc);
                if (ret)
                        return ret;
@@ -2926,7 +2924,7 @@ skl_compute_wm(struct intel_atomic_state *state)
         * based on how much ddb is available. Now we can actually
         * check if the final watermarks changed.
         */
-       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) {
                struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal;
 
                /*