Star64_linux/drivers/gpu/drm
Maxime Ripard 351f950db4
drm/atomic: Pass the full state to CRTC atomic enable/disable
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.

In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
 {
 	<...
-	FUNCS->atomic_disable(crtc, crtc_state);
+	FUNCS->atomic_disable(crtc, state);
 	...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
 {
 	<...
-	FUNCS->atomic_enable(crtc, crtc_state);
+	FUNCS->atomic_enable(crtc, state);
 	...>
 }

@@
identifier crtc, old_state;
@@

 struct drm_crtc_helper_funcs {
	...
-	void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+	void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
	...
-	void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+	void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
	...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_enable = func,
	...,
};
|
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_disable = func,
	...,
};
)

@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc,
		struct drm_crtc_state *old_state)
{
	... when != old_state
}

@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+	struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
	...
}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

void func(...)
{
	...
-	T state = E;
+	T crtc_state = E;
	<+...
-	state
+	crtc_state
	...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

void func(...)
{
	...
-	T state;
+	T crtc_state;
	<+...
-	state
+	crtc_state
	...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@

void func(struct drm_crtc *crtc,
-	       struct drm_crtc_state *old_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/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-09 09:55:59 +02:00
..
amd drm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3 2020-10-07 13:53:08 +02:00
arc drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
arm drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
armada drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
aspeed drm: aspeed: Fix GENMASK misuse 2020-10-09 18:16:34 +10:30
ast drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
atmel-hlcdc drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
bochs
bridge
etnaviv
exynos drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
fsl-dcu drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
gma500
hisilicon drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
i2c
i810
i915
imx drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
ingenic drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
lib
lima
mcde
mediatek drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
meson drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
mga
mgag200
msm drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
mxsfb drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
nouveau drm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3 2020-10-07 13:53:08 +02:00
omapdrm drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
panel
panfrost drm/panfrost: Fix job timeout handling 2020-10-08 10:52:02 +01:00
pl111
qxl drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
r128
radeon drm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3 2020-10-07 13:53:08 +02:00
rcar-du drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
rockchip drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
savage
scheduler
selftests
shmobile
sis
sti drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
stm drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
sun4i drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
tdfx
tegra drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
tidss drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
tilcdc drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
tiny
ttm drm/ttm: move ttm_set_memory.h out of include 2020-10-07 14:10:18 +02:00
tve200
udl
v3d
vboxvideo drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
vc4 drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
vgem
via
virtio drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
vkms drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
vmwgfx drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
xen
xlnx drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
zte drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
drm_agpsupport.c
drm_atomic.c drm/atomic: document and enforce rules around "spurious" EBUSY 2020-10-08 11:30:03 +02:00
drm_atomic_helper.c drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
drm_atomic_state_helper.c
drm_atomic_uapi.c
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bridge_connector.c
drm_bufs.c
drm_cache.c
drm_client.c
drm_client_modeset.c
drm_color_mgmt.c
drm_connector.c
drm_context.c
drm_crtc.c
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c
drm_debugfs_crc.c
drm_dma.c
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c
drm_dp_mst_topology.c
drm_dp_mst_topology_internal.h
drm_drv.c
drm_dsc.c
drm_dumb_buffers.c
drm_edid.c
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb-helper: Add locking to sysrq handling 2020-10-08 11:29:33 +02:00
drm_file.c
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c
drm_framebuffer.c
drm_gem.c
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm/vram_helper: implement a ttm move callback. 2020-10-07 15:41:58 +10:00
drm_hashtab.c
drm_hdcp.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_irq.c
drm_kms_helper_common.c
drm_lease.c
drm_legacy.h
drm_legacy_misc.c
drm_lock.c
drm_managed.c
drm_memory.c
drm_mipi_dbi.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_panel.c
drm_panel_orientation_quirks.c
drm_pci.c
drm_plane.c
drm_plane_helper.c
drm_prime.c
drm_print.c
drm_probe_helper.c
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 CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
drm_syncobj.c
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c
drm_vm.c
drm_vma_manager.c
drm_writeback.c
Kconfig
Makefile