]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Move more cdclk state handling into the cdclk code
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Jan 2020 17:47:14 +0000 (19:47 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 31 Jan 2020 15:00:43 +0000 (17:00 +0200)
Move the initial setup of state->{cdclk,min_cdclk[],min_voltage_level[]}
into intel_modeset_calc_cdclk(), and we'll move the counterparts into
intel_cdclk_swap_state(). This encapsulates the cdclk state much better.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200120174728.21095-5-ville.syrjala@linux.intel.com
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
drivers/gpu/drm/i915/display/intel_cdclk.c
drivers/gpu/drm/i915/display/intel_display.c

index e17b5a444887fb364180f4f56c044674ffcbcf25..389b35949901e7f99112e67617cdd632fe9d328e 100644 (file)
@@ -1835,6 +1835,14 @@ void intel_cdclk_swap_state(struct intel_atomic_state *state)
 {
        struct drm_i915_private *dev_priv = to_i915(state->base.dev);
 
+       /* FIXME maybe swap() these too */
+       memcpy(dev_priv->min_cdclk, state->min_cdclk,
+              sizeof(state->min_cdclk));
+       memcpy(dev_priv->min_voltage_level, state->min_voltage_level,
+              sizeof(state->min_voltage_level));
+
+       dev_priv->cdclk.force_min_cdclk = state->cdclk.force_min_cdclk;
+
        swap(state->cdclk.logical, dev_priv->cdclk.logical);
        swap(state->cdclk.actual, dev_priv->cdclk.actual);
 }
@@ -2050,9 +2058,6 @@ static int intel_compute_min_cdclk(struct intel_atomic_state *state)
        int min_cdclk, i;
        enum pipe pipe;
 
-       memcpy(state->min_cdclk, dev_priv->min_cdclk,
-              sizeof(state->min_cdclk));
-
        for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
                int ret;
 
@@ -2099,9 +2104,6 @@ static int bxt_compute_min_voltage_level(struct intel_atomic_state *state)
        int i;
        enum pipe pipe;
 
-       memcpy(state->min_voltage_level, dev_priv->min_voltage_level,
-              sizeof(state->min_voltage_level));
-
        for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
                int ret;
 
@@ -2356,6 +2358,18 @@ int intel_modeset_calc_cdclk(struct intel_atomic_state *state)
        enum pipe pipe;
        int ret;
 
+       memcpy(state->min_cdclk, dev_priv->min_cdclk,
+              sizeof(state->min_cdclk));
+       memcpy(state->min_voltage_level, dev_priv->min_voltage_level,
+              sizeof(state->min_voltage_level));
+
+       /* keep the current setting */
+       if (!state->cdclk.force_min_cdclk_changed)
+               state->cdclk.force_min_cdclk = dev_priv->cdclk.force_min_cdclk;
+
+       state->cdclk.logical = dev_priv->cdclk.logical;
+       state->cdclk.actual = dev_priv->cdclk.actual;
+
        ret = dev_priv->display.modeset_calc_cdclk(state);
        if (ret)
                return ret;
index 1800ff3bc726cec4659828c8827d81e0dcdc27ae..50080c49ba1f52da77a75b29cbaf2c0a36e577ba 100644 (file)
@@ -14541,14 +14541,8 @@ static int intel_modeset_checks(struct intel_atomic_state *state)
        struct intel_crtc *crtc;
        int ret, i;
 
-       /* keep the current setting */
-       if (!state->cdclk.force_min_cdclk_changed)
-               state->cdclk.force_min_cdclk = dev_priv->cdclk.force_min_cdclk;
-
        state->modeset = true;
        state->active_pipes = dev_priv->active_pipes;
-       state->cdclk.logical = dev_priv->cdclk.logical;
-       state->cdclk.actual = dev_priv->cdclk.actual;
 
        for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
                                            new_crtc_state, i) {
@@ -15863,12 +15857,7 @@ static int intel_atomic_commit(struct drm_device *dev,
        if (state->global_state_changed) {
                assert_global_state_locked(dev_priv);
 
-               memcpy(dev_priv->min_cdclk, state->min_cdclk,
-                      sizeof(state->min_cdclk));
-               memcpy(dev_priv->min_voltage_level, state->min_voltage_level,
-                      sizeof(state->min_voltage_level));
                dev_priv->active_pipes = state->active_pipes;
-               dev_priv->cdclk.force_min_cdclk = state->cdclk.force_min_cdclk;
 
                intel_cdclk_swap_state(state);
        }