1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/gpu/drm/msm/disp/dpu1
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
..
dpu_core_irq.c drm/msm/dpu: Convert to DEFINE_SHOW_ATTRIBUTE 2020-09-22 08:30:19 -07:00
dpu_core_irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_core_perf.c drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_core_perf.h Merge tag 'drm-msm-next-2019-06-25' of https://gitlab.freedesktop.org/drm/msm into drm-next 2019-06-28 10:16:40 +10:00
dpu_crtc.c drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
dpu_crtc.h drm/msm/dpu: add support for color processing blocks in dpu driver 2020-05-18 09:26:32 -07:00
dpu_encoder.c drm/msm/dpu: Convert to DEFINE_SHOW_ATTRIBUTE 2020-09-22 08:30:19 -07:00
dpu_encoder.h drm/msm/dpu: async commit support 2019-09-03 16:17:01 -07:00
dpu_encoder_phys.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_encoder_phys_cmd.c drm/msm/dpu: fix comparing pointer to 0 in dpu_encoder_phys_cmd.c 2020-03-19 12:12:53 -07:00
dpu_encoder_phys_vid.c drm/msm/dpu: remove unused variables new_cnt and old_cnt in dpu_encoder_phys_vid_vblank_irq() 2020-09-22 08:30:57 -07:00
dpu_formats.c drm/msm/dpu: fix BGR565 vs RGB565 confusion 2020-02-13 13:54:12 -08:00
dpu_formats.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_blk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_blk.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_catalog.c drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_hw_catalog.h drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_hw_catalog_format.h drm/msm/dpu: Allow UBWC on NV12 2020-01-12 10:36:37 -08:00
dpu_hw_ctl.c drm/msm/dpu: set missing flush bits for INTF_2 and INTF_3 2020-07-31 06:46:16 -07:00
dpu_hw_ctl.h drm/msm/dpu: add support for color processing blocks in dpu driver 2020-05-18 09:26:32 -07:00
dpu_hw_dspp.c drm/msm/dpu: dpu_setup_dspp_pcc() can be static 2020-05-22 09:12:32 -07:00
dpu_hw_dspp.h drm/msm/dpu: add support for pcc color block in dpu driver 2020-05-18 09:26:32 -07:00
dpu_hw_interrupts.c msm: disp: dpu1: add support to access hw irqs regs depending on revision 2020-01-02 15:08:23 -08:00
dpu_hw_interrupts.h msm: disp: dpu1: add support to access hw irqs regs depending on revision 2020-01-02 15:08:23 -08:00
dpu_hw_intf.c drm/msm/dpu: intf timing path for displayport 2020-07-31 06:46:16 -07:00
dpu_hw_intf.h drm/msm/dpu: Refactor rm iterator 2020-03-19 09:27:28 -07:00
dpu_hw_lm.c drm/msm/dpu: use right setup_blend_config for sm8150 and sm8250 2020-07-31 06:46:16 -07:00
dpu_hw_lm.h drm/msm/dpu: Mark various data tables as const 2020-01-02 14:54:44 -08:00
dpu_hw_mdss.h drm/msm/dpu: add SM8150 to hw catalog 2020-07-31 06:46:17 -07:00
dpu_hw_pingpong.c drm/msm/dpu: fix/enable 6bpc dither with split-lm 2020-07-31 06:46:15 -07:00
dpu_hw_pingpong.h drm/msm/dpu: add support for dither block in display 2020-07-31 06:46:15 -07:00
dpu_hw_sspp.c drm/msm/dpu: update UBWC config for sm8150 and sm8250 2020-07-31 06:46:16 -07:00
dpu_hw_sspp.h msm:disp:dpu1: add scaler support on SC7180 display 2020-01-02 15:50:25 -08:00
dpu_hw_top.c drm/msm/dpu: update UBWC config for sm8150 and sm8250 2020-07-31 06:46:16 -07:00
dpu_hw_top.h drm/msm/dpu: update UBWC config for sm8150 and sm8250 2020-07-31 06:46:16 -07:00
dpu_hw_util.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_util.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_vbif.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hw_vbif.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_hwio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
dpu_io_util.c msm:disp:dpu1: Fix core clk rate in display driver 2020-01-02 15:52:55 -08:00
dpu_io_util.h drm/msm/dpu: Drop unused GPIO code 2019-09-03 16:16:58 -07:00
dpu_kms.c drm/msm/dpu: Convert to DEFINE_SHOW_ATTRIBUTE 2020-09-22 08:30:19 -07:00
dpu_kms.h drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_mdss.c drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_plane.c drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_plane.h drm/msm/dpu: add support for clk and bw scaling for display 2020-09-04 12:15:29 -07:00
dpu_rm.c drm/msm/dpu: add support for color processing blocks in dpu driver 2020-05-18 09:26:32 -07:00
dpu_rm.h drm/msm/dpu: add support for color processing blocks in dpu driver 2020-05-18 09:26:32 -07:00
dpu_trace.h drm/msm/dpu: Stop copying around mode->private_flags 2020-05-27 14:31:42 +03:00
dpu_vbif.c drm/msm/dpu: fix comparing pointer to 0 in dpu_vbif.c 2020-03-19 12:12:53 -07:00
dpu_vbif.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
msm_media_info.h drm/msm/dpu: Clean up dpu_media_info.h static inline functions 2018-12-11 13:10:19 -05:00