linux/drivers/gpu/drm/rcar-du
Maxime Ripard 37418bf14c
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ä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20210219120032.260676-1-maxime@cerno.tech
2021-02-25 08:05:28 +01:00
..
Kconfig drm: rcar-du: Update description for DRM_RCAR_DW_HDMI Kconfig entry 2020-09-22 14:10:05 +03:00
Makefile drm: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
rcar_cmm.c drm: rcar-du: Fix PM reference leak in rcar_cmm_enable() 2021-01-05 07:19:49 +02:00
rcar_cmm.h drm: rcar-du: Add support for CMM 2019-12-18 02:40:03 +02:00
rcar_du_crtc.c - Add default modes for connectors in unknown state 2021-01-07 13:02:57 +01:00
rcar_du_crtc.h drm: rcar-du: kms: Initialize CMM instances 2019-12-18 02:40:04 +02:00
rcar_du_drv.c drm: rcar-du: Replace dev_private with container_of 2021-01-05 07:20:04 +02:00
rcar_du_drv.h drm: rcar-du: Replace dev_private with container_of 2021-01-05 07:20:04 +02:00
rcar_du_encoder.c drm: rcar-du: Drop local encoder variable 2021-01-05 07:20:10 +02:00
rcar_du_encoder.h drm: rcar-du: Drop local encoder variable 2021-01-05 07:20:10 +02:00
rcar_du_group.c drm: rcar-du: crtc: Control CMM operations 2019-12-18 02:40:05 +02:00
rcar_du_group.h drm: rcar-du: kms: Initialize CMM instances 2019-12-18 02:40:04 +02:00
rcar_du_kms.c drm: rcar-du: Fix leak of CMM platform device reference 2021-01-05 07:20:13 +02:00
rcar_du_kms.h drm: rcar-du: Fix pitch handling for fully planar YUV formats 2020-09-22 14:10:05 +03:00
rcar_du_of.c
rcar_du_of.h drm: rcar-du: Fix rcar_du_of_init() stub 2018-05-17 15:03:32 +10:00
rcar_du_of_lvds_r8a7790.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7791.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7793.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7795.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_of_lvds_r8a7796.dts drm: rcar-du: Convert live DT patches to sugar syntax 2019-01-14 03:51:17 +02:00
rcar_du_plane.c drm: Use state helper instead of the plane state pointer 2021-02-25 08:05:28 +01:00
rcar_du_plane.h drm: rcar-du: Remove inclusion of drmP.h 2019-01-14 03:51:33 +02:00
rcar_du_regs.h drm: rcar-du: crtc: Control CMM operations 2019-12-18 02:40:05 +02:00
rcar_du_vsp.c drm: Use state helper instead of the plane state pointer 2021-02-25 08:05:28 +01:00
rcar_du_vsp.h drm: rcar-du: vsp: Extract framebuffer (un)mapping to separate functions 2019-03-18 17:24:46 +02:00
rcar_du_writeback.c drm: rcar-du: Embed drm_device in rcar_du_device 2021-01-05 07:20:03 +02:00
rcar_du_writeback.h drm: rcar-du: Add writeback support for R-Car Gen3 2019-03-18 17:24:51 +02:00
rcar_dw_hdmi.c drm: bridge: dw-hdmi: Pass drm_display_info to .mode_valid() 2020-06-23 19:56:02 +02:00
rcar_lvds.c drm: rcar-du: lvds: Add support for R8A774E1 SoC 2020-09-22 14:10:04 +03:00
rcar_lvds.h drm: rcar-du: lvds: Add support for dual-link mode 2019-06-08 02:36:04 +03:00
rcar_lvds_regs.h drm: rcar-du: lvds: D3/E3 support 2018-09-25 00:40:56 +03:00