[01/13] drm/i915: Clean up intel_plane_atomic_check_with_state()

Submitted by Ville Syrjala on Jan. 11, 2019, 5:08 p.m.

Details

Message ID 20190111170823.4441-2-ville.syrjala@linux.intel.com
State New
Series "Enable/disable gamma/csc dynamically and fix C8"
Headers show

Commit Message

Ville Syrjala Jan. 11, 2019, 5:08 p.m.
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename some of the state variables in
intel_plane_atomic_check_with_state() to make it less confusing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_atomic_plane.c | 36 +++++++++++------------
 1 file changed, 17 insertions(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 683a75dad4fb..50be2c5dd76e 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -110,41 +110,39 @@  intel_plane_destroy_state(struct drm_plane *plane,
 }
 
 int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
-					struct intel_crtc_state *crtc_state,
+					struct intel_crtc_state *new_crtc_state,
 					const struct intel_plane_state *old_plane_state,
-					struct intel_plane_state *intel_state)
+					struct intel_plane_state *new_plane_state)
 {
-	struct drm_plane *plane = intel_state->base.plane;
-	struct drm_plane_state *state = &intel_state->base;
-	struct intel_plane *intel_plane = to_intel_plane(plane);
+	struct intel_plane *plane = to_intel_plane(new_plane_state->base.plane);
 	int ret;
 
-	crtc_state->active_planes &= ~BIT(intel_plane->id);
-	crtc_state->nv12_planes &= ~BIT(intel_plane->id);
-	intel_state->base.visible = false;
+	new_crtc_state->active_planes &= ~BIT(plane->id);
+	new_crtc_state->nv12_planes &= ~BIT(plane->id);
+	new_plane_state->base.visible = false;
 
-	/* If this is a cursor plane, no further checks are needed. */
-	if (!intel_state->base.crtc && !old_plane_state->base.crtc)
+	if (!new_plane_state->base.crtc && !old_plane_state->base.crtc)
 		return 0;
 
-	ret = intel_plane->check_plane(crtc_state, intel_state);
+	ret = plane->check_plane(new_crtc_state, new_plane_state);
 	if (ret)
 		return ret;
 
 	/* FIXME pre-g4x don't work like this */
-	if (state->visible)
-		crtc_state->active_planes |= BIT(intel_plane->id);
+	if (new_plane_state->base.visible)
+		new_crtc_state->active_planes |= BIT(plane->id);
 
-	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
-		crtc_state->nv12_planes |= BIT(intel_plane->id);
+	if (new_plane_state->base.visible &&
+	    new_plane_state->base.fb->format->format == DRM_FORMAT_NV12)
+		new_crtc_state->nv12_planes |= BIT(plane->id);
 
-	if (state->visible || old_plane_state->base.visible)
-		crtc_state->update_planes |= BIT(intel_plane->id);
+	if (new_plane_state->base.visible || old_plane_state->base.visible)
+		new_crtc_state->update_planes |= BIT(plane->id);
 
 	return intel_plane_atomic_calc_changes(old_crtc_state,
-					       &crtc_state->base,
+					       &new_crtc_state->base,
 					       old_plane_state,
-					       state);
+					       &new_plane_state->base);
 }
 
 static int intel_plane_atomic_check(struct drm_plane *plane,

Comments

Matt Roper Jan. 12, 2019, 12:41 a.m.
On Fri, Jan 11, 2019 at 07:08:11PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rename some of the state variables in
> intel_plane_atomic_check_with_state() to make it less confusing.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_atomic_plane.c | 36 +++++++++++------------
>  1 file changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 683a75dad4fb..50be2c5dd76e 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -110,41 +110,39 @@ intel_plane_destroy_state(struct drm_plane *plane,
>  }
>  
>  int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
> -					struct intel_crtc_state *crtc_state,
> +					struct intel_crtc_state *new_crtc_state,
>  					const struct intel_plane_state *old_plane_state,
> -					struct intel_plane_state *intel_state)
> +					struct intel_plane_state *new_plane_state)
>  {
> -	struct drm_plane *plane = intel_state->base.plane;
> -	struct drm_plane_state *state = &intel_state->base;
> -	struct intel_plane *intel_plane = to_intel_plane(plane);
> +	struct intel_plane *plane = to_intel_plane(new_plane_state->base.plane);
>  	int ret;
>  
> -	crtc_state->active_planes &= ~BIT(intel_plane->id);
> -	crtc_state->nv12_planes &= ~BIT(intel_plane->id);
> -	intel_state->base.visible = false;
> +	new_crtc_state->active_planes &= ~BIT(plane->id);
> +	new_crtc_state->nv12_planes &= ~BIT(plane->id);
> +	new_plane_state->base.visible = false;
>  
> -	/* If this is a cursor plane, no further checks are needed. */
> -	if (!intel_state->base.crtc && !old_plane_state->base.crtc)
> +	if (!new_plane_state->base.crtc && !old_plane_state->base.crtc)
>  		return 0;
>  
> -	ret = intel_plane->check_plane(crtc_state, intel_state);
> +	ret = plane->check_plane(new_crtc_state, new_plane_state);
>  	if (ret)
>  		return ret;
>  
>  	/* FIXME pre-g4x don't work like this */
> -	if (state->visible)
> -		crtc_state->active_planes |= BIT(intel_plane->id);
> +	if (new_plane_state->base.visible)
> +		new_crtc_state->active_planes |= BIT(plane->id);
>  
> -	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
> -		crtc_state->nv12_planes |= BIT(intel_plane->id);
> +	if (new_plane_state->base.visible &&
> +	    new_plane_state->base.fb->format->format == DRM_FORMAT_NV12)
> +		new_crtc_state->nv12_planes |= BIT(plane->id);
>  
> -	if (state->visible || old_plane_state->base.visible)
> -		crtc_state->update_planes |= BIT(intel_plane->id);
> +	if (new_plane_state->base.visible || old_plane_state->base.visible)
> +		new_crtc_state->update_planes |= BIT(plane->id);
>  
>  	return intel_plane_atomic_calc_changes(old_crtc_state,
> -					       &crtc_state->base,
> +					       &new_crtc_state->base,
>  					       old_plane_state,
> -					       state);
> +					       &new_plane_state->base);
>  }
>  
>  static int intel_plane_atomic_check(struct drm_plane *plane,
> -- 
> 2.19.2
>
Shankar, Uma Jan. 16, 2019, 4:08 p.m.
>-----Original Message-----

>From: Ville Syrjala [mailto:ville.syrjala@linux.intel.com]

>Sent: Friday, January 11, 2019 10:38 PM

>To: intel-gfx@lists.freedesktop.org

>Cc: Shankar, Uma <uma.shankar@intel.com>; Roper, Matthew D

><matthew.d.roper@intel.com>

>Subject: [PATCH 01/13] drm/i915: Clean up

>intel_plane_atomic_check_with_state()

>

>From: Ville Syrjälä <ville.syrjala@linux.intel.com>

>

>Rename some of the state variables in

>intel_plane_atomic_check_with_state() to make it less confusing.


Looks ok to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>


>Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>---

> drivers/gpu/drm/i915/intel_atomic_plane.c | 36 +++++++++++------------

> 1 file changed, 17 insertions(+), 19 deletions(-)

>

>diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c

>b/drivers/gpu/drm/i915/intel_atomic_plane.c

>index 683a75dad4fb..50be2c5dd76e 100644

>--- a/drivers/gpu/drm/i915/intel_atomic_plane.c

>+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c

>@@ -110,41 +110,39 @@ intel_plane_destroy_state(struct drm_plane *plane,  }

>

> int intel_plane_atomic_check_with_state(const struct intel_crtc_state

>*old_crtc_state,

>-					struct intel_crtc_state *crtc_state,

>+					struct intel_crtc_state *new_crtc_state,

> 					const struct intel_plane_state

>*old_plane_state,

>-					struct intel_plane_state *intel_state)

>+					struct intel_plane_state

>*new_plane_state)

> {

>-	struct drm_plane *plane = intel_state->base.plane;

>-	struct drm_plane_state *state = &intel_state->base;

>-	struct intel_plane *intel_plane = to_intel_plane(plane);

>+	struct intel_plane *plane =

>+to_intel_plane(new_plane_state->base.plane);

> 	int ret;

>

>-	crtc_state->active_planes &= ~BIT(intel_plane->id);

>-	crtc_state->nv12_planes &= ~BIT(intel_plane->id);

>-	intel_state->base.visible = false;

>+	new_crtc_state->active_planes &= ~BIT(plane->id);

>+	new_crtc_state->nv12_planes &= ~BIT(plane->id);

>+	new_plane_state->base.visible = false;

>

>-	/* If this is a cursor plane, no further checks are needed. */

>-	if (!intel_state->base.crtc && !old_plane_state->base.crtc)

>+	if (!new_plane_state->base.crtc && !old_plane_state->base.crtc)

> 		return 0;

>

>-	ret = intel_plane->check_plane(crtc_state, intel_state);

>+	ret = plane->check_plane(new_crtc_state, new_plane_state);

> 	if (ret)

> 		return ret;

>

> 	/* FIXME pre-g4x don't work like this */

>-	if (state->visible)

>-		crtc_state->active_planes |= BIT(intel_plane->id);

>+	if (new_plane_state->base.visible)

>+		new_crtc_state->active_planes |= BIT(plane->id);

>

>-	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)

>-		crtc_state->nv12_planes |= BIT(intel_plane->id);

>+	if (new_plane_state->base.visible &&

>+	    new_plane_state->base.fb->format->format == DRM_FORMAT_NV12)

>+		new_crtc_state->nv12_planes |= BIT(plane->id);

>

>-	if (state->visible || old_plane_state->base.visible)

>-		crtc_state->update_planes |= BIT(intel_plane->id);

>+	if (new_plane_state->base.visible || old_plane_state->base.visible)

>+		new_crtc_state->update_planes |= BIT(plane->id);

>

> 	return intel_plane_atomic_calc_changes(old_crtc_state,

>-					       &crtc_state->base,

>+					       &new_crtc_state->base,

> 					       old_plane_state,

>-					       state);

>+					       &new_plane_state->base);

> }

>

> static int intel_plane_atomic_check(struct drm_plane *plane,

>--

>2.19.2