diff options
author | Maxime Ripard <maxime@cerno.tech> | 2021-02-19 15:00:22 +0300 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2021-02-24 22:26:55 +0300 |
commit | ba5c1649465d40a0557e67bc9819ef687a7d99f4 (patch) | |
tree | 268bd15db250c5485611fd8f5db1d2398a740823 /drivers/gpu/drm/rockchip/rockchip_drm_vop.c | |
parent | 5ddb0bd4ddc35d9c9376d109398f84277bb8d25e (diff) | |
download | linux-ba5c1649465d40a0557e67bc9819ef687a7d99f4.tar.xz |
drm: Rename plane atomic_check state names
Most drivers call the argument to the plane atomic_check hook simply
state, which is going to conflict with the global atomic state in a
later rework. Let's rename it to new_plane_state (or new_state depending
on the convention used in the driver).
This was done using the coccinelle script below, and built tested:
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
static const struct drm_plane_helper_funcs helpers = {
.atomic_check = func,
};
@ has_old_state @
identifier plane_atomic_func.func;
identifier plane;
expression e;
symbol old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *state)
{
...
struct drm_plane_state *old_state = e;
...
}
@ depends on has_old_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *state
+ struct drm_plane_state *new_state
)
{
<+...
- state
+ new_state
...+>
}
@ has_state @
identifier plane_atomic_func.func;
identifier plane;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *state)
{
...
}
@ depends on has_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *state
+ struct drm_plane_state *new_plane_state
)
{
<+...
- state
+ new_plane_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-2-maxime@cerno.tech
Diffstat (limited to 'drivers/gpu/drm/rockchip/rockchip_drm_vop.c')
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index e09d480c91d7..db8cd3cdeece 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -779,11 +779,11 @@ static bool rockchip_mod_supported(struct drm_plane *plane, } static int vop_plane_atomic_check(struct drm_plane *plane, - struct drm_plane_state *state) + struct drm_plane_state *new_plane_state) { - struct drm_crtc *crtc = state->crtc; + struct drm_crtc *crtc = new_plane_state->crtc; struct drm_crtc_state *crtc_state; - struct drm_framebuffer *fb = state->fb; + struct drm_framebuffer *fb = new_plane_state->fb; struct vop_win *vop_win = to_vop_win(plane); const struct vop_win_data *win = vop_win->data; int ret; @@ -795,17 +795,18 @@ 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(state->state, crtc); + crtc_state = drm_atomic_get_existing_crtc_state(new_plane_state->state, + crtc); if (WARN_ON(!crtc_state)) return -EINVAL; - ret = drm_atomic_helper_check_plane_state(state, crtc_state, + ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, min_scale, max_scale, true, true); if (ret) return ret; - if (!state->visible) + if (!new_plane_state->visible) return 0; ret = vop_convert_format(fb->format->format); @@ -816,12 +817,12 @@ static int vop_plane_atomic_check(struct drm_plane *plane, * Src.x1 can be odd when do clip, but yuv plane start point * need align with 2 pixel. */ - if (fb->format->is_yuv && ((state->src.x1 >> 16) % 2)) { + if (fb->format->is_yuv && ((new_plane_state->src.x1 >> 16) % 2)) { DRM_ERROR("Invalid Source: Yuv format not support odd xpos\n"); return -EINVAL; } - if (fb->format->is_yuv && state->rotation & DRM_MODE_REFLECT_Y) { + if (fb->format->is_yuv && new_plane_state->rotation & DRM_MODE_REFLECT_Y) { DRM_ERROR("Invalid Source: Yuv format does not support this rotation\n"); return -EINVAL; } @@ -838,14 +839,16 @@ static int vop_plane_atomic_check(struct drm_plane *plane, if (ret < 0) return ret; - if (state->src.x1 || state->src.y1) { - DRM_ERROR("AFBC does not support offset display, xpos=%d, ypos=%d, offset=%d\n", state->src.x1, state->src.y1, fb->offsets[0]); + if (new_plane_state->src.x1 || new_plane_state->src.y1) { + DRM_ERROR("AFBC does not support offset display, xpos=%d, ypos=%d, offset=%d\n", + new_plane_state->src.x1, + new_plane_state->src.y1, fb->offsets[0]); return -EINVAL; } - if (state->rotation && state->rotation != DRM_MODE_ROTATE_0) { + if (new_plane_state->rotation && new_plane_state->rotation != DRM_MODE_ROTATE_0) { DRM_ERROR("No rotation support in AFBC, rotation=%d\n", - state->rotation); + new_plane_state->rotation); return -EINVAL; } } |