linux-stable/drivers/gpu/drm/omapdrm
Maxime Ripard 29b77ad7b9
drm/atomic: Pass the full state to CRTC atomic_check
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_check.

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;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@

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

@@
identifier crtc, new_state;
@@

 struct drm_crtc_helper_funcs {
 	...
-	int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+	int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
 	...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_check = func,
	...,
};

@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@

 int func(struct drm_crtc *crtc,
		struct drm_crtc_state *new_state)
 {
	... when != new_state
 }

@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@

 int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
 {
+	struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
 	...
 }

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

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

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

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

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

 int func(struct drm_crtc *crtc,
-	       struct drm_crtc_state *new_state
+	       struct drm_atomic_state *state
	       )
 { ... }

@@
identifier new_state;
identifier crtc;
@@

 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
-                             struct drm_crtc_state *new_state
+                             struct drm_atomic_state *state
               )
 {
+       struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
	...
 }

@@
identifier new_state;
identifier crtc;
@@

 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
-                             struct drm_crtc_state *new_state
+                             struct drm_atomic_state *state
               );

@ 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/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
2020-11-02 12:34:49 +01:00
..
displays drm/omap: display: use devm_of_find_backlight 2020-05-17 14:54:39 +02:00
dss Linux 5.9-rc4 2020-09-08 14:41:40 +10:00
Kconfig
Makefile
omap_connector.c drm/omap: Use {} to zero initialize the mode 2020-07-24 23:01:46 +03:00
omap_connector.h drm/omap: Remove HPD, detect and EDID omapdss operations 2020-02-26 13:32:02 +02:00
omap_crtc.c drm/atomic: Pass the full state to CRTC atomic_check 2020-11-02 12:34:49 +01:00
omap_crtc.h
omap_debugfs.c drm: convert .debugfs_init() hook to return void. 2020-03-18 17:53:28 +01:00
omap_dmm_priv.h
omap_dmm_tiler.c drm/omap: dmm_tiler: Remove the dma_async_issue_pending() call 2020-02-11 09:29:01 +02:00
omap_dmm_tiler.h drm/omap: remove OMAP_BO_TILED define 2019-10-11 17:02:32 +03:00
omap_drv.c drm/omapdrm: Introduce GEM object functions 2020-09-25 09:21:10 +02:00
omap_drv.h drm: convert .debugfs_init() hook to return void. 2020-03-18 17:53:28 +01:00
omap_encoder.c drm/omap: dss: Remove unused omap_dss_device operations 2020-02-26 13:32:12 +02:00
omap_encoder.h
omap_fb.c drm/omapdrm: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:34 +01:00
omap_fb.h
omap_fbdev.c drm/omapdrm: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:34 +01:00
omap_fbdev.h
omap_gem.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
omap_gem.h drm/omapdrm: Introduce GEM object functions 2020-09-25 09:21:10 +02:00
omap_gem_dmabuf.c drm/omapdrm: Drop dma_buf->k(un)map 2019-11-25 22:36:14 +01:00
omap_irq.c
omap_irq.h
omap_plane.c
omap_plane.h
tcm-sita.c
tcm.h
TODO