[9/9] drm/i915: Eliminate redundancy in intel_primary_plane_create()
diff mbox series

Message ID 20191008161441.12721-9-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/9] drm/i915: Expose 10:10:10 XRGB formats on SNB-BDW sprites
Related show

Commit Message

Ville Syrjälä Oct. 8, 2019, 4:14 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Lots of redundant assignments inside intel_primary_plane_create().
Get rid of them.

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

Comments

Juha-Pekka Heikkila Oct. 27, 2019, 8:53 p.m. UTC | #1
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

On 8.10.2019 19.14, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Lots of redundant assignments inside intel_primary_plane_create().
> Get rid of them.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_display.c | 43 +++++++-------------
>   1 file changed, 14 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index c553a3417891..2acec838fb8e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14873,7 +14873,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
>   	const struct drm_plane_funcs *plane_funcs;
>   	unsigned int supported_rotations;
>   	unsigned int possible_crtcs;
> -	const u64 *modifiers;
>   	const u32 *formats;
>   	int num_formats;
>   	int ret, zpos;
> @@ -14908,53 +14907,39 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
>   	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
>   		formats = vlv_primary_formats;
>   		num_formats = ARRAY_SIZE(vlv_primary_formats);
> -		modifiers = i9xx_format_modifiers;
> -
> -		plane->max_stride = i9xx_plane_max_stride;
> -		plane->update_plane = i9xx_update_plane;
> -		plane->disable_plane = i9xx_disable_plane;
> -		plane->get_hw_state = i9xx_plane_get_hw_state;
> -		plane->check_plane = i9xx_plane_check;
> -
> -		plane_funcs = &i965_plane_funcs;
>   	} else if (INTEL_GEN(dev_priv) >= 4) {
>   		formats = i965_primary_formats;
>   		num_formats = ARRAY_SIZE(i965_primary_formats);
> -		modifiers = i9xx_format_modifiers;
> -
> -		plane->max_stride = i9xx_plane_max_stride;
> -		plane->update_plane = i9xx_update_plane;
> -		plane->disable_plane = i9xx_disable_plane;
> -		plane->get_hw_state = i9xx_plane_get_hw_state;
> -		plane->check_plane = i9xx_plane_check;
> -
> -		plane_funcs = &i965_plane_funcs;
>   	} else {
>   		formats = i8xx_primary_formats;
>   		num_formats = ARRAY_SIZE(i8xx_primary_formats);
> -		modifiers = i9xx_format_modifiers;
> -
> -		plane->max_stride = i9xx_plane_max_stride;
> -		plane->update_plane = i9xx_update_plane;
> -		plane->disable_plane = i9xx_disable_plane;
> -		plane->get_hw_state = i9xx_plane_get_hw_state;
> -		plane->check_plane = i9xx_plane_check;
> +	}
>   
> +	if (INTEL_GEN(dev_priv) >= 4)
> +		plane_funcs = &i965_plane_funcs;
> +	else
>   		plane_funcs = &i8xx_plane_funcs;
> -	}
> +
> +	plane->max_stride = i9xx_plane_max_stride;
> +	plane->update_plane = i9xx_update_plane;
> +	plane->disable_plane = i9xx_disable_plane;
> +	plane->get_hw_state = i9xx_plane_get_hw_state;
> +	plane->check_plane = i9xx_plane_check;
>   
>   	possible_crtcs = BIT(pipe);
>   
>   	if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
>   		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
>   					       possible_crtcs, plane_funcs,
> -					       formats, num_formats, modifiers,
> +					       formats, num_formats,
> +					       i9xx_format_modifiers,
>   					       DRM_PLANE_TYPE_PRIMARY,
>   					       "primary %c", pipe_name(pipe));
>   	else
>   		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
>   					       possible_crtcs, plane_funcs,
> -					       formats, num_formats, modifiers,
> +					       formats, num_formats,
> +					       i9xx_format_modifiers,
>   					       DRM_PLANE_TYPE_PRIMARY,
>   					       "plane %c",
>   					       plane_name(plane->i9xx_plane));
>
Shankar, Uma Oct. 29, 2019, 1:24 p.m. UTC | #2
>-----Original Message-----
>From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville Syrjala
>Sent: Tuesday, October 8, 2019 9:45 PM
>To: intel-gfx@lists.freedesktop.org
>Subject: [Intel-gfx] [PATCH 9/9] drm/i915: Eliminate redundancy in
>intel_primary_plane_create()
>
>From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
>Lots of redundant assignments inside intel_primary_plane_create().
>Get rid of them.

Looks good 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/display/intel_display.c | 43 +++++++-------------
> 1 file changed, 14 insertions(+), 29 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_display.c
>b/drivers/gpu/drm/i915/display/intel_display.c
>index c553a3417891..2acec838fb8e 100644
>--- a/drivers/gpu/drm/i915/display/intel_display.c
>+++ b/drivers/gpu/drm/i915/display/intel_display.c
>@@ -14873,7 +14873,6 @@ intel_primary_plane_create(struct drm_i915_private
>*dev_priv, enum pipe pipe)
> 	const struct drm_plane_funcs *plane_funcs;
> 	unsigned int supported_rotations;
> 	unsigned int possible_crtcs;
>-	const u64 *modifiers;
> 	const u32 *formats;
> 	int num_formats;
> 	int ret, zpos;
>@@ -14908,53 +14907,39 @@ intel_primary_plane_create(struct drm_i915_private
>*dev_priv, enum pipe pipe)
> 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
> 		formats = vlv_primary_formats;
> 		num_formats = ARRAY_SIZE(vlv_primary_formats);
>-		modifiers = i9xx_format_modifiers;
>-
>-		plane->max_stride = i9xx_plane_max_stride;
>-		plane->update_plane = i9xx_update_plane;
>-		plane->disable_plane = i9xx_disable_plane;
>-		plane->get_hw_state = i9xx_plane_get_hw_state;
>-		plane->check_plane = i9xx_plane_check;
>-
>-		plane_funcs = &i965_plane_funcs;
> 	} else if (INTEL_GEN(dev_priv) >= 4) {
> 		formats = i965_primary_formats;
> 		num_formats = ARRAY_SIZE(i965_primary_formats);
>-		modifiers = i9xx_format_modifiers;
>-
>-		plane->max_stride = i9xx_plane_max_stride;
>-		plane->update_plane = i9xx_update_plane;
>-		plane->disable_plane = i9xx_disable_plane;
>-		plane->get_hw_state = i9xx_plane_get_hw_state;
>-		plane->check_plane = i9xx_plane_check;
>-
>-		plane_funcs = &i965_plane_funcs;
> 	} else {
> 		formats = i8xx_primary_formats;
> 		num_formats = ARRAY_SIZE(i8xx_primary_formats);
>-		modifiers = i9xx_format_modifiers;
>-
>-		plane->max_stride = i9xx_plane_max_stride;
>-		plane->update_plane = i9xx_update_plane;
>-		plane->disable_plane = i9xx_disable_plane;
>-		plane->get_hw_state = i9xx_plane_get_hw_state;
>-		plane->check_plane = i9xx_plane_check;
>+	}
>
>+	if (INTEL_GEN(dev_priv) >= 4)
>+		plane_funcs = &i965_plane_funcs;
>+	else
> 		plane_funcs = &i8xx_plane_funcs;
>-	}
>+
>+	plane->max_stride = i9xx_plane_max_stride;
>+	plane->update_plane = i9xx_update_plane;
>+	plane->disable_plane = i9xx_disable_plane;
>+	plane->get_hw_state = i9xx_plane_get_hw_state;
>+	plane->check_plane = i9xx_plane_check;
>
> 	possible_crtcs = BIT(pipe);
>
> 	if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
> 		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> 					       possible_crtcs, plane_funcs,
>-					       formats, num_formats, modifiers,
>+					       formats, num_formats,
>+					       i9xx_format_modifiers,
> 					       DRM_PLANE_TYPE_PRIMARY,
> 					       "primary %c", pipe_name(pipe));
> 	else
> 		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> 					       possible_crtcs, plane_funcs,
>-					       formats, num_formats, modifiers,
>+					       formats, num_formats,
>+					       i9xx_format_modifiers,
> 					       DRM_PLANE_TYPE_PRIMARY,
> 					       "plane %c",
> 					       plane_name(plane->i9xx_plane));
>--
>2.21.0
>
>_______________________________________________
>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_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index c553a3417891..2acec838fb8e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14873,7 +14873,6 @@  intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	const struct drm_plane_funcs *plane_funcs;
 	unsigned int supported_rotations;
 	unsigned int possible_crtcs;
-	const u64 *modifiers;
 	const u32 *formats;
 	int num_formats;
 	int ret, zpos;
@@ -14908,53 +14907,39 @@  intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
 		formats = vlv_primary_formats;
 		num_formats = ARRAY_SIZE(vlv_primary_formats);
-		modifiers = i9xx_format_modifiers;
-
-		plane->max_stride = i9xx_plane_max_stride;
-		plane->update_plane = i9xx_update_plane;
-		plane->disable_plane = i9xx_disable_plane;
-		plane->get_hw_state = i9xx_plane_get_hw_state;
-		plane->check_plane = i9xx_plane_check;
-
-		plane_funcs = &i965_plane_funcs;
 	} else if (INTEL_GEN(dev_priv) >= 4) {
 		formats = i965_primary_formats;
 		num_formats = ARRAY_SIZE(i965_primary_formats);
-		modifiers = i9xx_format_modifiers;
-
-		plane->max_stride = i9xx_plane_max_stride;
-		plane->update_plane = i9xx_update_plane;
-		plane->disable_plane = i9xx_disable_plane;
-		plane->get_hw_state = i9xx_plane_get_hw_state;
-		plane->check_plane = i9xx_plane_check;
-
-		plane_funcs = &i965_plane_funcs;
 	} else {
 		formats = i8xx_primary_formats;
 		num_formats = ARRAY_SIZE(i8xx_primary_formats);
-		modifiers = i9xx_format_modifiers;
-
-		plane->max_stride = i9xx_plane_max_stride;
-		plane->update_plane = i9xx_update_plane;
-		plane->disable_plane = i9xx_disable_plane;
-		plane->get_hw_state = i9xx_plane_get_hw_state;
-		plane->check_plane = i9xx_plane_check;
+	}
 
+	if (INTEL_GEN(dev_priv) >= 4)
+		plane_funcs = &i965_plane_funcs;
+	else
 		plane_funcs = &i8xx_plane_funcs;
-	}
+
+	plane->max_stride = i9xx_plane_max_stride;
+	plane->update_plane = i9xx_update_plane;
+	plane->disable_plane = i9xx_disable_plane;
+	plane->get_hw_state = i9xx_plane_get_hw_state;
+	plane->check_plane = i9xx_plane_check;
 
 	possible_crtcs = BIT(pipe);
 
 	if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
 		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
 					       possible_crtcs, plane_funcs,
-					       formats, num_formats, modifiers,
+					       formats, num_formats,
+					       i9xx_format_modifiers,
 					       DRM_PLANE_TYPE_PRIMARY,
 					       "primary %c", pipe_name(pipe));
 	else
 		ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
 					       possible_crtcs, plane_funcs,
-					       formats, num_formats, modifiers,
+					       formats, num_formats,
+					       i9xx_format_modifiers,
 					       DRM_PLANE_TYPE_PRIMARY,
 					       "plane %c",
 					       plane_name(plane->i9xx_plane));