linux-stable/drivers/gpu/drm
Maxime Ripard f6ebe9f9c9
drm/atomic: Pass the full state to CRTC atomic begin and flush
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 start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.

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 old_crtc_state, old_state;
identifier crtc;
identifier f;
@@

 f(struct drm_crtc_state *old_crtc_state)
 {
	...
 	struct drm_atomic_state *old_state = old_crtc_state->state;
	<...
-	FUNCS->atomic_begin(crtc, old_crtc_state);
+	FUNCS->atomic_begin(crtc, old_state);
	...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@

 f(struct drm_crtc_state *old_crtc_state)
 {
	...
 	struct drm_atomic_state *old_state = old_crtc_state->state;
	<...
-	FUNCS->atomic_flush(crtc, old_crtc_state);
+	FUNCS->atomic_flush(crtc, old_state);
	...>
 }

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

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

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

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

@@
identifier crtc, old_state;
@@

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

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_begin = func,
	...,
};
|
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_flush = 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
	...+>

}

@@
identifier old_state;
identifier crtc;
@@

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

@@
identifier old_state;
identifier crtc;
@@

 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
-			   struct drm_crtc_state *old_state
+			   struct drm_atomic_state *state
			   );

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-			   struct drm_crtc_state *old_state
+			   struct drm_atomic_state *state
			   )
{
	...
}

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-			   struct drm_crtc_state *old_state
+			   struct drm_atomic_state *state
			   );

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-			   struct drm_crtc_state *old_state
+			   struct drm_atomic_state *state
			   )
{
	...
}

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-			   struct drm_crtc_state *old_state
+			   struct drm_atomic_state *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>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
2020-11-02 12:37:49 +01:00
..
amd drm/atomic: Pass the full state to CRTC atomic_check 2020-11-02 12:34:49 +01: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 begin and flush 2020-11-02 12:37:49 +01:00
armada drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
aspeed drm/aspeed: Fix Kconfig warning & subsequent build errors 2020-10-12 15:14:33 +10:30
ast drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
atmel-hlcdc drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
bochs Linux 5.8 2020-08-11 11:58:31 +10:00
bridge Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
etnaviv Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
exynos drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
fsl-dcu drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
gma500 drm/gma500: fix double free of gma_connector 2020-10-05 15:52:37 +02:00
hisilicon drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
i2c sound updates for 5.9 2020-08-06 14:27:31 -07:00
i810 drm/i810: make i810_flush_queue() return void 2020-09-11 10:54:17 +02:00
i915 Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
imx drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
ingenic drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
lib
lima drm: lima: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
mcde drm/mcde: Fix handling of platform_get_irq() error 2020-10-17 09:32:56 +02:00
mediatek drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
meson drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
mga
mgag200 drm/mgag200: fix spelling mistake "expeced" -> "expected" 2020-08-27 11:17:52 +02:00
msm drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
mxsfb drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
nouveau drm/atomic: Pass the full state to CRTC atomic_check 2020-11-02 12:34:49 +01:00
omapdrm drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
panel drm/panel: mantix: Fix panel reset 2020-10-23 10:05:17 +02:00
panfrost Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
pl111 drm/pl111: Introduce GEM object functions 2020-09-25 09:21:14 +02:00
qxl drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
r128
radeon Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
rcar-du drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
rockchip drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
savage treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
scheduler Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
selftests drm/mst: Add support for QUERY_STREAM_ENCRYPTION_STATUS MST sideband message 2020-09-01 13:02:33 +05:30
shmobile drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS 2020-06-10 09:05:18 +02:00
sis
sti drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
stm drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
sun4i drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
tdfx
tegra drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
tidss drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
tilcdc drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
tiny drm/mipi-dbi: Remove ->enabled 2020-06-24 09:17:34 +02:00
ttm Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
tve200 drm/tve200: Fix handling of platform_get_irq() error 2020-10-17 09:33:01 +02:00
udl drm/udl: Use GEM vmap/mmap function from SHMEM helpers 2020-06-10 10:17:21 +02:00
v3d drm/v3d: Fix double free in v3d_submit_cl_ioctl() 2020-10-26 11:43:31 +01:00
vboxvideo drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
vc4 drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
vgem drm/vgem: Introduce GEM object functions 2020-09-25 09:21:30 +02:00
via drm/via: reduce no need mutex_lock area 2020-10-17 10:10:24 +02:00
virtio drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
vkms drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
vmwgfx drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
xen Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
xlnx drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
zte drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01: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 begin and flush 2020-11-02 12:37:49 +01:00
drm_atomic_state_helper.c drm/atomic-helper: reset vblank on crtc reset 2020-07-02 20:25:51 +02:00
drm_atomic_uapi.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_auth.c drm/auth: make drm_{set,drop}master_ioctl symmetrical 2020-06-15 14:49:50 +01:00
drm_blend.c
drm_bridge.c drm: bridge: Pass drm_display_info to drm_bridge_funcs .mode_valid() 2020-06-23 19:53:27 +02:00
drm_bridge_connector.c drm/bridge_connector: Set default status connected for eDP connectors 2020-08-26 19:11:41 +02:00
drm_bufs.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
drm_cache.c drm: core: fix common struct sg_table related issues 2020-09-10 08:17:48 +02:00
drm_client.c drm/client: Add drm_client_framebuffer_flush() 2020-05-26 13:31:01 +02:00
drm_client_modeset.c drm: Nuke mode->vrefresh 2020-05-27 14:31:42 +03:00
drm_color_mgmt.c drm/modeset-lock: Take the modeset BKL for legacy drivers 2020-08-17 13:41:50 -04:00
drm_connector.c drm: document that user-space should avoid parsing EDIDs 2020-10-22 13:49:14 +02:00
drm_context.c
drm_crtc.c Linux 5.9-rc2 2020-08-25 11:00:02 +02:00
drm_crtc_helper.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_crtc_helper_internal.h drm/probe_helper: Add drm_connector_helper_funcs.mode_valid_ctx 2020-07-13 13:29:20 -04:00
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c drm/debug: Expose connector VRR monitor range via debugfs 2020-06-25 15:47:14 -07:00
drm_debugfs_crc.c drm/crc-debugfs: Fix memleak in crc_control_write 2020-09-01 09:45:44 +02:00
drm_dma.c
drm_dp_aux_dev.c drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor() 2020-10-15 13:58:54 -04:00
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm/dp: fix kernel-doc warnings at drm_dp_helper.c 2020-10-27 11:20:36 +01:00
drm_dp_mst_topology.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_dp_mst_topology_internal.h
drm_drv.c drm/dev: Remove drm_dev_init 2020-09-21 10:45:08 +02:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c drm: encoder_slave: use new I2C API 2020-06-19 09:20:21 +02:00
drm_fb_cma_helper.c
drm_fb_helper.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_file.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_flip_work.c
drm_format_helper.c drm/format-helper: Add drm_fb_swab() 2020-05-26 13:33:08 +02:00
drm_fourcc.c drm/fourcc: Add AXBXGXRX106106106106 format 2020-10-20 20:51:42 +01:00
drm_framebuffer.c gpu/drm: cleanup coding style a bit 2020-09-09 11:45:18 +02:00
drm_gem.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_gem_cma_helper.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_gem_ttm_helper.c drm/ttm: merge offset and base in ttm_bus_placement 2020-09-08 10:43:30 +02:00
drm_gem_vram_helper.c drm/vram_helpers: drop ttm_page_alloc.h include 2020-10-29 15:57:47 +01:00
drm_hashtab.c
drm_hdcp.c
drm_internal.h drm: Give irq_by_busid drm_legacy_ prefix 2020-10-21 18:05:11 +02:00
drm_ioc32.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_ioctl.c drm: Give irq_by_busid drm_legacy_ prefix 2020-10-21 18:05:11 +02:00
drm_irq.c drm: use drm_dev_has_vblank more 2020-05-29 12:58:11 +02:00
drm_kms_helper_common.c
drm_lease.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_legacy.h
drm_legacy_misc.c
drm_lock.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_managed.c drm/dev: Remove drm_dev_init 2020-09-21 10:45:08 +02:00
drm_memory.c
drm_mipi_dbi.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_mipi_dsi.c drm: mipi-dsi: Convert logging to drm_* functions. 2020-07-10 20:21:45 +02:00
drm_mm.c drm/mm: cleanup and improve next_hole_*_addr() 2020-06-23 15:46:40 +02:00
drm_mode_config.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_mode_object.c drm/modeset-lock: Take the modeset BKL for legacy drivers 2020-08-17 13:41:50 -04:00
drm_modes.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_panel.c drm/panel: Add helper for reading DT rotation 2020-08-16 17:12:18 +02:00
drm_panel_orientation_quirks.c drm: Added orientation quirk for ASUS tablet model T103HAF 2020-08-04 11:45:23 +02:00
drm_pci.c drm: Give irq_by_busid drm_legacy_ prefix 2020-10-21 18:05:11 +02:00
drm_plane.c Linux 5.9-rc2 2020-08-25 11:00:02 +02:00
drm_plane_helper.c
drm_prime.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
drm_print.c
drm_probe_helper.c Merge tag 'drm-intel-next-2020-07-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2020-07-31 14:42:37 +10:00
drm_property.c
drm_rect.c
drm_scatter.c gpu/drm: remove the powerpc hack in drm_legacy_sg_alloc 2020-06-02 10:59:11 -07:00
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm/atomic: Pass the full state to CRTC atomic_check 2020-11-02 12:34:49 +01:00
drm_syncobj.c drm/syncobj: Tune down unordered timeline DRM_ERROR 2020-08-02 15:22:31 +02:00
drm_sysfs.c drm/connector: notify userspace on hotplug after register complete 2020-06-03 10:24:23 +02:00
drm_trace.h
drm_trace_points.c
drm_vblank.c drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() 2020-09-14 22:37:31 +03:00
drm_vblank_work.c This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
drm_vm.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
drm_vma_manager.c
drm_writeback.c
Kconfig drm/ttm: nuke old page allocator 2020-10-29 15:57:57 +01:00
Makefile drm/imx: compile imx directory by default 2020-09-09 16:39:48 +02:00