On Tue, 2018-01-23 at 19:08 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrj...@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.
> 
> v2: Convert armada, rcar, and sun4i as well
> 
> Cc: Liviu Dudau <liviu.du...@arm.com>
> Cc: Brian Starkey <brian.star...@arm.com>
> Cc: Mali DP Maintainers <mal...@foss.arm.com>
> Cc: Daniel Vetter <daniel.vet...@intel.com>
> Cc: Gustavo Padovan <gust...@padovan.org>
> Cc: Sean Paul <seanp...@chromium.org>
> Cc: Philipp Zabel <p.za...@pengutronix.de>
> Cc: CK Hu <ck...@mediatek.com>
> Cc: Neil Armstrong <narmstr...@baylibre.com>
> Cc: Rob Clark <robdcl...@gmail.com>
> Cc: Ben Skeggs <bske...@redhat.com>
> Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> Cc: Sandy Huang <h...@rock-chips.com>
> Cc: "Heiko Stübner" <he...@sntech.de>
> Cc: Maxime Ripard <maxime.rip...@free-electrons.com>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Cc: VMware Graphics <linux-graphics-maintai...@vmware.com>
> Cc: Sinclair Yeh <s...@vmware.com>
> Cc: Thomas Hellstrom <thellst...@vmware.com>
> Cc: Shawn Guo <shawn...@kernel.org>
> Cc: Archit Taneja <arch...@codeaurora.org>
> Cc: linux-amlo...@lists.infradead.org
> Cc: linux-arm-...@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: nouv...@lists.freedesktop.org
> Cc: linux-renesas-...@vger.kernel.org
> Cc: linux-te...@vger.kernel.org
> Cc: Russell King <rmk+ker...@armlinux.org.uk>
> Suggested-by: Daniel Vetter <dan...@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
> Reviewed-by: Daniel Vetter <daniel.vet...@ffwll.ch>
> Reviewed-by: Thierry Reding <tred...@nvidia.com>
> Reviewed-by: Archit Taneja <arch...@codeaurora.org> #msm
> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c            |  7 +------
>  drivers/gpu/drm/arm/malidp_planes.c         |  7 +------
>  drivers/gpu/drm/armada/armada_crtc.c        |  8 ++------
>  drivers/gpu/drm/armada/armada_overlay.c     |  8 ++------
>  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/rcar-du/rcar_du_plane.c     |  7 +------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  7 +------
>  drivers/gpu/drm/sun4i/sun8i_ui_layer.c      |  7 +------
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c      |  7 +------
>  drivers/gpu/drm/tegra/plane.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 -
>  22 files changed, 28 insertions(+), 147 deletions(-)
> 
[...]
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index ab4032167094..9fb96f9cc36e 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/imx/ipuv3-plane.c 
> b/drivers/gpu/drm/imx/ipuv3-plane.c
> index 150628293c51..d7e3583e608e 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -351,7 +351,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;
>  
> @@ -367,11 +366,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);
[...]

For the imx and mtk changes,
Acked-by: Philipp Zabel <p.za...@pengutronix.de>

regards
Philipp
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

Reply via email to