diff options
author | Maxime Ripard <maxime@cerno.tech> | 2021-02-19 13:00:28 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2021-02-24 20:27:12 +0100 |
commit | 41016fe1028e4b0ee6f436f928564699898ec2b0 (patch) | |
tree | f5b02d4590ca44602439a6f44c1dc83bfa8012b0 /drivers/gpu/drm/ast | |
parent | e05162c017e2e14b94dfd4e55d2f006a9a642c6d (diff) | |
download | linux-41016fe1028e4b0ee6f436f928564699898ec2b0.tar.gz linux-41016fe1028e4b0ee6f436f928564699898ec2b0.tar.bz2 linux-41016fe1028e4b0ee6f436f928564699898ec2b0.zip |
drm: Rename plane->state variables in atomic update and disable
Some drivers are storing the plane->state pointer in atomic_update and
atomic_disable in a variable simply called state, while the state passed
as an argument is called old_state.
In order to ease subsequent reworks and to avoid confusing or
inconsistent names, let's rename those variables to new_state.
This was done using the following coccinelle script, plus some manual
changes for mtk and tegra.
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
(
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_update = func,
...,
};
)
@ moves_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *new_state = plane->state;
...
}
@ depends on moves_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
identifier old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
<...
- state
+ new_state
...>
}
@ moves_new_state_oldstate @
identifier plane_atomic_func.func;
identifier plane;
symbol oldstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *oldstate)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *newstate = plane->state;
...
}
@ depends on moves_new_state_oldstate @
identifier plane_atomic_func.func;
identifier plane;
identifier old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
<...
- state
+ newstate
...>
}
@ moves_new_state_old_pstate @
identifier plane_atomic_func.func;
identifier plane;
symbol old_pstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *new_pstate = plane->state;
...
}
@ depends on moves_new_state_old_pstate @
identifier plane_atomic_func.func;
identifier plane;
identifier old_pstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
{
<...
- state
+ new_pstate
...>
}
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.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-8-maxime@cerno.tech
Diffstat (limited to 'drivers/gpu/drm/ast')
-rw-r--r-- | drivers/gpu/drm/ast/ast_mode.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index d3c4a1f6aede..94950e0e338a 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -573,14 +573,14 @@ ast_primary_plane_helper_atomic_update(struct drm_plane *plane, { struct drm_device *dev = plane->dev; struct ast_private *ast = to_ast_private(dev); - struct drm_plane_state *state = plane->state; + struct drm_plane_state *new_state = plane->state; struct drm_gem_vram_object *gbo; s64 gpu_addr; - struct drm_framebuffer *fb = state->fb; + struct drm_framebuffer *fb = new_state->fb; struct drm_framebuffer *old_fb = old_state->fb; if (!old_fb || (fb->format != old_fb->format)) { - struct drm_crtc_state *crtc_state = state->crtc->state; + struct drm_crtc_state *crtc_state = new_state->crtc->state; struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info; @@ -793,9 +793,9 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { struct ast_cursor_plane *ast_cursor_plane = to_ast_cursor_plane(plane); - struct drm_plane_state *state = plane->state; - struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state); - struct drm_framebuffer *fb = state->fb; + struct drm_plane_state *new_state = plane->state; + struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(new_state); + struct drm_framebuffer *fb = new_state->fb; struct ast_private *ast = to_ast_private(plane->dev); struct dma_buf_map dst_map = ast_cursor_plane->hwc[ast_cursor_plane->next_hwc_index].map; @@ -820,7 +820,7 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, ast_update_cursor_image(dst, src, fb->width, fb->height); - if (state->fb != old_state->fb) { + if (new_state->fb != old_state->fb) { ast_set_cursor_base(ast, dst_off); ++ast_cursor_plane->next_hwc_index; @@ -831,25 +831,25 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, * Update location in HWC signature and registers. */ - writel(state->crtc_x, sig + AST_HWC_SIGNATURE_X); - writel(state->crtc_y, sig + AST_HWC_SIGNATURE_Y); + writel(new_state->crtc_x, sig + AST_HWC_SIGNATURE_X); + writel(new_state->crtc_y, sig + AST_HWC_SIGNATURE_Y); offset_x = AST_MAX_HWC_WIDTH - fb->width; offset_y = AST_MAX_HWC_HEIGHT - fb->height; - if (state->crtc_x < 0) { - x_offset = (-state->crtc_x) + offset_x; + if (new_state->crtc_x < 0) { + x_offset = (-new_state->crtc_x) + offset_x; x = 0; } else { x_offset = offset_x; - x = state->crtc_x; + x = new_state->crtc_x; } - if (state->crtc_y < 0) { - y_offset = (-state->crtc_y) + offset_y; + if (new_state->crtc_y < 0) { + y_offset = (-new_state->crtc_y) + offset_y; y = 0; } else { y_offset = offset_y; - y = state->crtc_y; + y = new_state->crtc_y; } ast_set_cursor_location(ast, x, y, x_offset, y_offset); |