Re: [Intel-gfx] [PATCH 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

2017-11-23 Thread Laurent Pinchart
Hi Ville,

Thank you for the patch.

On Wednesday, 1 November 2017 20:29:20 EET Ville Syrjala wrote:
> From: Ville Syrjälä 
> 
> drm_plane_helper_check_update() isn't a transitional helper, so let's
> rename it to drm_atomic_helper_check_plane_state() and move it into
> drm_atomic_helper.c.
> 
> Cc: Daniel Vetter 
> Suggested-by: Daniel Vetter 
> Signed-off-by: Ville Syrjälä 

I would move this patch before 4/5 to make it easier to revert 4/5 (for the 
reason explaining as a reply to that patch).

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c|   8 +--
>  drivers/gpu/drm/arm/malidp_planes.c |   4 +-
>  drivers/gpu/drm/drm_atomic_helper.c |  95 +
>  drivers/gpu/drm/drm_plane_helper.c  | 103 +---
>  drivers/gpu/drm/drm_simple_kms_helper.c |   9 +--
>  drivers/gpu/drm/i915/intel_display.c|  22 +++---
>  drivers/gpu/drm/imx/ipuv3-plane.c   |   8 +--
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c|   8 +--
>  drivers/gpu/drm/meson/meson_plane.c |   8 +--
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
>  drivers/gpu/drm/nouveau/nv50_display.c  |  20 +++---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
>  drivers/gpu/drm/tegra/dc.c  |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   8 +--
>  drivers/gpu/drm/zte/zx_plane.c  |  15 ++--
>  include/drm/drm_atomic_helper.h |   7 ++
>  include/drm/drm_plane_helper.h  |   6 --
>  17 files changed, 170 insertions(+), 166 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c
> b/drivers/gpu/drm/arm/hdlcd_crtc.c index 14721723fa8a..63511a3bbf6c 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane
> *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
>   clip.y2 = crtc_state->adjusted_mode.vdisplay;
> 
> - return drm_plane_helper_check_state(state, crtc_state, ,
> - DRM_PLANE_HELPER_NO_SCALING,
> - DRM_PLANE_HELPER_NO_SCALING,
> - false, true);
> + return drm_atomic_helper_check_plane_state(state, crtc_state, ,
> +DRM_PLANE_HELPER_NO_SCALING,
> +DRM_PLANE_HELPER_NO_SCALING,
> +false, true);
>  }
> 
>  static void hdlcd_plane_atomic_update(struct drm_plane *plane,
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c
> b/drivers/gpu/drm/arm/malidp_planes.c index 492d99dd55d4..72a07950167e
> 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane
> *mp,
> 
>   clip.x2 = crtc_state->adjusted_mode.hdisplay;
>   clip.y2 = crtc_state->adjusted_mode.vdisplay;
> - ret = drm_plane_helper_check_state(state, crtc_state, ,
> -0, INT_MAX, true, true);
> + ret = drm_atomic_helper_check_plane_state(state, crtc_state, ,
> +   0, INT_MAX, true, true);
>   if (ret)
>   return ret;
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index 71d712f1b56a..7595ad8ad2f3
> 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -696,6 +696,101 @@ drm_atomic_helper_check_modeset(struct drm_device
> *dev, EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
> 
>  /**
> + * drm_atomic_helper_check_plane_state() - Check plane state for validity
> + * @plane_state: plane state to check
> + * @crtc_state: crtc state to check
> + * @clip: integer clipping coordinates
> + * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
> + * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> + * @can_position: is it legal to position the plane such that it
> + *doesn't cover the entire crtc?  This will generally
> + *only be false for primary planes.
> + * @can_update_disabled: can the plane be updated while the crtc
> + *   is disabled?
> + *
> + * Checks that a desired plane update is valid, and updates various
> + * bits of derived state (clipped coordinates etc.). Drivers that provide
> + * their own plane handling rather than helper-provided implementations may
> + * still wish to call this function to avoid duplication of error checking
> + * code.
> + *
> + * RETURNS:
> + * Zero if update appears valid, error code on failure
> + */
> +int drm_atomic_helper_check_plane_state(struct 

[Intel-gfx] [PATCH 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

drm_plane_helper_check_update() isn't a transitional helper, so let's
rename it to drm_atomic_helper_check_plane_state() and move it into
drm_atomic_helper.c.

Cc: Daniel Vetter 
Suggested-by: Daniel Vetter 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c|   8 +--
 drivers/gpu/drm/arm/malidp_planes.c |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c |  95 +
 drivers/gpu/drm/drm_plane_helper.c  | 103 ++--
 drivers/gpu/drm/drm_simple_kms_helper.c |   9 +--
 drivers/gpu/drm/i915/intel_display.c|  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c   |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|   8 +--
 drivers/gpu/drm/meson/meson_plane.c |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c  |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   8 +--
 drivers/gpu/drm/zte/zx_plane.c  |  15 ++--
 include/drm/drm_atomic_helper.h |   7 ++
 include/drm/drm_plane_helper.h  |   6 --
 17 files changed, 170 insertions(+), 166 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 14721723fa8a..63511a3bbf6c 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane 
*plane,
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-   return drm_plane_helper_check_state(state, crtc_state, ,
-   DRM_PLANE_HELPER_NO_SCALING,
-   DRM_PLANE_HELPER_NO_SCALING,
-   false, true);
+   return drm_atomic_helper_check_plane_state(state, crtc_state, ,
+  DRM_PLANE_HELPER_NO_SCALING,
+  DRM_PLANE_HELPER_NO_SCALING,
+  false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 492d99dd55d4..72a07950167e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
-   ret = drm_plane_helper_check_state(state, crtc_state, ,
-  0, INT_MAX, true, true);
+   ret = drm_atomic_helper_check_plane_state(state, crtc_state, ,
+ 0, INT_MAX, true, true);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 71d712f1b56a..7595ad8ad2f3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -696,6 +696,101 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
 
 /**
+ * drm_atomic_helper_check_plane_state() - Check plane state for validity
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
+ * @clip: integer clipping coordinates
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *   is disabled?
+ *
+ * Checks that a desired plane update is valid, and updates various
+ * bits of derived state (clipped coordinates etc.). Drivers that provide
+ * their own plane handling rather than helper-provided implementations may
+ * still wish to call this function to avoid duplication of error checking
+ * code.
+ *
+ * RETURNS:
+ * Zero if update appears valid, error code on failure
+ */
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+   const struct drm_crtc_state *crtc_state,
+   const struct drm_rect *clip,
+   int min_scale,
+   int max_scale,
+   bool can_position,
+   bool can_update_disabled)
+{
+   struct