drm: Use the state pointer directly in planes atomic_check
Now that atomic_check takes the global atomic state as a parameter, we don't need to go through the pointer in the plane state. This was done using the following coccinelle script: @ plane_atomic_func @ identifier helpers; identifier func; @@ static struct drm_plane_helper_funcs helpers = { ..., .atomic_check = func, ..., }; @@ identifier plane_atomic_func.func; identifier plane, state; identifier plane_state; @@ func(struct drm_plane *plane, struct drm_atomic_state *state) { ... - struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane); <... when != plane_state - plane_state->state + state ...> } @@ identifier plane_atomic_func.func; identifier plane, state; identifier plane_state; @@ func(struct drm_plane *plane, struct drm_atomic_state *state) { ... struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane); <... - plane_state->state + state ...> } Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-5-maxime@cerno.tech
This commit is contained in:
parent
7c11b99a8e
commit
dec9202067
@ -6451,7 +6451,7 @@ static int dm_plane_atomic_check(struct drm_plane *plane,
|
||||
return 0;
|
||||
|
||||
new_crtc_state =
|
||||
drm_atomic_get_new_crtc_state(new_plane_state->state,
|
||||
drm_atomic_get_new_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (!new_crtc_state)
|
||||
return -EINVAL;
|
||||
|
@ -84,7 +84,7 @@ komeda_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc || !new_plane_state->fb)
|
||||
return 0;
|
||||
|
||||
crtc_st = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_st = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_st) || !crtc_st->enable) {
|
||||
DRM_DEBUG_ATOMIC("Cannot update plane on a disabled CRTC.\n");
|
||||
|
@ -244,7 +244,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for_each_new_crtc_in_state(new_plane_state->state, crtc, crtc_state,
|
||||
for_each_new_crtc_in_state(state, crtc, crtc_state,
|
||||
i) {
|
||||
/* we cannot disable the plane while the CRTC is active */
|
||||
if (!new_plane_state->fb && crtc_state->active)
|
||||
|
@ -121,8 +121,8 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (new_plane_state->state)
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
if (state)
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
else
|
||||
crtc_state = crtc->state;
|
||||
|
@ -547,7 +547,7 @@ static int ast_primary_plane_helper_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_new_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
|
||||
@ -769,7 +769,7 @@ static int ast_cursor_plane_helper_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_new_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
|
||||
|
@ -609,7 +609,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
if (!hstate->base.crtc || WARN_ON(!fb))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(s->state, s->crtc);
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state, s->crtc);
|
||||
mode = &crtc_state->adjusted_mode;
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(s, crtc_state,
|
||||
|
@ -186,7 +186,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
|
||||
int ret;
|
||||
|
||||
pipe = container_of(plane, struct drm_simple_display_pipe, plane);
|
||||
crtc_state = drm_atomic_get_new_crtc_state(plane_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
&pipe->crtc);
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
|
||||
|
@ -66,7 +66,7 @@ static int hibmc_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc || !fb)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
|
@ -781,7 +781,7 @@ static int ade_plane_atomic_check(struct drm_plane *plane,
|
||||
if (fmt == ADE_FORMAT_UNSUPPORT)
|
||||
return -EINVAL;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
|
@ -157,7 +157,7 @@ static int dcss_plane_atomic_check(struct drm_plane *plane,
|
||||
cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
|
||||
WARN_ON(!cma_obj);
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
|
||||
hdisplay = crtc_state->adjusted_mode.hdisplay;
|
||||
|
@ -358,7 +358,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
|
||||
crtc_state =
|
||||
drm_atomic_get_existing_crtc_state(new_state->state,
|
||||
drm_atomic_get_existing_crtc_state(state,
|
||||
new_state->crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -372,7 +372,7 @@ static int ingenic_drm_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -526,7 +526,7 @@ static int ingenic_ipu_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -100,7 +100,7 @@ static int kmb_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
|
||||
crtc_state =
|
||||
drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
drm_atomic_get_existing_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
return drm_atomic_helper_check_plane_state(new_plane_state,
|
||||
crtc_state,
|
||||
|
@ -160,7 +160,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -174,7 +174,7 @@ static int meson_overlay_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -80,7 +80,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -964,7 +964,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
|
||||
uint32_t min_src_size, max_linewidth;
|
||||
|
||||
if (new_plane_state->crtc)
|
||||
crtc_state = drm_atomic_get_new_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
|
||||
min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxupscale);
|
||||
|
@ -415,7 +415,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -409,7 +409,7 @@ static int mxsfb_plane_atomic_check(struct drm_plane *plane,
|
||||
struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(plane->dev);
|
||||
struct drm_crtc_state *crtc_state;
|
||||
|
||||
crtc_state = drm_atomic_get_new_crtc_state(plane_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
&mxsfb->crtc);
|
||||
|
||||
return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
|
||||
|
@ -112,7 +112,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
|
||||
if (WARN_ON(!new_plane_state->crtc))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
/* we should have a crtc state if the plane is attached to a crtc */
|
||||
if (WARN_ON(!crtc_state))
|
||||
|
@ -797,7 +797,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc || WARN_ON(!fb))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -198,7 +198,7 @@ static int sti_cursor_atomic_check(struct drm_plane *drm_plane,
|
||||
if (!crtc || !fb)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
mode = &crtc_state->mode;
|
||||
dst_x = new_plane_state->crtc_x;
|
||||
dst_y = new_plane_state->crtc_y;
|
||||
|
@ -635,7 +635,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
|
||||
return 0;
|
||||
|
||||
mixer = to_sti_mixer(crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
mode = &crtc_state->mode;
|
||||
dst_x = new_plane_state->crtc_x;
|
||||
dst_y = new_plane_state->crtc_y;
|
||||
|
@ -1034,7 +1034,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
|
||||
if (!crtc || !fb)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state, crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
mode = &crtc_state->mode;
|
||||
dst_x = new_plane_state->crtc_x;
|
||||
dst_y = new_plane_state->crtc_y;
|
||||
|
@ -269,7 +269,7 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -373,7 +373,7 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
@ -44,7 +44,7 @@ static int tidss_plane_atomic_check(struct drm_plane *plane,
|
||||
return 0;
|
||||
}
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -41,7 +41,7 @@ static int tilcdc_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(new_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
new_state->crtc);
|
||||
/* we should have a crtc state if the plane is attached to a crtc */
|
||||
if (WARN_ON(!crtc_state))
|
||||
|
@ -260,8 +260,8 @@ static int vbox_primary_atomic_check(struct drm_plane *plane,
|
||||
struct drm_crtc_state *crtc_state = NULL;
|
||||
|
||||
if (new_state->crtc) {
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(
|
||||
new_state->state, new_state->crtc);
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
new_state->crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -338,8 +338,8 @@ static int vbox_cursor_atomic_check(struct drm_plane *plane,
|
||||
int ret;
|
||||
|
||||
if (new_state->crtc) {
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(
|
||||
new_state->state, new_state->crtc);
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
new_state->crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -126,7 +126,7 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
crtc_state = drm_atomic_get_crtc_state(state,
|
||||
new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
@ -446,7 +446,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
|
||||
int ret;
|
||||
|
||||
if (new_state->crtc)
|
||||
crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
new_state->crtc);
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
|
||||
|
@ -1152,8 +1152,7 @@ zynqmp_disp_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!new_plane_state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(new_plane_state->state,
|
||||
new_plane_state->crtc);
|
||||
crtc_state = drm_atomic_get_crtc_state(state, new_plane_state->crtc);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
|
@ -59,7 +59,7 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc || WARN_ON(!fb))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
@ -288,7 +288,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
|
||||
if (!crtc || WARN_ON(!fb))
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state,
|
||||
crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user