diff mbox

[3/5] drm/i915: Clarify sprite plane function names (v4)

Message ID 1419360113-10972-4-git-send-email-matthew.d.roper@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matt Roper Dec. 23, 2014, 6:41 p.m. UTC
A few of the sprite-related function names in i915 are very similar
(e.g., intel_enable_planes() vs intel_crtc_enable_planes()) and don't
make it clear whether they only operate on sprite planes, or whether
they also apply to all universal plane types.  Rename a few functions to
be more consistent with our function naming for primary/cursor planes or
to clarify that they apply specifically to sprite planes:

 - s/intel_disable_planes/intel_disable_sprite_planes/
 - s/intel_enable_planes/intel_enable_sprite_planes/

Also, drop the sprite-specific intel_destroy_plane() and just use
the type-agnostic intel_plane_destroy() function.  The extra 'disable'
call that intel_destroy_plane() did is unnecessary since the plane will
already be disabled due to framebuffer destruction by the point it gets
called.

v2: Earlier consolidation patches have reduced the number of functions
    we need to rename here.

v3: Also rename intel_plane_funcs vtable to intel_sprite_plane_funcs
    for consistency with primary/cursor.  (Ander)

v4: Convert comment for intel_plane_destroy() to kerneldoc now that it
    is no longer a static function.  (Ander)

Reviewed-by(v1): Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_sprite.c  | 14 +++-----------
 3 files changed, 16 insertions(+), 17 deletions(-)

Comments

Ander Conselvan de Oliveira Jan. 9, 2015, 12:24 p.m. UTC | #1
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 12/23/2014 08:41 PM, Matt Roper wrote:
> A few of the sprite-related function names in i915 are very similar
> (e.g., intel_enable_planes() vs intel_crtc_enable_planes()) and don't
> make it clear whether they only operate on sprite planes, or whether
> they also apply to all universal plane types.  Rename a few functions to
> be more consistent with our function naming for primary/cursor planes or
> to clarify that they apply specifically to sprite planes:
>
>   - s/intel_disable_planes/intel_disable_sprite_planes/
>   - s/intel_enable_planes/intel_enable_sprite_planes/
>
> Also, drop the sprite-specific intel_destroy_plane() and just use
> the type-agnostic intel_plane_destroy() function.  The extra 'disable'
> call that intel_destroy_plane() did is unnecessary since the plane will
> already be disabled due to framebuffer destruction by the point it gets
> called.
>
> v2: Earlier consolidation patches have reduced the number of functions
>      we need to rename here.
>
> v3: Also rename intel_plane_funcs vtable to intel_sprite_plane_funcs
>      for consistency with primary/cursor.  (Ander)
>
> v4: Convert comment for intel_plane_destroy() to kerneldoc now that it
>      is no longer a static function.  (Ander)
>
> Reviewed-by(v1): Bob Paauwe <bob.j.paauwe@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
>   drivers/gpu/drm/i915/intel_drv.h     |  1 +
>   drivers/gpu/drm/i915/intel_sprite.c  | 14 +++-----------
>   3 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8d6e710..4bb1a37 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4037,7 +4037,7 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc)
>   	}
>   }
>
> -static void intel_enable_planes(struct drm_crtc *crtc)
> +static void intel_enable_sprite_planes(struct drm_crtc *crtc)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	enum pipe pipe = to_intel_crtc(crtc)->pipe;
> @@ -4051,7 +4051,7 @@ static void intel_enable_planes(struct drm_crtc *crtc)
>   	}
>   }
>
> -static void intel_disable_planes(struct drm_crtc *crtc)
> +static void intel_disable_sprite_planes(struct drm_crtc *crtc)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	enum pipe pipe = to_intel_crtc(crtc)->pipe;
> @@ -4195,7 +4195,7 @@ static void intel_crtc_enable_planes(struct drm_crtc *crtc)
>   	int pipe = intel_crtc->pipe;
>
>   	intel_enable_primary_hw_plane(crtc->primary, crtc);
> -	intel_enable_planes(crtc);
> +	intel_enable_sprite_planes(crtc);
>   	intel_crtc_update_cursor(crtc, true);
>   	intel_crtc_dpms_overlay(intel_crtc, true);
>
> @@ -4230,7 +4230,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
>
>   	intel_crtc_dpms_overlay(intel_crtc, false);
>   	intel_crtc_update_cursor(crtc, false);
> -	intel_disable_planes(crtc);
> +	intel_disable_sprite_planes(crtc);
>   	intel_disable_primary_hw_plane(crtc->primary, crtc);
>
>   	/*
> @@ -12012,8 +12012,14 @@ intel_disable_plane(struct drm_plane *plane)
>   					  0, 0, 0, 0, 0, 0, 0, 0);
>   }
>
> -/* Common destruction function for both primary and cursor planes */
> -static void intel_plane_destroy(struct drm_plane *plane)
> +/**
> + * intel_plane_destroy - destroy a plane
> + * @plane: plane to destroy
> + *
> + * Common destruction function for all types of planes (primary, cursor,
> + * sprite).
> + */
> +void intel_plane_destroy(struct drm_plane *plane)
>   {
>   	struct intel_plane *intel_plane = to_intel_plane(plane);
>   	drm_plane_cleanup(plane);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 1934156..2523315 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1053,6 +1053,7 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
>   		       uint32_t src_x, uint32_t src_y,
>   		       uint32_t src_w, uint32_t src_h);
>   int intel_disable_plane(struct drm_plane *plane);
> +void intel_plane_destroy(struct drm_plane *plane);
>
>   /* intel_dp_mst.c */
>   int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 18be827..537fff25 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1306,14 +1306,6 @@ intel_commit_sprite_plane(struct drm_plane *plane,
>   	}
>   }
>
> -static void intel_destroy_plane(struct drm_plane *plane)
> -{
> -	struct intel_plane *intel_plane = to_intel_plane(plane);
> -	intel_disable_plane(plane);
> -	drm_plane_cleanup(plane);
> -	kfree(intel_plane);
> -}
> -
>   int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
>   			      struct drm_file *file_priv)
>   {
> @@ -1413,10 +1405,10 @@ int intel_plane_restore(struct drm_plane *plane)
>   				  intel_plane->src_w, intel_plane->src_h);
>   }
>
> -static const struct drm_plane_funcs intel_plane_funcs = {
> +static const struct drm_plane_funcs intel_sprite_plane_funcs = {
>   	.update_plane = intel_update_plane,
>   	.disable_plane = intel_disable_plane,
> -	.destroy = intel_destroy_plane,
> +	.destroy = intel_plane_destroy,
>   	.set_property = intel_plane_set_property,
>   };
>
> @@ -1553,7 +1545,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>   	intel_plane->commit_plane = intel_commit_sprite_plane;
>   	possible_crtcs = (1 << pipe);
>   	ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
> -				       &intel_plane_funcs,
> +				       &intel_sprite_plane_funcs,
>   				       plane_formats, num_plane_formats,
>   				       DRM_PLANE_TYPE_OVERLAY);
>   	if (ret) {
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8d6e710..4bb1a37 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4037,7 +4037,7 @@  static void ironlake_pfit_enable(struct intel_crtc *crtc)
 	}
 }
 
-static void intel_enable_planes(struct drm_crtc *crtc)
+static void intel_enable_sprite_planes(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	enum pipe pipe = to_intel_crtc(crtc)->pipe;
@@ -4051,7 +4051,7 @@  static void intel_enable_planes(struct drm_crtc *crtc)
 	}
 }
 
-static void intel_disable_planes(struct drm_crtc *crtc)
+static void intel_disable_sprite_planes(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	enum pipe pipe = to_intel_crtc(crtc)->pipe;
@@ -4195,7 +4195,7 @@  static void intel_crtc_enable_planes(struct drm_crtc *crtc)
 	int pipe = intel_crtc->pipe;
 
 	intel_enable_primary_hw_plane(crtc->primary, crtc);
-	intel_enable_planes(crtc);
+	intel_enable_sprite_planes(crtc);
 	intel_crtc_update_cursor(crtc, true);
 	intel_crtc_dpms_overlay(intel_crtc, true);
 
@@ -4230,7 +4230,7 @@  static void intel_crtc_disable_planes(struct drm_crtc *crtc)
 
 	intel_crtc_dpms_overlay(intel_crtc, false);
 	intel_crtc_update_cursor(crtc, false);
-	intel_disable_planes(crtc);
+	intel_disable_sprite_planes(crtc);
 	intel_disable_primary_hw_plane(crtc->primary, crtc);
 
 	/*
@@ -12012,8 +12012,14 @@  intel_disable_plane(struct drm_plane *plane)
 					  0, 0, 0, 0, 0, 0, 0, 0);
 }
 
-/* Common destruction function for both primary and cursor planes */
-static void intel_plane_destroy(struct drm_plane *plane)
+/**
+ * intel_plane_destroy - destroy a plane
+ * @plane: plane to destroy
+ *
+ * Common destruction function for all types of planes (primary, cursor,
+ * sprite).
+ */
+void intel_plane_destroy(struct drm_plane *plane)
 {
 	struct intel_plane *intel_plane = to_intel_plane(plane);
 	drm_plane_cleanup(plane);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 1934156..2523315 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1053,6 +1053,7 @@  int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		       uint32_t src_x, uint32_t src_y,
 		       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
+void intel_plane_destroy(struct drm_plane *plane);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 18be827..537fff25 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1306,14 +1306,6 @@  intel_commit_sprite_plane(struct drm_plane *plane,
 	}
 }
 
-static void intel_destroy_plane(struct drm_plane *plane)
-{
-	struct intel_plane *intel_plane = to_intel_plane(plane);
-	intel_disable_plane(plane);
-	drm_plane_cleanup(plane);
-	kfree(intel_plane);
-}
-
 int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
 			      struct drm_file *file_priv)
 {
@@ -1413,10 +1405,10 @@  int intel_plane_restore(struct drm_plane *plane)
 				  intel_plane->src_w, intel_plane->src_h);
 }
 
-static const struct drm_plane_funcs intel_plane_funcs = {
+static const struct drm_plane_funcs intel_sprite_plane_funcs = {
 	.update_plane = intel_update_plane,
 	.disable_plane = intel_disable_plane,
-	.destroy = intel_destroy_plane,
+	.destroy = intel_plane_destroy,
 	.set_property = intel_plane_set_property,
 };
 
@@ -1553,7 +1545,7 @@  intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	intel_plane->commit_plane = intel_commit_sprite_plane;
 	possible_crtcs = (1 << pipe);
 	ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
-				       &intel_plane_funcs,
+				       &intel_sprite_plane_funcs,
 				       plane_formats, num_plane_formats,
 				       DRM_PLANE_TYPE_OVERLAY);
 	if (ret) {