Commit 81af63a4 authored by Ville Syrjälä's avatar Ville Syrjälä

drm: Don't pass clip to drm_atomic_helper_check_plane_state()

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
v3: Resolve simple_kms_helper conflict

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Suggested-by: default avatarDaniel Vetter <daniel@ffwll.ch>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org> #msm
Link: https://patchwork.freedesktop.org/patch/msgid/20180123170857.13818-5-ville.syrjala@linux.intel.com
Acked-by: Liviu Dudau <liviu.dudau@arm.com> #hdlcd,malidp
Acked-by: Philipp Zabel <p.zabel@pengutronix.de> #imx,mtk
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com> #vmwgfx
Acked-by: Neil Armstrong <narmstrong@baylibre.com> #meson
Acked-by: Shawn Guo <shawnguo@kernel.org> #zte
parent bf817d0c
...@@ -229,7 +229,6 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = { ...@@ -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, static int hdlcd_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state) struct drm_plane_state *state)
{ {
struct drm_rect clip = { 0 };
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
u32 src_h = state->src_h >> 16; u32 src_h = state->src_h >> 16;
...@@ -249,11 +248,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane, ...@@ -249,11 +248,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
return -EINVAL; return -EINVAL;
} }
if (crtc_state->enable) return drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
false, true); false, true);
......
...@@ -141,18 +141,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp, ...@@ -141,18 +141,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
struct drm_crtc_state *crtc_state = struct drm_crtc_state *crtc_state =
drm_atomic_get_existing_crtc_state(state->state, state->crtc); drm_atomic_get_existing_crtc_state(state->state, state->crtc);
struct malidp_crtc_state *mc; struct malidp_crtc_state *mc;
struct drm_rect clip = { 0 };
u32 src_w, src_h; u32 src_w, src_h;
int ret; int ret;
if (!crtc_state) if (!crtc_state)
return -EINVAL; return -EINVAL;
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
0, INT_MAX, true, true); 0, INT_MAX, true, true);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1203,15 +1203,11 @@ static int armada_drm_primary_update(struct drm_plane *plane, ...@@ -1203,15 +1203,11 @@ static int armada_drm_primary_update(struct drm_plane *plane,
struct drm_crtc_state crtc_state = { struct drm_crtc_state crtc_state = {
.crtc = crtc, .crtc = crtc,
.enable = crtc->enabled, .enable = crtc->enabled,
.mode = crtc->mode,
}; };
struct drm_rect clip = {};
int ret; int ret;
if (crtc->enabled) ret = drm_atomic_helper_check_plane_state(&state, &crtc_state, 0,
drm_mode_get_hv_timing(&crtc->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(&state, &crtc_state, &clip, 0,
INT_MAX, true, false); INT_MAX, true, false);
if (ret) if (ret)
return ret; return ret;
......
...@@ -208,19 +208,15 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -208,19 +208,15 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_crtc_state crtc_state = { struct drm_crtc_state crtc_state = {
.crtc = crtc, .crtc = crtc,
.enable = crtc->enabled, .enable = crtc->enabled,
.mode = crtc->mode,
}; };
struct drm_rect clip = {};
int ret; int ret;
trace_armada_ovl_plane_update(plane, crtc, fb, trace_armada_ovl_plane_update(plane, crtc, fb,
crtc_x, crtc_y, crtc_w, crtc_h, crtc_x, crtc_y, crtc_w, crtc_h,
src_x, src_y, src_w, src_h); src_x, src_y, src_w, src_h);
if (crtc->enabled) ret = drm_atomic_helper_check_plane_state(&state, &crtc_state, 0,
drm_mode_get_hv_timing(&crtc->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(&state, &crtc_state, &clip, 0,
INT_MAX, true, false); INT_MAX, true, false);
if (ret) if (ret)
return ret; return ret;
......
...@@ -699,7 +699,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset); ...@@ -699,7 +699,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
* drm_atomic_helper_check_plane_state() - Check plane state for validity * drm_atomic_helper_check_plane_state() - Check plane state for validity
* @plane_state: plane state to check * @plane_state: plane state to check
* @crtc_state: crtc 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 * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
* @max_scale: maximum @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 * @can_position: is it legal to position the plane such that it
...@@ -719,7 +718,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset); ...@@ -719,7 +718,6 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
*/ */
int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
const struct drm_crtc_state *crtc_state, const struct drm_crtc_state *crtc_state,
const struct drm_rect *clip,
int min_scale, int min_scale,
int max_scale, int max_scale,
bool can_position, bool can_position,
...@@ -729,6 +727,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, ...@@ -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 *src = &plane_state->src;
struct drm_rect *dst = &plane_state->dst; struct drm_rect *dst = &plane_state->dst;
unsigned int rotation = plane_state->rotation; unsigned int rotation = plane_state->rotation;
struct drm_rect clip = {};
int hscale, vscale; int hscale, vscale;
WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc); 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, ...@@ -764,7 +763,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
return -ERANGE; 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); 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, ...@@ -778,10 +780,10 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
*/ */
return 0; 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_DEBUG_KMS("Plane must cover entire CRTC\n");
drm_rect_debug_print("dst: ", dst, false); drm_rect_debug_print("dst: ", dst, false);
drm_rect_debug_print("clip: ", clip, false); drm_rect_debug_print("clip: ", &clip, false);
return -EINVAL; return -EINVAL;
} }
......
...@@ -106,7 +106,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc, ...@@ -106,7 +106,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
* @fb: framebuffer to flip onto plane * @fb: framebuffer to flip onto plane
* @src: source coordinates in 16.16 fixed point * @src: source coordinates in 16.16 fixed point
* @dst: integer destination coordinates * @dst: integer destination coordinates
* @clip: integer clipping coordinates
* @rotation: plane rotation * @rotation: plane rotation
* @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
* @max_scale: maximum @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, ...@@ -131,7 +130,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
struct drm_framebuffer *fb, struct drm_framebuffer *fb,
struct drm_rect *src, struct drm_rect *src,
struct drm_rect *dst, struct drm_rect *dst,
const struct drm_rect *clip,
unsigned int rotation, unsigned int rotation,
int min_scale, int min_scale,
int max_scale, int max_scale,
...@@ -157,11 +155,12 @@ int drm_plane_helper_check_update(struct drm_plane *plane, ...@@ -157,11 +155,12 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
struct drm_crtc_state crtc_state = { struct drm_crtc_state crtc_state = {
.crtc = crtc, .crtc = crtc,
.enable = crtc->enabled, .enable = crtc->enabled,
.mode = crtc->mode,
}; };
int ret; int ret;
ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state, ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
clip, min_scale, max_scale, min_scale, max_scale,
can_position, can_position,
can_update_disabled); can_update_disabled);
if (ret) if (ret)
...@@ -239,16 +238,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -239,16 +238,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
.x2 = crtc_x + crtc_w, .x2 = crtc_x + crtc_w,
.y2 = crtc_y + crtc_h, .y2 = crtc_y + crtc_h,
}; };
const struct drm_rect clip = {
.x2 = crtc->mode.hdisplay,
.y2 = crtc->mode.vdisplay,
};
struct drm_connector **connector_list; struct drm_connector **connector_list;
int num_connectors, ret; int num_connectors, ret;
bool visible; bool visible;
ret = drm_plane_helper_check_update(plane, crtc, fb, ret = drm_plane_helper_check_update(plane, crtc, fb,
&src, &dest, &clip, &src, &dest,
DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
......
...@@ -128,7 +128,6 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = { ...@@ -128,7 +128,6 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct drm_rect clip = { 0 };
struct drm_simple_display_pipe *pipe; struct drm_simple_display_pipe *pipe;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int ret; int ret;
...@@ -138,7 +137,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, ...@@ -138,7 +137,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
&pipe->crtc); &pipe->crtc);
ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state, ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
&clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
false, true); false, true);
...@@ -148,8 +146,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, ...@@ -148,8 +146,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
if (!plane_state->visible) if (!plane_state->visible)
return 0; return 0;
drm_mode_get_hv_timing(&crtc_state->mode, &clip.x2, &clip.y2);
if (!pipe->funcs || !pipe->funcs->check) if (!pipe->funcs || !pipe->funcs->check)
return 0; return 0;
......
...@@ -9360,18 +9360,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -9360,18 +9360,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
const struct drm_framebuffer *fb = plane_state->base.fb; const struct drm_framebuffer *fb = plane_state->base.fb;
struct drm_rect clip = {};
int src_x, src_y; int src_x, src_y;
u32 offset; u32 offset;
int ret; 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, ret = drm_atomic_helper_check_plane_state(&plane_state->base,
&crtc_state->base, &crtc_state->base,
&clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
true, true); true, true);
...@@ -12806,7 +12800,6 @@ intel_check_primary_plane(struct intel_plane *plane, ...@@ -12806,7 +12800,6 @@ intel_check_primary_plane(struct intel_plane *plane,
int min_scale = DRM_PLANE_HELPER_NO_SCALING; int min_scale = DRM_PLANE_HELPER_NO_SCALING;
int max_scale = DRM_PLANE_HELPER_NO_SCALING; int max_scale = DRM_PLANE_HELPER_NO_SCALING;
bool can_position = false; bool can_position = false;
struct drm_rect clip = {};
int ret; int ret;
if (INTEL_GEN(dev_priv) >= 9) { if (INTEL_GEN(dev_priv) >= 9) {
...@@ -12818,13 +12811,8 @@ intel_check_primary_plane(struct intel_plane *plane, ...@@ -12818,13 +12811,8 @@ intel_check_primary_plane(struct intel_plane *plane,
can_position = true; 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, ret = drm_atomic_helper_check_plane_state(&state->base,
&crtc_state->base, &crtc_state->base,
&clip,
min_scale, max_scale, min_scale, max_scale,
can_position, true); can_position, true);
if (ret) if (ret)
......
...@@ -351,7 +351,6 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, ...@@ -351,7 +351,6 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *old_fb = old_state->fb; struct drm_framebuffer *old_fb = old_state->fb;
unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba; unsigned long eba, ubo, vbo, old_ubo, old_vbo, alpha_eba;
bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY); bool can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
struct drm_rect clip = {};
int hsub, vsub; int hsub, vsub;
int ret; int ret;
...@@ -367,11 +366,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, ...@@ -367,11 +366,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
if (WARN_ON(!crtc_state)) if (WARN_ON(!crtc_state))
return -EINVAL; return -EINVAL;
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
can_position, true); can_position, true);
......
...@@ -91,7 +91,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, ...@@ -91,7 +91,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
{ {
struct drm_framebuffer *fb = state->fb; struct drm_framebuffer *fb = state->fb;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = { 0, };
if (!fb) if (!fb)
return 0; return 0;
...@@ -108,11 +107,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, ...@@ -108,11 +107,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
if (IS_ERR(crtc_state)) if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state); return PTR_ERR(crtc_state);
if (crtc_state->enable) return drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
true, true); true, true);
......
...@@ -49,7 +49,6 @@ static int meson_plane_atomic_check(struct drm_plane *plane, ...@@ -49,7 +49,6 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state) struct drm_plane_state *state)
{ {
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = { 0, };
if (!state->crtc) if (!state->crtc)
return 0; return 0;
...@@ -58,11 +57,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane, ...@@ -58,11 +57,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
if (IS_ERR(crtc_state)) if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state); return PTR_ERR(crtc_state);
if (crtc_state->enable) return drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
true, true); true, true);
......
...@@ -286,7 +286,6 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, ...@@ -286,7 +286,6 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
uint32_t max_width, max_height; uint32_t max_width, max_height;
bool out_of_bounds = false; bool out_of_bounds = false;
uint32_t caps = 0; uint32_t caps = 0;
struct drm_rect clip = {};
int min_scale, max_scale; int min_scale, max_scale;
int ret; int ret;
...@@ -323,11 +322,7 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, ...@@ -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); min_scale = FRAC_16_16(1, 8);
max_scale = FRAC_16_16(8, 1); max_scale = FRAC_16_16(8, 1);
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
if (ret) if (ret)
...@@ -471,7 +466,6 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, ...@@ -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 mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = {};
int min_scale, max_scale; int min_scale, max_scale;
int ret; int ret;
...@@ -502,11 +496,7 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, ...@@ -502,11 +496,7 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
min_scale = FRAC_16_16(1, 8); min_scale = FRAC_16_16(1, 8);
max_scale = FRAC_16_16(8, 1); max_scale = FRAC_16_16(8, 1);
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
if (ret) if (ret)
......
...@@ -1143,15 +1143,9 @@ static int ...@@ -1143,15 +1143,9 @@ static int
nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
struct nv50_head_atom *asyh) struct nv50_head_atom *asyh)
{ {
struct drm_rect clip = {};
int ret; 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, ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
&clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
true, true); true, true);
...@@ -1435,18 +1429,12 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, ...@@ -1435,18 +1429,12 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
struct nv50_head_atom *asyh) struct nv50_head_atom *asyh)
{ {
const struct drm_framebuffer *fb = asyw->state.fb; const struct drm_framebuffer *fb = asyw->state.fb;
struct drm_rect clip = {};
int ret; int ret;
if (!fb->format->depth) if (!fb->format->depth)
return -EINVAL; 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, ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
&clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
false, true); false, true);
......
...@@ -572,7 +572,6 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane, ...@@ -572,7 +572,6 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
{ {
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = {};
int ret; int ret;
if (!state->crtc) { if (!state->crtc) {
...@@ -589,11 +588,7 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane, ...@@ -589,11 +588,7 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
if (IS_ERR(crtc_state)) if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state); return PTR_ERR(crtc_state);
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
true, true); true, true);
......
...@@ -630,7 +630,6 @@ static int vop_plane_atomic_check(struct drm_plane *plane, ...@@ -630,7 +630,6 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
struct vop_win *vop_win = to_vop_win(plane); struct vop_win *vop_win = to_vop_win(plane);
const struct vop_win_data *win = vop_win->data; const struct vop_win_data *win = vop_win->data;
int ret; int ret;
struct drm_rect clip = {};
int min_scale = win->phy->scl ? FRAC_16_16(1, 8) : int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
DRM_PLANE_HELPER_NO_SCALING; DRM_PLANE_HELPER_NO_SCALING;
int max_scale = win->phy->scl ? FRAC_16_16(8, 1) : int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
...@@ -643,11 +642,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane, ...@@ -643,11 +642,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
if (WARN_ON(!crtc_state)) if (WARN_ON(!crtc_state))
return -EINVAL; return -EINVAL;
if (crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
if (ret) if (ret)
......
...@@ -211,7 +211,6 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane, ...@@ -211,7 +211,6 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
struct drm_crtc *crtc = state->crtc; struct drm_crtc *crtc = state->crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int min_scale, max_scale; int min_scale, max_scale;
struct drm_rect clip = {};
if (!crtc) if (!crtc)
return 0; return 0;
...@@ -220,10 +219,6 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane, ...@@ -220,10 +219,6 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
if (WARN_ON(!crtc_state)) if (WARN_ON(!crtc_state))
return -EINVAL; return -EINVAL;
if (crtc_state->enable)
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
min_scale = DRM_PLANE_HELPER_NO_SCALING; min_scale = DRM_PLANE_HELPER_NO_SCALING;
max_scale = DRM_PLANE_HELPER_NO_SCALING; max_scale = DRM_PLANE_HELPER_NO_SCALING;
...@@ -232,7 +227,7 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane, ...@@ -232,7 +227,7 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
max_scale = SUN8I_UI_SCALER_SCALE_MAX; max_scale = SUN8I_UI_SCALER_SCALE_MAX;
} }
return drm_atomic_helper_check_plane_state(state, crtc_state, &clip, return drm_atomic_helper_check_plane_state(state, crtc_state,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
} }
......
...@@ -239,7 +239,6 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane, ...@@ -239,7 +239,6 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
struct drm_crtc *crtc = state->crtc; struct drm_crtc *crtc = state->crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int min_scale, max_scale; int min_scale, max_scale;
struct drm_rect clip = {};
if (!crtc) if (!crtc)
return 0; return 0;
...@@ -248,10 +247,6 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane, ...@@ -248,10 +247,6 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
if (WARN_ON(!crtc_state)) if (WARN_ON(!crtc_state))
return -EINVAL; return -EINVAL;
if (crtc_state->enable)
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
min_scale = DRM_PLANE_HELPER_NO_SCALING; min_scale = DRM_PLANE_HELPER_NO_SCALING;
max_scale = DRM_PLANE_HELPER_NO_SCALING; max_scale = DRM_PLANE_HELPER_NO_SCALING;
...@@ -260,7 +255,7 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane, ...@@ -260,7 +255,7 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
max_scale = SUN8I_VI_SCALER_SCALE_MAX; max_scale = SUN8I_VI_SCALER_SCALE_MAX;
} }
return drm_atomic_helper_check_plane_state(state, crtc_state, &clip, return drm_atomic_helper_check_plane_state(state, crtc_state,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
} }
......
...@@ -82,7 +82,6 @@ int tegra_plane_state_add(struct tegra_plane *plane, ...@@ -82,7 +82,6 @@ int tegra_plane_state_add(struct tegra_plane *plane,
{ {
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct tegra_dc_state *tegra; struct tegra_dc_state *tegra;
struct drm_rect clip = {};
int err; int err;
/* Propagate errors from allocation or locking failures. */ /* Propagate errors from allocation or locking failures. */
...@@ -90,12 +89,8 @@ int tegra_plane_state_add(struct tegra_plane *plane, ...@@ -90,12 +89,8 @@ int tegra_plane_state_add(struct tegra_plane *plane,
if (IS_ERR(crtc_state)) if (IS_ERR(crtc_state))
return PTR_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 */ /* 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); 0, INT_MAX, true, true);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -443,17 +443,12 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, ...@@ -443,17 +443,12 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
{ {
struct drm_crtc_state *crtc_state = NULL; struct drm_crtc_state *crtc_state = NULL;
struct drm_framebuffer *new_fb = state->fb; struct drm_framebuffer *new_fb = state->fb;
struct drm_rect clip = {};
int ret; int ret;
if (state->crtc) if (state->crtc)
crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc); crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
if (crtc_state && crtc_state->enable) ret = drm_atomic_helper_check_plane_state(state, crtc_state,
drm_mode_get_hv_timing(&crtc_state->mode,
&clip.x2, &clip.y2);
ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
false, true); false, true);
......
...@@ -55,7 +55,6 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane, ...@@ -55,7 +55,6 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct drm_crtc *crtc = plane_state->crtc; struct drm_crtc *crtc = plane_state->crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = {};
int min_scale = FRAC_16_16(1, 8); int min_scale = FRAC_16_16(1, 8);
int max_scale = FRAC_16_16(8, 1); int max_scale = FRAC_16_16(8, 1);
...@@ -75,12 +74,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane, ...@@ -75,12 +74,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
if (!plane_state->crtc) if (!plane_state->crtc)
return -EINVAL; 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, return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
&clip, min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
} }
...@@ -291,7 +286,6 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane, ...@@ -291,7 +286,6 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct drm_crtc *crtc = plane_state->crtc; struct drm_crtc *crtc = plane_state->crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_rect clip = {};
if (!crtc || !fb) if (!crtc || !fb)
return 0; return 0;
...@@ -309,12 +303,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane, ...@@ -309,12 +303,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
if (!plane_state->crtc) if (!plane_state->crtc)
return -EINVAL; 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, return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
&clip,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
false, true); false, true);
......
...@@ -40,7 +40,6 @@ int drm_atomic_helper_check_modeset(struct drm_device *dev, ...@@ -40,7 +40,6 @@ int drm_atomic_helper_check_modeset(struct drm_device *dev,
struct drm_atomic_state *state); struct drm_atomic_state *state);
int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
const struct drm_crtc_state *crtc_state, const struct drm_crtc_state *crtc_state,
const struct drm_rect *clip,
int min_scale, int min_scale,
int max_scale, int max_scale,
bool can_position, bool can_position,
......
...@@ -43,7 +43,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane, ...@@ -43,7 +43,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
struct drm_framebuffer *fb, struct drm_framebuffer *fb,
struct drm_rect *src, struct drm_rect *src,
struct drm_rect *dest, struct drm_rect *dest,
const struct drm_rect *clip,
unsigned int rotation, unsigned int rotation,
int min_scale, int min_scale,
int max_scale, int max_scale,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment