diff mbox

[15/15] drm: Don't pass clip to drm_atomic_helper_check_plane_state()

Message ID 20171123190502.28449-16-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Nov. 23, 2017, 7:05 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move the plane clip rectangle handling into
drm_atomic_helper_check_plane_state(). Drivers no longer
have to worry about such mundane details.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |  7 +------
 drivers/gpu/drm/arm/malidp_planes.c         |  7 +------
 drivers/gpu/drm/armada/armada_overlay.c     |  6 +-----
 drivers/gpu/drm/drm_atomic_helper.c         | 12 +++++++-----
 drivers/gpu/drm/drm_plane_helper.c          | 11 +++--------
 drivers/gpu/drm/drm_simple_kms_helper.c     |  6 ------
 drivers/gpu/drm/i915/intel_display.c        | 12 ------------
 drivers/gpu/drm/imx/ipuv3-plane.c           |  7 +------
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  7 +------
 drivers/gpu/drm/meson/meson_plane.c         |  7 +------
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   | 14 ++------------
 drivers/gpu/drm/nouveau/nv50_display.c      | 12 ------------
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  7 +------
 drivers/gpu/drm/tegra/dc.c                  |  7 +------
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  7 +------
 drivers/gpu/drm/zte/zx_plane.c              | 13 +------------
 include/drm/drm_atomic_helper.h             |  1 -
 include/drm/drm_plane_helper.h              |  1 -
 18 files changed, 22 insertions(+), 122 deletions(-)

Comments

Liviu Dudau Nov. 24, 2017, 11:59 a.m. UTC | #1
On Thu, Nov 23, 2017 at 09:05:02PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Hi Ville,

> 
> Move the plane clip rectangle handling into
> drm_atomic_helper_check_plane_state(). Drivers no longer
> have to worry about such mundane details.

This is quite an important patch and I dare say the essence of your
series, right? Yet very few people got Cc-ed on it (1 AFAICT) and it
touches quite a few drivers.

May I respectfully suggest that you review your patch sending process?
You have Cc-ed me only on patches 3 and 4 and I could easy asssume that
those were all the changes you have made to the driver, which is
obviously not the case here.

I tend to err on the side of verbosity and include everyone touched by
a patch in a series into all the patches of that series. Is by no mean the
best approach, but is one way I avoid situations like this.

Best regards,
Liviu

> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c            |  7 +------
>  drivers/gpu/drm/arm/malidp_planes.c         |  7 +------
>  drivers/gpu/drm/armada/armada_overlay.c     |  6 +-----
>  drivers/gpu/drm/drm_atomic_helper.c         | 12 +++++++-----
>  drivers/gpu/drm/drm_plane_helper.c          | 11 +++--------
>  drivers/gpu/drm/drm_simple_kms_helper.c     |  6 ------
>  drivers/gpu/drm/i915/intel_display.c        | 12 ------------
>  drivers/gpu/drm/imx/ipuv3-plane.c           |  7 +------
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  7 +------
>  drivers/gpu/drm/meson/meson_plane.c         |  7 +------
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   | 14 ++------------
>  drivers/gpu/drm/nouveau/nv50_display.c      | 12 ------------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  7 +------
>  drivers/gpu/drm/tegra/dc.c                  |  7 +------
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  7 +------
>  drivers/gpu/drm/zte/zx_plane.c              | 13 +------------
>  include/drm/drm_atomic_helper.h             |  1 -
>  include/drm/drm_plane_helper.h              |  1 -
>  18 files changed, 22 insertions(+), 122 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> index fa852fc1c9e6..93c503b754ba 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -229,7 +229,6 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
>  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_crtc_state *crtc_state;
>  	u32 src_h = state->src_h >> 16;
>  
> @@ -249,11 +248,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  	}
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 2f6d608d6eaf..e630c0218aaf 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -141,18 +141,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
>  	struct drm_crtc_state *crtc_state =
>  		drm_atomic_get_existing_crtc_state(state->state, state->crtc);
>  	struct malidp_crtc_state *mc;
> -	struct drm_rect clip = { 0 };
>  	u32 src_w, src_h;
>  	int ret;
>  
>  	if (!crtc_state)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	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/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index b411b608821a..564bd63a5f6a 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -111,10 +111,6 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	uint32_t val, ctrl0;
>  	unsigned idx = 0;
>  	bool visible;
> @@ -124,7 +120,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  				 crtc_x, crtc_y, crtc_w, crtc_h,
>  				 src_x, src_y, src_w, src_h);
>  
> -	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> +	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 2f80377101a1..d25eaf6f62a9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -699,7 +699,6 @@ 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
> @@ -719,7 +718,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
>   */
>  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,
> @@ -729,6 +727,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  	struct drm_rect *src = &plane_state->src;
>  	struct drm_rect *dst = &plane_state->dst;
>  	unsigned int rotation = plane_state->rotation;
> +	struct drm_rect clip = {};
>  	int hscale, vscale;
>  
>  	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
> @@ -764,7 +763,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		return -ERANGE;
>  	}
>  
> -	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
> +	if (crtc_state->enable)
> +		drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
> +
> +	plane_state->visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
>  
>  	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
>  
> @@ -778,10 +780,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		 */
>  		return 0;
>  
> -	if (!can_position && !drm_rect_equals(dst, clip)) {
> +	if (!can_position && !drm_rect_equals(dst, &clip)) {
>  		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
>  		drm_rect_debug_print("dst: ", dst, false);
> -		drm_rect_debug_print("clip: ", clip, false);
> +		drm_rect_debug_print("clip: ", &clip, false);
>  		return -EINVAL;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f1be8cd4e387..f88f68161519 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -106,7 +106,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>   * @fb: framebuffer to flip onto plane
>   * @src: source coordinates in 16.16 fixed point
>   * @dst: integer destination coordinates
> - * @clip: integer clipping coordinates
>   * @rotation: plane rotation
>   * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
>   * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> @@ -131,7 +130,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dst,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> @@ -157,11 +155,12 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  	struct drm_crtc_state crtc_state = {
>  		.crtc = crtc,
>  		.enable = crtc->enabled,
> +		.mode = crtc->mode,
>  	};
>  	int ret;
>  
>  	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
> -						  clip, min_scale, max_scale,
> +						  min_scale, max_scale,
>  						  can_position,
>  						  can_update_disabled);
>  	if (ret)
> @@ -239,16 +238,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	struct drm_connector **connector_list;
>  	int num_connectors, ret;
>  	bool visible;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
> -					    &src, &dest, &clip,
> +					    &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 9d3f6b70812c..165bc756af96 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -89,7 +89,6 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
>  static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  					struct drm_plane_state *plane_state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_simple_display_pipe *pipe;
>  	struct drm_crtc_state *crtc_state;
>  	int ret;
> @@ -100,12 +99,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  	if (!crtc_state->enable)
>  		return 0; /* nothing to check when disabling or disabled */
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4eeec590b722..200d8989f7b5 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9267,18 +9267,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
>  			      struct intel_plane_state *plane_state)
>  {
>  	const struct drm_framebuffer *fb = plane_state->base.fb;
> -	struct drm_rect clip = {};
>  	int src_x, src_y;
>  	u32 offset;
>  	int ret;
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -12837,7 +12831,6 @@ intel_check_primary_plane(struct intel_plane *plane,
>  	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	bool can_position = false;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (INTEL_GEN(dev_priv) >= 9) {
> @@ -12849,13 +12842,8 @@ intel_check_primary_plane(struct intel_plane *plane,
>  		can_position = true;
>  	}
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  min_scale, max_scale,
>  						  can_position, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index c0662503571b..35be3759e08e 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -322,7 +322,6 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *old_fb = old_state->fb;
>  	unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba;
>  	bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
> -	struct drm_rect clip = {};
>  	int hsub, vsub;
>  	int ret;
>  
> @@ -338,11 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  can_position, true);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index b5c6eec9a584..2f4b0ffee598 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -91,7 +91,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_framebuffer *fb = state->fb;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!fb)
>  		return 0;
> @@ -108,11 +107,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 3801bee1f9e6..c78a3a59f58c 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -49,7 +49,6 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!state->crtc)
>  		return 0;
> @@ -58,11 +57,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 09f758e7bb1b..087d6973e804 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -286,7 +286,6 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	uint32_t max_width, max_height;
>  	bool out_of_bounds = false;
>  	uint32_t caps = 0;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -323,11 +322,7 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> @@ -471,7 +466,6 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  {
>  	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -502,11 +496,7 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 7d8307ec442c..9aad769bcdf0 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1135,15 +1135,9 @@ static int
>  nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
> -	struct drm_rect clip = {};
>  	int ret;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -1427,18 +1421,12 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
>  	const struct drm_framebuffer *fb = asyw->state.fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (!fb->format->depth)
>  		return -EINVAL;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index cd2c72389629..b95e9d45a435 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -641,7 +641,6 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	struct vop_win *vop_win = to_vop_win(plane);
>  	const struct vop_win_data *win = vop_win->data;
>  	int ret;
> -	struct drm_rect clip = {};
>  	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
>  					DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
> @@ -654,11 +653,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 93b47e0e038b..45c9cecd7111 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -477,7 +477,6 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state;
>  	struct tegra_dc_state *tegra;
> -	struct drm_rect clip = {};
>  	int err;
>  
>  	/* Propagate errors from allocation or locking failures. */
> @@ -485,12 +484,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	/* Check plane state for visibility and calculate clipping bounds */
> -	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	err = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  0, INT_MAX, true, true);
>  	if (err < 0)
>  		return err;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 25d96560180b..e3e2e9b1ead8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -443,17 +443,12 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state = NULL;
>  	struct drm_framebuffer *new_fb = state->fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (state->crtc)
>  		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
>  
> -	if (crtc_state && crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
> index 8e1f34274e24..94545adac50d 100644
> --- a/drivers/gpu/drm/zte/zx_plane.c
> +++ b/drivers/gpu/drm/zte/zx_plane.c
> @@ -55,7 +55,6 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale = FRAC_16_16(1, 8);
>  	int max_scale = FRAC_16_16(8, 1);
>  
> @@ -75,12 +74,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip, min_scale, max_scale,
> +						   min_scale, max_scale,
>  						   true, true);
>  }
>  
> @@ -291,7 +286,6 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  
>  	if (!crtc || !fb)
>  		return 0;
> @@ -309,12 +303,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index 4842ee9485ce..26aaba58d6ce 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -40,7 +40,6 @@ int drm_atomic_helper_check_modeset(struct drm_device *dev,
>  				struct drm_atomic_state *state);
>  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,
> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
> index 8aa49c0ecd4d..28d7ce620729 100644
> --- a/include/drm/drm_plane_helper.h
> +++ b/include/drm/drm_plane_helper.h
> @@ -43,7 +43,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dest,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> -- 
> 2.13.6
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Liviu Dudau Nov. 24, 2017, 12:01 p.m. UTC | #2
On Thu, Nov 23, 2017 at 09:05:02PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Move the plane clip rectangle handling into
> drm_atomic_helper_check_plane_state(). Drivers no longer
> have to worry about such mundane details.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c            |  7 +------
>  drivers/gpu/drm/arm/malidp_planes.c         |  7 +------
>  drivers/gpu/drm/armada/armada_overlay.c     |  6 +-----
>  drivers/gpu/drm/drm_atomic_helper.c         | 12 +++++++-----
>  drivers/gpu/drm/drm_plane_helper.c          | 11 +++--------
>  drivers/gpu/drm/drm_simple_kms_helper.c     |  6 ------
>  drivers/gpu/drm/i915/intel_display.c        | 12 ------------
>  drivers/gpu/drm/imx/ipuv3-plane.c           |  7 +------
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  7 +------
>  drivers/gpu/drm/meson/meson_plane.c         |  7 +------
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   | 14 ++------------
>  drivers/gpu/drm/nouveau/nv50_display.c      | 12 ------------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  7 +------
>  drivers/gpu/drm/tegra/dc.c                  |  7 +------
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  7 +------
>  drivers/gpu/drm/zte/zx_plane.c              | 13 +------------
>  include/drm/drm_atomic_helper.h             |  1 -
>  include/drm/drm_plane_helper.h              |  1 -
>  18 files changed, 22 insertions(+), 122 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> index fa852fc1c9e6..93c503b754ba 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -229,7 +229,6 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
>  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_crtc_state *crtc_state;
>  	u32 src_h = state->src_h >> 16;
>  
> @@ -249,11 +248,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  	}
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 2f6d608d6eaf..e630c0218aaf 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -141,18 +141,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
>  	struct drm_crtc_state *crtc_state =
>  		drm_atomic_get_existing_crtc_state(state->state, state->crtc);
>  	struct malidp_crtc_state *mc;
> -	struct drm_rect clip = { 0 };
>  	u32 src_w, src_h;
>  	int ret;
>  
>  	if (!crtc_state)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  0, INT_MAX, true, true);
>  	if (ret)
>  		return ret;

For the hdlcd and malidp changes above:

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index b411b608821a..564bd63a5f6a 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -111,10 +111,6 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	uint32_t val, ctrl0;
>  	unsigned idx = 0;
>  	bool visible;
> @@ -124,7 +120,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  				 crtc_x, crtc_y, crtc_w, crtc_h,
>  				 src_x, src_y, src_w, src_h);
>  
> -	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> +	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 2f80377101a1..d25eaf6f62a9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -699,7 +699,6 @@ 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
> @@ -719,7 +718,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
>   */
>  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,
> @@ -729,6 +727,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  	struct drm_rect *src = &plane_state->src;
>  	struct drm_rect *dst = &plane_state->dst;
>  	unsigned int rotation = plane_state->rotation;
> +	struct drm_rect clip = {};
>  	int hscale, vscale;
>  
>  	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
> @@ -764,7 +763,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		return -ERANGE;
>  	}
>  
> -	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
> +	if (crtc_state->enable)
> +		drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
> +
> +	plane_state->visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
>  
>  	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
>  
> @@ -778,10 +780,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		 */
>  		return 0;
>  
> -	if (!can_position && !drm_rect_equals(dst, clip)) {
> +	if (!can_position && !drm_rect_equals(dst, &clip)) {
>  		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
>  		drm_rect_debug_print("dst: ", dst, false);
> -		drm_rect_debug_print("clip: ", clip, false);
> +		drm_rect_debug_print("clip: ", &clip, false);
>  		return -EINVAL;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f1be8cd4e387..f88f68161519 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -106,7 +106,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>   * @fb: framebuffer to flip onto plane
>   * @src: source coordinates in 16.16 fixed point
>   * @dst: integer destination coordinates
> - * @clip: integer clipping coordinates
>   * @rotation: plane rotation
>   * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
>   * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> @@ -131,7 +130,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dst,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> @@ -157,11 +155,12 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  	struct drm_crtc_state crtc_state = {
>  		.crtc = crtc,
>  		.enable = crtc->enabled,
> +		.mode = crtc->mode,
>  	};
>  	int ret;
>  
>  	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
> -						  clip, min_scale, max_scale,
> +						  min_scale, max_scale,
>  						  can_position,
>  						  can_update_disabled);
>  	if (ret)
> @@ -239,16 +238,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	struct drm_connector **connector_list;
>  	int num_connectors, ret;
>  	bool visible;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
> -					    &src, &dest, &clip,
> +					    &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 9d3f6b70812c..165bc756af96 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -89,7 +89,6 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
>  static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  					struct drm_plane_state *plane_state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_simple_display_pipe *pipe;
>  	struct drm_crtc_state *crtc_state;
>  	int ret;
> @@ -100,12 +99,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  	if (!crtc_state->enable)
>  		return 0; /* nothing to check when disabling or disabled */
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4eeec590b722..200d8989f7b5 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9267,18 +9267,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
>  			      struct intel_plane_state *plane_state)
>  {
>  	const struct drm_framebuffer *fb = plane_state->base.fb;
> -	struct drm_rect clip = {};
>  	int src_x, src_y;
>  	u32 offset;
>  	int ret;
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -12837,7 +12831,6 @@ intel_check_primary_plane(struct intel_plane *plane,
>  	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	bool can_position = false;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (INTEL_GEN(dev_priv) >= 9) {
> @@ -12849,13 +12842,8 @@ intel_check_primary_plane(struct intel_plane *plane,
>  		can_position = true;
>  	}
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  min_scale, max_scale,
>  						  can_position, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index c0662503571b..35be3759e08e 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -322,7 +322,6 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *old_fb = old_state->fb;
>  	unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba;
>  	bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
> -	struct drm_rect clip = {};
>  	int hsub, vsub;
>  	int ret;
>  
> @@ -338,11 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  can_position, true);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index b5c6eec9a584..2f4b0ffee598 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -91,7 +91,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_framebuffer *fb = state->fb;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!fb)
>  		return 0;
> @@ -108,11 +107,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 3801bee1f9e6..c78a3a59f58c 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -49,7 +49,6 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!state->crtc)
>  		return 0;
> @@ -58,11 +57,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 09f758e7bb1b..087d6973e804 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -286,7 +286,6 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	uint32_t max_width, max_height;
>  	bool out_of_bounds = false;
>  	uint32_t caps = 0;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -323,11 +322,7 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> @@ -471,7 +466,6 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  {
>  	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -502,11 +496,7 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 7d8307ec442c..9aad769bcdf0 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1135,15 +1135,9 @@ static int
>  nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
> -	struct drm_rect clip = {};
>  	int ret;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -1427,18 +1421,12 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
>  	const struct drm_framebuffer *fb = asyw->state.fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (!fb->format->depth)
>  		return -EINVAL;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index cd2c72389629..b95e9d45a435 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -641,7 +641,6 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	struct vop_win *vop_win = to_vop_win(plane);
>  	const struct vop_win_data *win = vop_win->data;
>  	int ret;
> -	struct drm_rect clip = {};
>  	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
>  					DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
> @@ -654,11 +653,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 93b47e0e038b..45c9cecd7111 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -477,7 +477,6 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state;
>  	struct tegra_dc_state *tegra;
> -	struct drm_rect clip = {};
>  	int err;
>  
>  	/* Propagate errors from allocation or locking failures. */
> @@ -485,12 +484,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	/* Check plane state for visibility and calculate clipping bounds */
> -	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	err = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  0, INT_MAX, true, true);
>  	if (err < 0)
>  		return err;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 25d96560180b..e3e2e9b1ead8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -443,17 +443,12 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state = NULL;
>  	struct drm_framebuffer *new_fb = state->fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (state->crtc)
>  		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
>  
> -	if (crtc_state && crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
> index 8e1f34274e24..94545adac50d 100644
> --- a/drivers/gpu/drm/zte/zx_plane.c
> +++ b/drivers/gpu/drm/zte/zx_plane.c
> @@ -55,7 +55,6 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale = FRAC_16_16(1, 8);
>  	int max_scale = FRAC_16_16(8, 1);
>  
> @@ -75,12 +74,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip, min_scale, max_scale,
> +						   min_scale, max_scale,
>  						   true, true);
>  }
>  
> @@ -291,7 +286,6 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  
>  	if (!crtc || !fb)
>  		return 0;
> @@ -309,12 +303,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index 4842ee9485ce..26aaba58d6ce 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -40,7 +40,6 @@ int drm_atomic_helper_check_modeset(struct drm_device *dev,
>  				struct drm_atomic_state *state);
>  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,
> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
> index 8aa49c0ecd4d..28d7ce620729 100644
> --- a/include/drm/drm_plane_helper.h
> +++ b/include/drm/drm_plane_helper.h
> @@ -43,7 +43,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dest,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> -- 
> 2.13.6
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ville Syrjälä Nov. 24, 2017, 2:08 p.m. UTC | #3
On Fri, Nov 24, 2017 at 11:59:45AM +0000, Liviu Dudau wrote:
> On Thu, Nov 23, 2017 at 09:05:02PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Hi Ville,
> 
> > 
> > Move the plane clip rectangle handling into
> > drm_atomic_helper_check_plane_state(). Drivers no longer
> > have to worry about such mundane details.
> 
> This is quite an important patch and I dare say the essence of your
> series, right? Yet very few people got Cc-ed on it (1 AFAICT) and it
> touches quite a few drivers.

It has no functional changes, so forgetting to plaster it with Ccs
doesn't seem all that dangerous. All the (potentially) functional
changes were in the prep patches which had Ccs, as did the cover
letter. And maintainers should read the ml anyway ;)
Liviu Dudau Nov. 24, 2017, 3:24 p.m. UTC | #4
On Fri, Nov 24, 2017 at 04:08:28PM +0200, Ville Syrjälä wrote:
> On Fri, Nov 24, 2017 at 11:59:45AM +0000, Liviu Dudau wrote:
> > On Thu, Nov 23, 2017 at 09:05:02PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Hi Ville,
> > 
> > > 
> > > Move the plane clip rectangle handling into
> > > drm_atomic_helper_check_plane_state(). Drivers no longer
> > > have to worry about such mundane details.
> > 
> > This is quite an important patch and I dare say the essence of your
> > series, right? Yet very few people got Cc-ed on it (1 AFAICT) and it
> > touches quite a few drivers.
> 
> It has no functional changes, so forgetting to plaster it with Ccs
> doesn't seem all that dangerous. All the (potentially) functional
> changes were in the prep patches which had Ccs, as did the cover
> letter. And maintainers should read the ml anyway ;)

Maintainers don't maintain the functionality, they maintain the source
code. They fix conflicts and order patches. On that line, not Cc-ing
maintainers when you change the code of the drivers they maintain makes
their lives all more ... "entertaining".

And I would argue that the patch does introduce functional changes, as
it removes the clip rectangle from drm_atomic_helper_check_plane_state()'s
list of parameters. It does change all the users of it, too, I agree, but
not for people that have drivers not yet upstreamed (and they start to wonder
how one driver compiles and other fails when they were supposed to have the
same code inside :) )

Regards,
Liviu

> 
> -- 
> Ville Syrjälä
> Intel OTC
Daniel Vetter Nov. 24, 2017, 5 p.m. UTC | #5
On Thu, Nov 23, 2017 at 09:05:02PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Move the plane clip rectangle handling into
> drm_atomic_helper_check_plane_state(). Drivers no longer
> have to worry about such mundane details.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I guess the longer-term next step would be that we expose can_scale and
can_position (and maybe the scaling limits?) as read-only properties, as
hints to the compositor. And then move all the calls into the overall
helpers (i.e. drm_atomic_helper_check_planes).

But this here is real sweet already I think.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c            |  7 +------
>  drivers/gpu/drm/arm/malidp_planes.c         |  7 +------
>  drivers/gpu/drm/armada/armada_overlay.c     |  6 +-----
>  drivers/gpu/drm/drm_atomic_helper.c         | 12 +++++++-----
>  drivers/gpu/drm/drm_plane_helper.c          | 11 +++--------
>  drivers/gpu/drm/drm_simple_kms_helper.c     |  6 ------
>  drivers/gpu/drm/i915/intel_display.c        | 12 ------------
>  drivers/gpu/drm/imx/ipuv3-plane.c           |  7 +------
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  7 +------
>  drivers/gpu/drm/meson/meson_plane.c         |  7 +------
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   | 14 ++------------
>  drivers/gpu/drm/nouveau/nv50_display.c      | 12 ------------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  7 +------
>  drivers/gpu/drm/tegra/dc.c                  |  7 +------
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  7 +------
>  drivers/gpu/drm/zte/zx_plane.c              | 13 +------------
>  include/drm/drm_atomic_helper.h             |  1 -
>  include/drm/drm_plane_helper.h              |  1 -
>  18 files changed, 22 insertions(+), 122 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> index fa852fc1c9e6..93c503b754ba 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -229,7 +229,6 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
>  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_crtc_state *crtc_state;
>  	u32 src_h = state->src_h >> 16;
>  
> @@ -249,11 +248,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  	}
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 2f6d608d6eaf..e630c0218aaf 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -141,18 +141,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
>  	struct drm_crtc_state *crtc_state =
>  		drm_atomic_get_existing_crtc_state(state->state, state->crtc);
>  	struct malidp_crtc_state *mc;
> -	struct drm_rect clip = { 0 };
>  	u32 src_w, src_h;
>  	int ret;
>  
>  	if (!crtc_state)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	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/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index b411b608821a..564bd63a5f6a 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -111,10 +111,6 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	uint32_t val, ctrl0;
>  	unsigned idx = 0;
>  	bool visible;
> @@ -124,7 +120,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  				 crtc_x, crtc_y, crtc_w, crtc_h,
>  				 src_x, src_y, src_w, src_h);
>  
> -	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> +	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 2f80377101a1..d25eaf6f62a9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -699,7 +699,6 @@ 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
> @@ -719,7 +718,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
>   */
>  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,
> @@ -729,6 +727,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  	struct drm_rect *src = &plane_state->src;
>  	struct drm_rect *dst = &plane_state->dst;
>  	unsigned int rotation = plane_state->rotation;
> +	struct drm_rect clip = {};
>  	int hscale, vscale;
>  
>  	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
> @@ -764,7 +763,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		return -ERANGE;
>  	}
>  
> -	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
> +	if (crtc_state->enable)
> +		drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
> +
> +	plane_state->visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
>  
>  	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
>  
> @@ -778,10 +780,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
>  		 */
>  		return 0;
>  
> -	if (!can_position && !drm_rect_equals(dst, clip)) {
> +	if (!can_position && !drm_rect_equals(dst, &clip)) {
>  		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
>  		drm_rect_debug_print("dst: ", dst, false);
> -		drm_rect_debug_print("clip: ", clip, false);
> +		drm_rect_debug_print("clip: ", &clip, false);
>  		return -EINVAL;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f1be8cd4e387..f88f68161519 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -106,7 +106,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>   * @fb: framebuffer to flip onto plane
>   * @src: source coordinates in 16.16 fixed point
>   * @dst: integer destination coordinates
> - * @clip: integer clipping coordinates
>   * @rotation: plane rotation
>   * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
>   * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> @@ -131,7 +130,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dst,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> @@ -157,11 +155,12 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  	struct drm_crtc_state crtc_state = {
>  		.crtc = crtc,
>  		.enable = crtc->enabled,
> +		.mode = crtc->mode,
>  	};
>  	int ret;
>  
>  	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
> -						  clip, min_scale, max_scale,
> +						  min_scale, max_scale,
>  						  can_position,
>  						  can_update_disabled);
>  	if (ret)
> @@ -239,16 +238,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  		.x2 = crtc_x + crtc_w,
>  		.y2 = crtc_y + crtc_h,
>  	};
> -	const struct drm_rect clip = {
> -		.x2 = crtc->mode.hdisplay,
> -		.y2 = crtc->mode.vdisplay,
> -	};
>  	struct drm_connector **connector_list;
>  	int num_connectors, ret;
>  	bool visible;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
> -					    &src, &dest, &clip,
> +					    &src, &dest,
>  					    DRM_MODE_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 9d3f6b70812c..165bc756af96 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -89,7 +89,6 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
>  static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  					struct drm_plane_state *plane_state)
>  {
> -	struct drm_rect clip = { 0 };
>  	struct drm_simple_display_pipe *pipe;
>  	struct drm_crtc_state *crtc_state;
>  	int ret;
> @@ -100,12 +99,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  	if (!crtc_state->enable)
>  		return 0; /* nothing to check when disabling or disabled */
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4eeec590b722..200d8989f7b5 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9267,18 +9267,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
>  			      struct intel_plane_state *plane_state)
>  {
>  	const struct drm_framebuffer *fb = plane_state->base.fb;
> -	struct drm_rect clip = {};
>  	int src_x, src_y;
>  	u32 offset;
>  	int ret;
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -12837,7 +12831,6 @@ intel_check_primary_plane(struct intel_plane *plane,
>  	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
>  	bool can_position = false;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (INTEL_GEN(dev_priv) >= 9) {
> @@ -12849,13 +12842,8 @@ intel_check_primary_plane(struct intel_plane *plane,
>  		can_position = true;
>  	}
>  
> -	if (crtc_state->base.enable)
> -		drm_mode_get_hv_timing(&crtc_state->base.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&state->base,
>  						  &crtc_state->base,
> -						  &clip,
>  						  min_scale, max_scale,
>  						  can_position, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index c0662503571b..35be3759e08e 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -322,7 +322,6 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *old_fb = old_state->fb;
>  	unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba;
>  	bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
> -	struct drm_rect clip = {};
>  	int hsub, vsub;
>  	int ret;
>  
> @@ -338,11 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  can_position, true);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index b5c6eec9a584..2f4b0ffee598 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -91,7 +91,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_framebuffer *fb = state->fb;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!fb)
>  		return 0;
> @@ -108,11 +107,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 3801bee1f9e6..c78a3a59f58c 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -49,7 +49,6 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = { 0, };
>  
>  	if (!state->crtc)
>  		return 0;
> @@ -58,11 +57,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	return drm_atomic_helper_check_plane_state(state, crtc_state,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   true, true);
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 09f758e7bb1b..087d6973e804 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -286,7 +286,6 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	uint32_t max_width, max_height;
>  	bool out_of_bounds = false;
>  	uint32_t caps = 0;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -323,11 +322,7 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> @@ -471,7 +466,6 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  {
>  	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale, max_scale;
>  	int ret;
>  
> @@ -502,11 +496,7 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
>  	min_scale = FRAC_16_16(1, 8);
>  	max_scale = FRAC_16_16(8, 1);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 7d8307ec442c..9aad769bcdf0 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1135,15 +1135,9 @@ static int
>  nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
> -	struct drm_rect clip = {};
>  	int ret;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  true, true);
> @@ -1427,18 +1421,12 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
>  	const struct drm_framebuffer *fb = asyw->state.fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (!fb->format->depth)
>  		return -EINVAL;
>  
> -	if (asyh->state.enable)
> -		drm_mode_get_hv_timing(&asyh->state.mode,
> -				       &clip.x2, &clip.y2);
> -
>  	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> -						  &clip,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index cd2c72389629..b95e9d45a435 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -641,7 +641,6 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	struct vop_win *vop_win = to_vop_win(plane);
>  	const struct vop_win_data *win = vop_win->data;
>  	int ret;
> -	struct drm_rect clip = {};
>  	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
>  					DRM_PLANE_HELPER_NO_SCALING;
>  	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
> @@ -654,11 +653,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>  	if (WARN_ON(!crtc_state))
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  min_scale, max_scale,
>  						  true, true);
>  	if (ret)
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 93b47e0e038b..45c9cecd7111 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -477,7 +477,6 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state;
>  	struct tegra_dc_state *tegra;
> -	struct drm_rect clip = {};
>  	int err;
>  
>  	/* Propagate errors from allocation or locking failures. */
> @@ -485,12 +484,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
>  	if (IS_ERR(crtc_state))
>  		return PTR_ERR(crtc_state);
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	/* Check plane state for visibility and calculate clipping bounds */
> -	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	err = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  0, INT_MAX, true, true);
>  	if (err < 0)
>  		return err;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 25d96560180b..e3e2e9b1ead8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -443,17 +443,12 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_crtc_state *crtc_state = NULL;
>  	struct drm_framebuffer *new_fb = state->fb;
> -	struct drm_rect clip = {};
>  	int ret;
>  
>  	if (state->crtc)
>  		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
>  
> -	if (crtc_state && crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
> -	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  DRM_PLANE_HELPER_NO_SCALING,
>  						  false, true);
> diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
> index 8e1f34274e24..94545adac50d 100644
> --- a/drivers/gpu/drm/zte/zx_plane.c
> +++ b/drivers/gpu/drm/zte/zx_plane.c
> @@ -55,7 +55,6 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  	int min_scale = FRAC_16_16(1, 8);
>  	int max_scale = FRAC_16_16(8, 1);
>  
> @@ -75,12 +74,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip, min_scale, max_scale,
> +						   min_scale, max_scale,
>  						   true, true);
>  }
>  
> @@ -291,7 +286,6 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	struct drm_framebuffer *fb = plane_state->fb;
>  	struct drm_crtc *crtc = plane_state->crtc;
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_rect clip = {};
>  
>  	if (!crtc || !fb)
>  		return 0;
> @@ -309,12 +303,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
>  	if (!plane_state->crtc)
>  		return -EINVAL;
>  
> -	if (crtc_state->enable)
> -		drm_mode_get_hv_timing(&crtc_state->mode,
> -				       &clip.x2, &clip.y2);
> -
>  	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
> -						   &clip,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   DRM_PLANE_HELPER_NO_SCALING,
>  						   false, true);
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index 4842ee9485ce..26aaba58d6ce 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -40,7 +40,6 @@ int drm_atomic_helper_check_modeset(struct drm_device *dev,
>  				struct drm_atomic_state *state);
>  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,
> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
> index 8aa49c0ecd4d..28d7ce620729 100644
> --- a/include/drm/drm_plane_helper.h
> +++ b/include/drm/drm_plane_helper.h
> @@ -43,7 +43,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  				  struct drm_framebuffer *fb,
>  				  struct drm_rect *src,
>  				  struct drm_rect *dest,
> -				  const struct drm_rect *clip,
>  				  unsigned int rotation,
>  				  int min_scale,
>  				  int max_scale,
> -- 
> 2.13.6
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index fa852fc1c9e6..93c503b754ba 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -229,7 +229,6 @@  static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
 static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 				    struct drm_plane_state *state)
 {
-	struct drm_rect clip = { 0 };
 	struct drm_crtc_state *crtc_state;
 	u32 src_h = state->src_h >> 16;
 
@@ -249,11 +248,7 @@  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	return drm_atomic_helper_check_plane_state(state, crtc_state,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   false, true);
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 2f6d608d6eaf..e630c0218aaf 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -141,18 +141,13 @@  static int malidp_se_check_scaling(struct malidp_plane *mp,
 	struct drm_crtc_state *crtc_state =
 		drm_atomic_get_existing_crtc_state(state->state, state->crtc);
 	struct malidp_crtc_state *mc;
-	struct drm_rect clip = { 0 };
 	u32 src_w, src_h;
 	int ret;
 
 	if (!crtc_state)
 		return -EINVAL;
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	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/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index b411b608821a..564bd63a5f6a 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -111,10 +111,6 @@  armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 		.x2 = crtc_x + crtc_w,
 		.y2 = crtc_y + crtc_h,
 	};
-	const struct drm_rect clip = {
-		.x2 = crtc->mode.hdisplay,
-		.y2 = crtc->mode.vdisplay,
-	};
 	uint32_t val, ctrl0;
 	unsigned idx = 0;
 	bool visible;
@@ -124,7 +120,7 @@  armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 				 crtc_x, crtc_y, crtc_w, crtc_h,
 				 src_x, src_y, src_w, src_h);
 
-	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
+	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest,
 					    DRM_MODE_ROTATE_0,
 					    0, INT_MAX, true, false, &visible);
 	if (ret)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 2f80377101a1..d25eaf6f62a9 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -699,7 +699,6 @@  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
@@ -719,7 +718,6 @@  EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
  */
 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,
@@ -729,6 +727,7 @@  int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 	struct drm_rect *src = &plane_state->src;
 	struct drm_rect *dst = &plane_state->dst;
 	unsigned int rotation = plane_state->rotation;
+	struct drm_rect clip = {};
 	int hscale, vscale;
 
 	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
@@ -764,7 +763,10 @@  int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 		return -ERANGE;
 	}
 
-	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
+	if (crtc_state->enable)
+		drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
+
+	plane_state->visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
 
 	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
 
@@ -778,10 +780,10 @@  int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 		 */
 		return 0;
 
-	if (!can_position && !drm_rect_equals(dst, clip)) {
+	if (!can_position && !drm_rect_equals(dst, &clip)) {
 		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
 		drm_rect_debug_print("dst: ", dst, false);
-		drm_rect_debug_print("clip: ", clip, false);
+		drm_rect_debug_print("clip: ", &clip, false);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index f1be8cd4e387..f88f68161519 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -106,7 +106,6 @@  static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * @fb: framebuffer to flip onto plane
  * @src: source coordinates in 16.16 fixed point
  * @dst: integer destination coordinates
- * @clip: integer clipping coordinates
  * @rotation: plane rotation
  * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
  * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
@@ -131,7 +130,6 @@  int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_framebuffer *fb,
 				  struct drm_rect *src,
 				  struct drm_rect *dst,
-				  const struct drm_rect *clip,
 				  unsigned int rotation,
 				  int min_scale,
 				  int max_scale,
@@ -157,11 +155,12 @@  int drm_plane_helper_check_update(struct drm_plane *plane,
 	struct drm_crtc_state crtc_state = {
 		.crtc = crtc,
 		.enable = crtc->enabled,
+		.mode = crtc->mode,
 	};
 	int ret;
 
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  clip, min_scale, max_scale,
+						  min_scale, max_scale,
 						  can_position,
 						  can_update_disabled);
 	if (ret)
@@ -239,16 +238,12 @@  int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 		.x2 = crtc_x + crtc_w,
 		.y2 = crtc_y + crtc_h,
 	};
-	const struct drm_rect clip = {
-		.x2 = crtc->mode.hdisplay,
-		.y2 = crtc->mode.vdisplay,
-	};
 	struct drm_connector **connector_list;
 	int num_connectors, ret;
 	bool visible;
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb,
-					    &src, &dest, &clip,
+					    &src, &dest,
 					    DRM_MODE_ROTATE_0,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 9d3f6b70812c..165bc756af96 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -89,7 +89,6 @@  static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
 static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 					struct drm_plane_state *plane_state)
 {
-	struct drm_rect clip = { 0 };
 	struct drm_simple_display_pipe *pipe;
 	struct drm_crtc_state *crtc_state;
 	int ret;
@@ -100,12 +99,7 @@  static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	if (!crtc_state->enable)
 		return 0; /* nothing to check when disabling or disabled */
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
 	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						  &clip,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  false, true);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4eeec590b722..200d8989f7b5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9267,18 +9267,12 @@  static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 			      struct intel_plane_state *plane_state)
 {
 	const struct drm_framebuffer *fb = plane_state->base.fb;
-	struct drm_rect clip = {};
 	int src_x, src_y;
 	u32 offset;
 	int ret;
 
-	if (crtc_state->base.enable)
-		drm_mode_get_hv_timing(&crtc_state->base.mode,
-				       &clip.x2, &clip.y2);
-
 	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
 						  &crtc_state->base,
-						  &clip,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  true, true);
@@ -12837,7 +12831,6 @@  intel_check_primary_plane(struct intel_plane *plane,
 	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
 	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
 	bool can_position = false;
-	struct drm_rect clip = {};
 	int ret;
 
 	if (INTEL_GEN(dev_priv) >= 9) {
@@ -12849,13 +12842,8 @@  intel_check_primary_plane(struct intel_plane *plane,
 		can_position = true;
 	}
 
-	if (crtc_state->base.enable)
-		drm_mode_get_hv_timing(&crtc_state->base.mode,
-				       &clip.x2, &clip.y2);
-
 	ret = drm_atomic_helper_check_plane_state(&state->base,
 						  &crtc_state->base,
-						  &clip,
 						  min_scale, max_scale,
 						  can_position, true);
 	if (ret)
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index c0662503571b..35be3759e08e 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -322,7 +322,6 @@  static int ipu_plane_atomic_check(struct drm_plane *plane,
 	struct drm_framebuffer *old_fb = old_state->fb;
 	unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba;
 	bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
-	struct drm_rect clip = {};
 	int hsub, vsub;
 	int ret;
 
@@ -338,11 +337,7 @@  static int ipu_plane_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  can_position, true);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index b5c6eec9a584..2f4b0ffee598 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -91,7 +91,6 @@  static int mtk_plane_atomic_check(struct drm_plane *plane,
 {
 	struct drm_framebuffer *fb = state->fb;
 	struct drm_crtc_state *crtc_state;
-	struct drm_rect clip = { 0, };
 
 	if (!fb)
 		return 0;
@@ -108,11 +107,7 @@  static int mtk_plane_atomic_check(struct drm_plane *plane,
 	if (IS_ERR(crtc_state))
 		return PTR_ERR(crtc_state);
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	return drm_atomic_helper_check_plane_state(state, crtc_state,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   true, true);
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index 3801bee1f9e6..c78a3a59f58c 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -49,7 +49,6 @@  static int meson_plane_atomic_check(struct drm_plane *plane,
 				    struct drm_plane_state *state)
 {
 	struct drm_crtc_state *crtc_state;
-	struct drm_rect clip = { 0, };
 
 	if (!state->crtc)
 		return 0;
@@ -58,11 +57,7 @@  static int meson_plane_atomic_check(struct drm_plane *plane,
 	if (IS_ERR(crtc_state))
 		return PTR_ERR(crtc_state);
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	return drm_atomic_helper_check_plane_state(state, crtc_state,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   true, true);
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 09f758e7bb1b..087d6973e804 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -286,7 +286,6 @@  static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	uint32_t max_width, max_height;
 	bool out_of_bounds = false;
 	uint32_t caps = 0;
-	struct drm_rect clip = {};
 	int min_scale, max_scale;
 	int ret;
 
@@ -323,11 +322,7 @@  static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  min_scale, max_scale,
 						  true, true);
 	if (ret)
@@ -471,7 +466,6 @@  static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
 {
 	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
 	struct drm_crtc_state *crtc_state;
-	struct drm_rect clip = {};
 	int min_scale, max_scale;
 	int ret;
 
@@ -502,11 +496,7 @@  static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  min_scale, max_scale,
 						  true, true);
 	if (ret)
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 7d8307ec442c..9aad769bcdf0 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1135,15 +1135,9 @@  static int
 nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 		  struct nv50_head_atom *asyh)
 {
-	struct drm_rect clip = {};
 	int ret;
 
-	if (asyh->state.enable)
-		drm_mode_get_hv_timing(&asyh->state.mode,
-				       &clip.x2, &clip.y2);
-
 	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						  &clip,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  true, true);
@@ -1427,18 +1421,12 @@  nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 		  struct nv50_head_atom *asyh)
 {
 	const struct drm_framebuffer *fb = asyw->state.fb;
-	struct drm_rect clip = {};
 	int ret;
 
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	if (asyh->state.enable)
-		drm_mode_get_hv_timing(&asyh->state.mode,
-				       &clip.x2, &clip.y2);
-
 	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						  &clip,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  false, true);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index cd2c72389629..b95e9d45a435 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -641,7 +641,6 @@  static int vop_plane_atomic_check(struct drm_plane *plane,
 	struct vop_win *vop_win = to_vop_win(plane);
 	const struct vop_win_data *win = vop_win->data;
 	int ret;
-	struct drm_rect clip = {};
 	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
 					DRM_PLANE_HELPER_NO_SCALING;
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
@@ -654,11 +653,7 @@  static int vop_plane_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  min_scale, max_scale,
 						  true, true);
 	if (ret)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 93b47e0e038b..45c9cecd7111 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -477,7 +477,6 @@  static int tegra_plane_state_add(struct tegra_plane *plane,
 {
 	struct drm_crtc_state *crtc_state;
 	struct tegra_dc_state *tegra;
-	struct drm_rect clip = {};
 	int err;
 
 	/* Propagate errors from allocation or locking failures. */
@@ -485,12 +484,8 @@  static int tegra_plane_state_add(struct tegra_plane *plane,
 	if (IS_ERR(crtc_state))
 		return PTR_ERR(crtc_state);
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	err = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 25d96560180b..e3e2e9b1ead8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -443,17 +443,12 @@  int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 {
 	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {};
 	int ret;
 
 	if (state->crtc)
 		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
-	if (crtc_state && crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
-	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  false, true);
diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
index 8e1f34274e24..94545adac50d 100644
--- a/drivers/gpu/drm/zte/zx_plane.c
+++ b/drivers/gpu/drm/zte/zx_plane.c
@@ -55,7 +55,6 @@  static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	struct drm_framebuffer *fb = plane_state->fb;
 	struct drm_crtc *crtc = plane_state->crtc;
 	struct drm_crtc_state *crtc_state;
-	struct drm_rect clip = {};
 	int min_scale = FRAC_16_16(1, 8);
 	int max_scale = FRAC_16_16(8, 1);
 
@@ -75,12 +74,8 @@  static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	if (!plane_state->crtc)
 		return -EINVAL;
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
 	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						   &clip, min_scale, max_scale,
+						   min_scale, max_scale,
 						   true, true);
 }
 
@@ -291,7 +286,6 @@  static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	struct drm_framebuffer *fb = plane_state->fb;
 	struct drm_crtc *crtc = plane_state->crtc;
 	struct drm_crtc_state *crtc_state;
-	struct drm_rect clip = {};
 
 	if (!crtc || !fb)
 		return 0;
@@ -309,12 +303,7 @@  static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	if (!plane_state->crtc)
 		return -EINVAL;
 
-	if (crtc_state->enable)
-		drm_mode_get_hv_timing(&crtc_state->mode,
-				       &clip.x2, &clip.y2);
-
 	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						   &clip,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   DRM_PLANE_HELPER_NO_SCALING,
 						   false, true);
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 4842ee9485ce..26aaba58d6ce 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -40,7 +40,6 @@  int drm_atomic_helper_check_modeset(struct drm_device *dev,
 				struct drm_atomic_state *state);
 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,
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 8aa49c0ecd4d..28d7ce620729 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -43,7 +43,6 @@  int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_framebuffer *fb,
 				  struct drm_rect *src,
 				  struct drm_rect *dest,
-				  const struct drm_rect *clip,
 				  unsigned int rotation,
 				  int min_scale,
 				  int max_scale,