]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/i915: Save the old CDCLK atomic state
authorImre Deak <imre.deak@intel.com>
Mon, 10 Jun 2019 07:14:00 +0000 (09:14 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 2 Jul 2019 12:18:49 +0000 (14:18 +0200)
BugLink: https://launchpad.net/bugs/1826868
The old state will be needed by an upcoming patch to determine if the
commit increases or decreases CDCLK, so move the old state to the atomic
state (while keeping the new one in dev_priv). cdclk.logical and
cdclk.actual in the atomic state isn't used atm anywhere after the
atomic check phase, so this should be safe.

v2:
- Use swap() instead of opencoding it. (Ville)

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190320135439.12201-2-imre.deak@intel.com
(backported from commit 48d9f87ddd2108663fd866b254e05d422243cc56)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/gpu/drm/i915/intel_cdclk.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h

index cb23023d9da188e371b95d449c93a66f146476a6..fd41b7296990f57ee00d76dc37ec2f9e5f6f522e 100644 (file)
@@ -1732,6 +1732,26 @@ bool intel_cdclk_state_compare(const struct intel_cdclk_state *a,
        return memcmp(a, b, sizeof(*a)) == 0;
 }
 
+/**
+ * intel_cdclk_swap_state - make atomic CDCLK configuration effective
+ * @state: atomic state
+ *
+ * This is the CDCLK version of drm_atomic_helper_swap_state() since the
+ * helper does not handle driver-specific global state.
+ *
+ * Similarly to the atomic helpers this function does a complete swap,
+ * i.e. it also puts the old state into @state. This is used by the commit
+ * code to determine how CDCLK has changed (for instance did it increase or
+ * decrease).
+ */
+void intel_cdclk_swap_state(struct intel_atomic_state *state)
+{
+       struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+
+       swap(state->cdclk.logical, dev_priv->cdclk.logical);
+       swap(state->cdclk.actual, dev_priv->cdclk.actual);
+}
+
 /**
  * intel_set_cdclk - Push the CDCLK state to the hardware
  * @dev_priv: i915 device
index 0cad5cc5ec289645f1557cca572788cfa8e796cc..61e6f10beb933a0a53e83be6f2d86253c8fed420 100644 (file)
@@ -12549,10 +12549,10 @@ static int intel_atomic_commit(struct drm_device *dev,
                memcpy(dev_priv->min_cdclk, intel_state->min_cdclk,
                       sizeof(intel_state->min_cdclk));
                dev_priv->active_crtcs = intel_state->active_crtcs;
-               dev_priv->cdclk.logical = intel_state->cdclk.logical;
-               dev_priv->cdclk.actual = intel_state->cdclk.actual;
                dev_priv->cdclk.force_min_cdclk =
                        intel_state->cdclk.force_min_cdclk;
+
+               intel_cdclk_swap_state(intel_state);
        }
 
        drm_atomic_state_get(state);
index db287fbe9abc0d5ea72566e69d002365058adbcd..83d3724197bd7fcf4c82046394babd84ccb37e86 100644 (file)
@@ -1326,6 +1326,7 @@ void intel_update_cdclk(struct drm_i915_private *dev_priv);
 void intel_update_rawclk(struct drm_i915_private *dev_priv);
 bool intel_cdclk_state_compare(const struct intel_cdclk_state *a,
                               const struct intel_cdclk_state *b);
+void intel_cdclk_swap_state(struct intel_atomic_state *state);
 void intel_set_cdclk(struct drm_i915_private *dev_priv,
                     const struct intel_cdclk_state *cdclk_state);