[10/17] drm/i915: swap() the entire cdclk state
diff mbox series

Message ID 20200120174728.21095-11-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • drm/i915: Global state rework
Related show

Commit Message

Ville Syrjälä Jan. 20, 2020, 5:47 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

To make life less confusing let's swap() the entire cdclk state
rather than swapping some parts, copying other parts, and leaving
the rest just as is.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

Comments

Imre Deak Jan. 24, 2020, 3:06 p.m. UTC | #1
On Mon, Jan 20, 2020 at 07:47:20PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> To make life less confusing let's swap() the entire cdclk state
> rather than swapping some parts, copying other parts, and leaving
> the rest just as is.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index f8e70a668b74..002044e80868 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1835,19 +1835,7 @@ 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->cdclk_state.min_cdclk,
> -	       state->cdclk_state.min_cdclk,
> -	       sizeof(state->cdclk_state.min_cdclk));
> -	memcpy(dev_priv->cdclk_state.min_voltage_level,
> -	       state->cdclk_state.min_voltage_level,
> -	       sizeof(state->cdclk_state.min_voltage_level));
> -
> -	dev_priv->cdclk_state.force_min_cdclk =
> -		state->cdclk_state.force_min_cdclk;
> -
> -	swap(state->cdclk_state.logical, dev_priv->cdclk_state.logical);
> -	swap(state->cdclk_state.actual, dev_priv->cdclk_state.actual);
> +	swap(state->cdclk_state, dev_priv->cdclk_state);
>  }
>  
>  void intel_dump_cdclk_config(const struct intel_cdclk_config *cdclk_config,
> @@ -1903,7 +1891,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
>  	/* called after intel_cdclk_swap_state()! */
>  	const struct intel_cdclk_state *old_cdclk_state = &state->cdclk_state;
>  	const struct intel_cdclk_state *new_cdclk_state = &dev_priv->cdclk_state;
> -	enum pipe pipe = old_cdclk_state->pipe; /* not swapped */
> +	enum pipe pipe = new_cdclk_state->pipe;
>  
>  	if (pipe == INVALID_PIPE ||
>  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk)
> @@ -1924,7 +1912,7 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
>  	/* called after intel_cdclk_swap_state()! */
>  	const struct intel_cdclk_state *old_cdclk_state = &state->cdclk_state;
>  	const struct intel_cdclk_state *new_cdclk_state = &dev_priv->cdclk_state;
> -	enum pipe pipe = old_cdclk_state->pipe; /* not swapped */
> +	enum pipe pipe = new_cdclk_state->pipe;
>  
>  	if (pipe != INVALID_PIPE &&
>  	    old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk)
> -- 
> 2.24.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index f8e70a668b74..002044e80868 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1835,19 +1835,7 @@  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->cdclk_state.min_cdclk,
-	       state->cdclk_state.min_cdclk,
-	       sizeof(state->cdclk_state.min_cdclk));
-	memcpy(dev_priv->cdclk_state.min_voltage_level,
-	       state->cdclk_state.min_voltage_level,
-	       sizeof(state->cdclk_state.min_voltage_level));
-
-	dev_priv->cdclk_state.force_min_cdclk =
-		state->cdclk_state.force_min_cdclk;
-
-	swap(state->cdclk_state.logical, dev_priv->cdclk_state.logical);
-	swap(state->cdclk_state.actual, dev_priv->cdclk_state.actual);
+	swap(state->cdclk_state, dev_priv->cdclk_state);
 }
 
 void intel_dump_cdclk_config(const struct intel_cdclk_config *cdclk_config,
@@ -1903,7 +1891,7 @@  intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
 	/* called after intel_cdclk_swap_state()! */
 	const struct intel_cdclk_state *old_cdclk_state = &state->cdclk_state;
 	const struct intel_cdclk_state *new_cdclk_state = &dev_priv->cdclk_state;
-	enum pipe pipe = old_cdclk_state->pipe; /* not swapped */
+	enum pipe pipe = new_cdclk_state->pipe;
 
 	if (pipe == INVALID_PIPE ||
 	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk)
@@ -1924,7 +1912,7 @@  intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
 	/* called after intel_cdclk_swap_state()! */
 	const struct intel_cdclk_state *old_cdclk_state = &state->cdclk_state;
 	const struct intel_cdclk_state *new_cdclk_state = &dev_priv->cdclk_state;
-	enum pipe pipe = old_cdclk_state->pipe; /* not swapped */
+	enum pipe pipe = new_cdclk_state->pipe;
 
 	if (pipe != INVALID_PIPE &&
 	    old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk)