Skip to content

Commit 37418bf

Browse files
committed
drm: Use state helper instead of the plane state pointer
Many drivers reference the plane->state pointer in order to get the current plane state in their atomic_update or atomic_disable hooks, which would be the new plane state in the global atomic state since _swap_state happened when those hooks are run. Use the drm_atomic_get_new_plane_state helper to get that state to make it more obvious. This was made using the coccinelle script below: @ 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, ..., }; ) @ adds_new_state @ identifier plane_atomic_func.func; identifier plane, state; identifier new_state; @@ func(struct drm_plane *plane, struct drm_atomic_state *state) { ... - struct drm_plane_state *new_state = plane->state; + struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane); ... } @ include depends on adds_new_state @ @@ #include <drm/drm_atomic.h> @ no_include depends on !include && adds_new_state @ @@ + #include <drm/drm_atomic.h> #include <drm/...> Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 977697e commit 37418bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+103
-53
lines changed

drivers/gpu/drm/arc/arcpgu_crtc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
66
*/
77

8+
#include <drm/drm_atomic.h>
89
#include <drm/drm_atomic_helper.h>
910
#include <drm/drm_device.h>
1011
#include <drm/drm_fb_cma_helper.h>
@@ -147,7 +148,8 @@ static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = {
147148
static void arc_pgu_plane_atomic_update(struct drm_plane *plane,
148149
struct drm_atomic_state *state)
149150
{
150-
struct drm_plane_state *new_plane_state = plane->state;
151+
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
152+
plane);
151153
struct arcpgu_drm_private *arcpgu;
152154
struct drm_gem_cma_object *gem;
153155

drivers/gpu/drm/arm/hdlcd_crtc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
262262
static void hdlcd_plane_atomic_update(struct drm_plane *plane,
263263
struct drm_atomic_state *state)
264264
{
265-
struct drm_plane_state *new_plane_state = plane->state;
265+
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
266+
plane);
266267
struct drm_framebuffer *fb = new_plane_state->fb;
267268
struct hdlcd_drm_private *hdlcd;
268269
u32 dest_h;

drivers/gpu/drm/arm/malidp_planes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,8 @@ static void malidp_de_plane_update(struct drm_plane *plane,
797797
plane);
798798
struct malidp_plane *mp;
799799
struct malidp_plane_state *ms = to_malidp_plane_state(plane->state);
800-
struct drm_plane_state *new_state = plane->state;
800+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
801+
plane);
801802
u16 pixel_alpha = new_state->pixel_blend_mode;
802803
u8 plane_alpha = new_state->alpha >> 8;
803804
u32 src_w, src_h, dest_w, dest_h, val;

drivers/gpu/drm/armada/armada_overlay.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
7070
{
7171
struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
7272
plane);
73-
struct drm_plane_state *new_state = plane->state;
73+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
74+
plane);
7475
struct armada_crtc *dcrtc;
7576
struct armada_regs *regs;
7677
unsigned int idx;

drivers/gpu/drm/armada/armada_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ static void armada_drm_primary_plane_atomic_update(struct drm_plane *plane,
165165
{
166166
struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
167167
plane);
168-
struct drm_plane_state *new_state = plane->state;
168+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
169+
plane);
169170
struct armada_crtc *dcrtc;
170171
struct armada_regs *regs;
171172
u32 cfg, cfg_mask, val;

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
575575
plane);
576576
struct drm_device *dev = plane->dev;
577577
struct ast_private *ast = to_ast_private(dev);
578-
struct drm_plane_state *new_state = plane->state;
578+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
579+
plane);
579580
struct drm_gem_vram_object *gbo;
580581
s64 gpu_addr;
581582
struct drm_framebuffer *fb = new_state->fb;
@@ -797,7 +798,8 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane,
797798
struct ast_cursor_plane *ast_cursor_plane = to_ast_cursor_plane(plane);
798799
struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
799800
plane);
800-
struct drm_plane_state *new_state = plane->state;
801+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
802+
plane);
801803
struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(new_state);
802804
struct drm_framebuffer *fb = new_state->fb;
803805
struct ast_private *ast = to_ast_private(plane->dev);

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
733733
static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p,
734734
struct drm_atomic_state *state)
735735
{
736-
struct drm_plane_state *new_s = p->state;
736+
struct drm_plane_state *new_s = drm_atomic_get_new_plane_state(state,
737+
p);
737738
struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
738739
struct atmel_hlcdc_plane_state *hstate =
739740
drm_plane_state_to_atmel_hlcdc_plane_state(new_s);

drivers/gpu/drm/exynos/exynos_drm_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ static int exynos_plane_atomic_check(struct drm_plane *plane,
254254
static void exynos_plane_atomic_update(struct drm_plane *plane,
255255
struct drm_atomic_state *state)
256256
{
257-
struct drm_plane_state *new_state = plane->state;
257+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
258+
plane);
258259
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(new_state->crtc);
259260
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
260261

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,
8080

8181
{
8282
struct fsl_dcu_drm_device *fsl_dev = plane->dev->dev_private;
83-
struct drm_plane_state *new_state = plane->state;
83+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
84+
plane);
8485
struct drm_framebuffer *fb = plane->state->fb;
8586
struct drm_gem_cma_object *gem;
8687
unsigned int alpha = DCU_LAYER_AB_NONE, bpp;

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ static int hibmc_plane_atomic_check(struct drm_plane *plane,
101101
static void hibmc_plane_atomic_update(struct drm_plane *plane,
102102
struct drm_atomic_state *state)
103103
{
104-
struct drm_plane_state *new_state = plane->state;
104+
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
105+
plane);
105106
u32 reg;
106107
s64 gpu_addr = 0;
107108
u32 line_l;

0 commit comments

Comments
 (0)