drm/i915: Use explicit old crtc state in skl_compute_wm()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 13 Nov 2018 17:23:28 +0000 (19:23 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 7 Dec 2018 18:13:22 +0000 (20:13 +0200)
skl_compute_wm() wants to compare the old and new watermarks. Currently
it gets at the old watermarks via crtc->state, which is confusing since
it can point at either the old or the new state depending on where
in the sequence we are. In this case it is correct since we have not yet
swapped the states, but let's make it super clear what this is doing
by using the explicit old state.

Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181113172330.26069-1-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/intel_pm.c

index a26b4eddda252659d94f5c6cab89b895ddf348a9..eadcece720ce047e6f83a1570ccf184e84c7ec73 100644 (file)
@@ -5526,6 +5526,7 @@ skl_compute_wm(struct drm_atomic_state *state)
 {
        struct drm_crtc *crtc;
        struct drm_crtc_state *cstate;
+       struct drm_crtc_state *old_crtc_state;
        struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
        struct skl_ddb_values *results = &intel_state->wm_results;
        struct skl_pipe_wm *pipe_wm;
@@ -5553,11 +5554,11 @@ skl_compute_wm(struct drm_atomic_state *state)
         * should allow skl_update_pipe_wm() to return failure in cases where
         * no suitable watermark values can be found.
         */
-       for_each_new_crtc_in_state(state, crtc, cstate, i) {
+       for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, cstate, i) {
                struct intel_crtc_state *intel_cstate =
                        to_intel_crtc_state(cstate);
                const struct skl_pipe_wm *old_pipe_wm =
-                       &to_intel_crtc_state(crtc->state)->wm.skl.optimal;
+                       &to_intel_crtc_state(old_crtc_state)->wm.skl.optimal;
 
                pipe_wm = &intel_cstate->wm.skl.optimal;
                ret = skl_update_pipe_wm(cstate, old_pipe_wm, pipe_wm, &changed);