linux/drivers/gpu/drm
Maxime Ripard 977697e20b
drm/atomic: Pass the full state to planes atomic disable and update
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Let's convert the remaining helpers to provide a consistent interface,
this time with the planes atomic_update and atomic_disable.

The conversion was done using the coccinelle script below, built tested on
all the drivers.

@@
identifier plane, plane_state;
symbol state;
@@

 struct drm_plane_helper_funcs {
 	...
	void (*atomic_update)(struct drm_plane *plane,
-			      struct drm_plane_state *plane_state);
+			      struct drm_atomic_state *state);
 	...
 }

@@
identifier plane, plane_state;
symbol state;
@@

 struct drm_plane_helper_funcs {
	...
	void (*atomic_disable)(struct drm_plane *plane,
-			       struct drm_plane_state *plane_state);
+			       struct drm_atomic_state *state);
	...
 }

@ plane_atomic_func @
identifier helpers;
identifier func;
@@

(
 static const struct drm_plane_helper_funcs helpers = {
 	...,
 	.atomic_update = func,
	...,
 };
|
 static const struct drm_plane_helper_funcs helpers = {
 	...,
 	.atomic_disable = func,
	...,
 };
)

@@
struct drm_plane_helper_funcs *FUNCS;
identifier f;
identifier crtc_state;
identifier plane, plane_state, state;
expression e;
@@

 f(struct drm_crtc_state *crtc_state)
 {
 	...
 	struct drm_atomic_state *state = e;
 	<+...
(
-	FUNCS->atomic_disable(plane, plane_state)
+	FUNCS->atomic_disable(plane, state)
|
-	FUNCS->atomic_update(plane, plane_state)
+	FUNCS->atomic_update(plane, state)
)
 	...+>
 }

@@
identifier plane_atomic_func.func;
identifier plane;
symbol state;
@@

 func(struct drm_plane *plane,
-    struct drm_plane_state *state)
+    struct drm_plane_state *old_plane_state)
 {
	<...
-	state
+	old_plane_state
	...>
 }

@ ignores_old_state @
identifier plane_atomic_func.func;
identifier plane, old_state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *old_state)
 {
	... when != old_state
 }

@ adds_old_state depends on plane_atomic_func && !ignores_old_state @
identifier plane_atomic_func.func;
identifier plane, plane_state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *plane_state)
 {
+	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
 	...
 }

@ depends on plane_atomic_func @
identifier plane_atomic_func.func;
identifier plane, plane_state;
@@

 func(struct drm_plane *plane,
-     struct drm_plane_state *plane_state
+     struct drm_atomic_state *state
     )
 { ... }

@ include depends on adds_old_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_old_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

@@
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_old_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-9-maxime@cerno.tech
2021-02-25 08:05:28 +01:00
..
amd drm: Use the state pointer directly in planes atomic_check 2021-02-24 20:27:03 +01:00
arc drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
arm drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
armada drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
aspeed drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
ast drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
atmel-hlcdc drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
bochs drm/bochs: Remove references to struct drm_device.pdev 2021-01-06 15:42:55 +01:00
bridge drm: use getter/setter functions 2021-02-10 14:10:59 +01:00
etnaviv drm/scheduler: provide scheduler score externally 2021-02-05 10:47:11 +01:00
exynos drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
fsl-dcu drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
gma500 drm/gma500: Never wait for blits 2021-02-09 13:07:44 +01:00
hisilicon drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
i2c
i810
i915 drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
imx drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
ingenic drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
kmb drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
lib
lima drm/lima: add governor data with pre-defined thresholds 2021-02-07 20:55:08 +08:00
mcde drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
mediatek drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
meson drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
mga drm/mga/mga_ioc32: Fix some formatting issues in 'mga_compat_ioctl's header 2021-01-18 15:41:12 +01:00
mgag200 drm/mgag200: Move vmap out of commit tail 2021-02-08 13:00:26 +01:00
msm drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
mxsfb drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
nouveau drm/atomic: Pass the full state to planes atomic_check 2021-02-24 20:27:00 +01:00
omapdrm drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
panel drm: use getter/setter functions 2021-02-10 14:10:59 +01:00
panfrost drm/panfrost: Stay in the threaded MMU IRQ handler until we've handled all IRQs 2021-02-15 09:43:33 +01:00
pl111 drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
qxl drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
r128 drm/r128/r128_ioc32: Fix formatting issues in 'r128_compat_ioctl()'s header 2021-01-18 15:41:04 +01:00
radeon drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
rcar-du drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
rockchip drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
savage
scheduler drm/scheduler: provide scheduler score externally 2021-02-05 10:47:11 +01:00
selftests
shmobile
sis
sti drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
stm drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
sun4i drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
tdfx drm: Constify drm_driver in drivers that don't modify it 2021-01-05 07:20:36 +02:00
tegra drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
tidss drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
tilcdc drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
tiny drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
ttm drm/ttm: drop sysfs directory 2021-02-09 17:28:01 +01:00
tve200 drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
udl drm/udl: Move vmap out of commit tail 2021-02-08 13:00:51 +01:00
v3d drm/scheduler: provide scheduler score externally 2021-02-05 10:47:11 +01:00
vboxvideo drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
vc4 drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
vgem drm/prime: split array import functions v4 2020-11-30 15:00:45 +01:00
via
virtio drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
vkms drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
vmwgfx drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
xen drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
xlnx drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
zte drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
drm_agpsupport.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_atomic_helper.c drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
drm_atomic_state_helper.c
drm_atomic_uapi.c
drm_atomic.c drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
drm_auth.c
drm_blend.c drm/doc: introduce new section for standard plane properties 2020-12-17 16:56:40 +01:00
drm_bridge_connector.c
drm_bridge.c
drm_bufs.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_cache.c drm: Include <linux/mem_encrypt.h> in drm_cache.c 2021-01-14 09:42:31 +01:00
drm_client_modeset.c drm: replace drm_modeset_lock_all() in drm_client_modeset_dpms_legacy() 2021-02-02 16:01:40 +01:00
drm_client.c
drm_color_mgmt.c drm: add legacy support for using degamma for gamma 2020-12-15 15:46:03 +02:00
drm_connector.c
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h
drm_crtc.c drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
drm_damage_helper.c
drm_debugfs_crc.c
drm_debugfs.c
drm_dma.c
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm/drm_dp_helper: Fix spelling issue and add missing description for 'enable_frl_ready_hpd' 2021-01-18 15:49:57 +01:00
drm_dp_mst_topology_internal.h
drm_dp_mst_topology.c drm/dp_mst: Set CLEAR_PAYLOAD_ID_TABLE as broadcast 2021-02-24 13:10:17 -05:00
drm_drv.c drm/drv: Remove initialization of static variables 2021-02-21 19:49:17 -05:00
drm_dsc.c drm/dsc: add helper for calculating rc buffer size from DPCD 2020-12-10 10:49:47 +02:00
drm_dumb_buffers.c drm: Don't export the drm_gem_dumb_destroy() function 2021-01-05 07:20:25 +02:00
drm_edid_load.c
drm_edid.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_encoder_slave.c
drm_encoder.c drm: add drmm_encoder_alloc() 2021-01-04 12:59:33 +01:00
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb-helper: Add a FIXME that generic_setup is very confusing 2020-12-22 12:17:37 +01:00
drm_file.c drm/drm_vblank: set the dma-fence timestamp during send_vblank_event 2021-01-22 16:22:29 +05:30
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c
drm_framebuffer.c drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
drm_gem_atomic_helper.c drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
drm_gem_cma_helper.c drm/cma-helper: Implement mmap as GEM CMA object functions 2020-11-30 13:38:27 +01:00
drm_gem_framebuffer_helper.c drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
drm_gem_shmem_helper.c
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers 2021-02-23 08:54:22 +01:00
drm_gem.c drm/gem: Export drm_gem_vmap() and drm_gem_vunmap() 2021-02-08 13:00:06 +01:00
drm_hashtab.c
drm_hdcp.c
drm_internal.h drm: Don't export the drm_gem_dumb_destroy() function 2021-01-05 07:20:25 +02:00
drm_ioc32.c
drm_ioctl.c
drm_irq.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_kms_helper_common.c
drm_lease.c
drm_legacy_misc.c
drm_legacy.h drm: Merge CONFIG_DRM_VM into CONFIG_DRM_LEGACY 2021-01-13 14:22:37 +01:00
drm_lock.c
drm_managed.c
drm_memory.c drm: Implement drm_need_swiotlb() in drm_cache.c 2021-01-13 14:22:29 +01:00
drm_mipi_dbi.c drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c drm-misc-next for v5.12: 2021-01-07 13:40:20 +01:00
drm_mode_object.c
drm_modes.c drm/modes: Switch to 64bit maths to avoid integer overflow 2021-01-14 19:37:53 +02:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_panel_orientation_quirks.c drm: Added orientation quirk for OneGX1 Pro 2021-01-20 22:33:01 +01:00
drm_panel.c
drm_pci.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_plane_helper.c
drm_plane.c drm: Switch to %p4cc format modifier 2021-02-17 12:52:59 +01:00
drm_prime.c drm: Set vm_ops to GEM object's values during mmap 2021-01-18 10:37:26 +01:00
drm_print.c
drm_probe_helper.c drm: Add default modes for connectors in unknown state 2021-01-05 07:19:50 +02:00
drm_property.c
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
drm_syncobj.c drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT v3 2021-01-20 15:05:45 +01:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank_work.c
drm_vblank.c drm/vblank: Document drm_crtc_vblank_restore constraints 2021-02-10 12:38:55 +01:00
drm_vm.c drm: Upcast struct drm_device.dev to struct pci_device; replace pdev 2021-01-19 09:06:38 +01:00
drm_vma_manager.c
drm_writeback.c
Kconfig drm: Merge CONFIG_DRM_VM into CONFIG_DRM_LEGACY 2021-01-13 14:22:37 +01:00
Makefile drm: Add additional atomic helpers for shadow-buffered planes 2021-02-08 13:00:14 +01:00