diff mbox series

[v2] drm/i915: Clean up skl_plane_has_planar()

Message ID 20180827225624.4912-1-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915: Clean up skl_plane_has_planar() | expand

Commit Message

Dhinakaran Pandiyan Aug. 27, 2018, 10:56 p.m. UTC
skl_plane_has_planar is hard to read, simplify the logic by checking for
support in the order of platform, pipe and plane.

No change in functionality intended.
v2: Fix logic for primary plane (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

Comments

Ville Syrjälä Aug. 28, 2018, 12:45 p.m. UTC | #1
On Mon, Aug 27, 2018 at 03:56:24PM -0700, Dhinakaran Pandiyan wrote:
> skl_plane_has_planar is hard to read, simplify the logic by checking for
> support in the order of platform, pipe and plane.
> 
> No change in functionality intended.
> v2: Fix logic for primary plane (Ville)
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

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

> ---
>  drivers/gpu/drm/i915/intel_display.c | 27 +++++++++------------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 30fdfd1a3037..178552db1552 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13622,24 +13622,15 @@ static bool skl_plane_has_fbc(struct drm_i915_private *dev_priv,
>  bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
>  			  enum pipe pipe, enum plane_id plane_id)
>  {
> -	if (plane_id == PLANE_PRIMARY) {
> -		if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
> -			return false;
> -		else if ((INTEL_GEN(dev_priv) == 9 && pipe == PIPE_C) &&
> -			 !IS_GEMINILAKE(dev_priv))
> -			return false;
> -	} else if (plane_id >= PLANE_SPRITE0) {
> -		if (plane_id == PLANE_CURSOR)
> -			return false;
> -		if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) == 10) {
> -			if (plane_id != PLANE_SPRITE0)
> -				return false;
> -		} else {
> -			if (plane_id != PLANE_SPRITE0 || pipe == PIPE_C ||
> -			    IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
> -				return false;
> -		}
> -	}
> +	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
> +		return false;
> +
> +	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
> +		return false;
> +
> +	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
> +		return false;
> +
>  	return true;
>  }
>  
> -- 
> 2.17.1
Dhinakaran Pandiyan Aug. 28, 2018, 7:45 p.m. UTC | #2
On Tue, 2018-08-28 at 15:45 +0300, Ville Syrjälä wrote:
> On Mon, Aug 27, 2018 at 03:56:24PM -0700, Dhinakaran Pandiyan wrote:
> > skl_plane_has_planar is hard to read, simplify the logic by
> > checking for
> > support in the order of platform, pipe and plane.
> > 
> > No change in functionality intended.
> > v2: Fix logic for primary plane (Ville)
> > 
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
Thank you, pushed the series.

-DK

> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 27 +++++++++---------------
> > ---
> >  1 file changed, 9 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 30fdfd1a3037..178552db1552 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -13622,24 +13622,15 @@ static bool skl_plane_has_fbc(struct
> > drm_i915_private *dev_priv,
> >  bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
> >  			  enum pipe pipe, enum plane_id plane_id)
> >  {
> > -	if (plane_id == PLANE_PRIMARY) {
> > -		if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
> > -			return false;
> > -		else if ((INTEL_GEN(dev_priv) == 9 && pipe ==
> > PIPE_C) &&
> > -			 !IS_GEMINILAKE(dev_priv))
> > -			return false;
> > -	} else if (plane_id >= PLANE_SPRITE0) {
> > -		if (plane_id == PLANE_CURSOR)
> > -			return false;
> > -		if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv)
> > == 10) {
> > -			if (plane_id != PLANE_SPRITE0)
> > -				return false;
> > -		} else {
> > -			if (plane_id != PLANE_SPRITE0 || pipe ==
> > PIPE_C ||
> > -			    IS_SKYLAKE(dev_priv) ||
> > IS_BROXTON(dev_priv))
> > -				return false;
> > -		}
> > -	}
> > +	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
> > +		return false;
> > +
> > +	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)
> > && pipe == PIPE_C)
> > +		return false;
> > +
> > +	if (plane_id != PLANE_PRIMARY && plane_id !=
> > PLANE_SPRITE0)
> > +		return false;
> > +
> >  	return true;
> >  }
> >  
> > -- 
> > 2.17.1
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 30fdfd1a3037..178552db1552 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13622,24 +13622,15 @@  static bool skl_plane_has_fbc(struct drm_i915_private *dev_priv,
 bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 			  enum pipe pipe, enum plane_id plane_id)
 {
-	if (plane_id == PLANE_PRIMARY) {
-		if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
-			return false;
-		else if ((INTEL_GEN(dev_priv) == 9 && pipe == PIPE_C) &&
-			 !IS_GEMINILAKE(dev_priv))
-			return false;
-	} else if (plane_id >= PLANE_SPRITE0) {
-		if (plane_id == PLANE_CURSOR)
-			return false;
-		if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) == 10) {
-			if (plane_id != PLANE_SPRITE0)
-				return false;
-		} else {
-			if (plane_id != PLANE_SPRITE0 || pipe == PIPE_C ||
-			    IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
-				return false;
-		}
-	}
+	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
+		return false;
+
+	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+		return false;
+
+	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
+		return false;
+
 	return true;
 }