drm/atomic: Pass the full state to CRTC atomic begin and flush
authorMaxime Ripard <maxime@cerno.tech>
Wed, 28 Oct 2020 12:32:22 +0000 (13:32 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 2 Nov 2020 11:37:49 +0000 (12:37 +0100)
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
39 files changed:
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
drivers/gpu/drm/arm/hdlcd_crtc.c
drivers/gpu/drm/armada/armada_crtc.c
drivers/gpu/drm/ast/ast_mode.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/exynos/exynos_drm_crtc.c
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
drivers/gpu/drm/imx/dcss/dcss-crtc.c
drivers/gpu/drm/imx/ipuv3-crtc.c
drivers/gpu/drm/ingenic/ingenic-drm-drv.c
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/meson/meson_crtc.c
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
drivers/gpu/drm/mxsfb/mxsfb_kms.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/qxl/qxl_display.c
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
drivers/gpu/drm/sti/sti_crtc.c
drivers/gpu/drm/stm/ltdc.c
drivers/gpu/drm/sun4i/sun4i_crtc.c
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tidss/tidss_crtc.c
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/vboxvideo/vbox_mode.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_hvs.c
drivers/gpu/drm/virtio/virtgpu_display.c
drivers/gpu/drm/vkms/vkms_crtc.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
drivers/gpu/drm/xlnx/zynqmp_disp.c
drivers/gpu/drm/zte/zx_vou.c
include/drm/drm_modeset_helper_vtables.h

index cc65623b54552e993fa51775b27b1f3c8adea852..df0b9eeb89337d069a1d15e9fc1ac188a2762c47 100644 (file)
@@ -385,8 +385,10 @@ komeda_crtc_atomic_disable(struct drm_crtc *crtc,
 
 static void
 komeda_crtc_atomic_flush(struct drm_crtc *crtc,
-                        struct drm_crtc_state *old)
+                        struct drm_atomic_state *state)
 {
+       struct drm_crtc_state *old = drm_atomic_get_old_crtc_state(state,
+                                                                  crtc);
        /* commit with modeset will be handled in enable/disable */
        if (drm_atomic_crtc_needs_modeset(crtc->state))
                return;
index 84ac10d59485afd58764cd5d833984b1ac7228f7..a3234bfb09173bece770982908a5f2ff35b9ff40 100644 (file)
@@ -205,7 +205,7 @@ static enum drm_mode_status hdlcd_crtc_mode_valid(struct drm_crtc *crtc,
 }
 
 static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *state)
+                                   struct drm_atomic_state *state)
 {
        struct drm_pending_vblank_event *event = crtc->state->event;
 
index d22ca1496c4358b74667af993580f5465efeefac..ca643f4e206449c05e78653e54ba158f60724159 100644 (file)
@@ -429,7 +429,7 @@ static int armada_drm_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void armada_drm_crtc_atomic_begin(struct drm_crtc *crtc,
-                                        struct drm_crtc_state *old_crtc_state)
+                                        struct drm_atomic_state *state)
 {
        struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
 
@@ -443,7 +443,7 @@ static void armada_drm_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void armada_drm_crtc_atomic_flush(struct drm_crtc *crtc,
-                                        struct drm_crtc_state *old_crtc_state)
+                                        struct drm_atomic_state *state)
 {
        struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
 
index 346dce2d654fe6ef3d64698c9867c831a81a413d..22f0e65fbe9a41c3043630fd76673d46b1adb4df 100644 (file)
@@ -779,8 +779,11 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
 }
 
 static void
-ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state)
+ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,
+                            struct drm_atomic_state *state)
 {
+       struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
+                                                                             crtc);
        struct ast_private *ast = to_ast_private(crtc->dev);
        struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc->state);
        struct ast_crtc_state *old_ast_crtc_state = to_ast_crtc_state(old_crtc_state);
index 0e533ded2a965d48f9776f16873b3386f84ee519..c17571a3cc2bf2d66d8d895e65afa3d8bc679ba4 100644 (file)
@@ -342,7 +342,7 @@ static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c,
 }
 
 static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
-                                         struct drm_crtc_state *old_s)
+                                         struct drm_atomic_state *state)
 {
        struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
 
@@ -357,7 +357,7 @@ static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
 }
 
 static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
-                                         struct drm_crtc_state *old_s)
+                                         struct drm_atomic_state *state)
 {
        /* TODO: write common plane control register if available */
 }
index 12d8095318d0bf06c7612496f2882eb0e671147f..ddd0e323915080fbaf5e8a1ea341d3149ac33186 100644 (file)
@@ -2521,7 +2521,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
                if (active_only && !new_crtc_state->active)
                        continue;
 
-               funcs->atomic_begin(crtc, old_crtc_state);
+               funcs->atomic_begin(crtc, old_state);
        }
 
        for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) {
@@ -2579,7 +2579,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
                if (active_only && !new_crtc_state->active)
                        continue;
 
-               funcs->atomic_flush(crtc, old_crtc_state);
+               funcs->atomic_flush(crtc, old_state);
        }
 }
 EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
@@ -2617,7 +2617,7 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
 
        crtc_funcs = crtc->helper_private;
        if (crtc_funcs && crtc_funcs->atomic_begin)
-               crtc_funcs->atomic_begin(crtc, old_crtc_state);
+               crtc_funcs->atomic_begin(crtc, old_state);
 
        drm_for_each_plane_mask(plane, crtc->dev, plane_mask) {
                struct drm_plane_state *old_plane_state =
@@ -2643,7 +2643,7 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
        }
 
        if (crtc_funcs && crtc_funcs->atomic_flush)
-               crtc_funcs->atomic_flush(crtc, old_crtc_state);
+               crtc_funcs->atomic_flush(crtc, old_state);
 }
 EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
 
index 928f764efce82d09d5b9cb29ba96edd02ff94f35..4153f302de7c45a1351e91555e249292f078080d 100644 (file)
@@ -65,7 +65,7 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
-                                    struct drm_crtc_state *old_crtc_state)
+                                    struct drm_atomic_state *state)
 {
        struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
@@ -74,7 +74,7 @@ static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
-                                    struct drm_crtc_state *old_crtc_state)
+                                    struct drm_atomic_state *state)
 {
        struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
index 7a9e89cfdf9cad8ad7f9d0a522868542c43825c3..2af60d98f48f99b6eae235d3d117f9b8523166f3 100644 (file)
@@ -21,7 +21,7 @@
 #include "fsl_dcu_drm_plane.h"
 
 static void fsl_dcu_drm_crtc_atomic_flush(struct drm_crtc *crtc,
-                                         struct drm_crtc_state *old_crtc_state)
+                                         struct drm_atomic_state *state)
 {
        struct drm_device *dev = crtc->dev;
        struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
index ef18b47871950e5a6acbe221d66999307e289cf3..ea962acfeae0897f7b0b61ecdd2814a463cc2afd 100644 (file)
@@ -390,7 +390,7 @@ static void hibmc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 static void hibmc_crtc_atomic_begin(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_state)
+                                   struct drm_atomic_state *state)
 {
        u32 reg;
        struct drm_device *dev = crtc->dev;
@@ -410,7 +410,7 @@ static void hibmc_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_state)
+                                   struct drm_atomic_state *state)
 
 {
        unsigned long flags;
index cfe8ff596d550d52ad86ab52117af577720aff29..d84d41f3e78f5f558daf67e1e4adcf79c6cff2f6 100644 (file)
@@ -485,7 +485,7 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_state)
+                                 struct drm_atomic_state *state)
 {
        struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
        struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
@@ -498,7 +498,7 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_state)
+                                 struct drm_atomic_state *state)
 
 {
        struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
index 8f570eb5f471e3a99caa82985d774fac44d09f6f..31267c00782fc1535fa70b108df262b5c325b375 100644 (file)
@@ -53,13 +53,13 @@ static const struct drm_crtc_funcs dcss_crtc_funcs = {
 };
 
 static void dcss_crtc_atomic_begin(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        drm_crtc_vblank_on(crtc);
 }
 
 static void dcss_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct dcss_crtc *dcss_crtc = container_of(crtc, struct dcss_crtc,
                                                   base);
index b6d864d7a0dfcb92f3478d10f9a0faf07fb53af7..7ebd99ee3240728a1dac170da421db18348c06dc 100644 (file)
@@ -240,13 +240,13 @@ static int ipu_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void ipu_crtc_atomic_begin(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
        drm_crtc_vblank_on(crtc);
 }
 
 static void ipu_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
        spin_lock_irq(&crtc->dev->event_lock);
        if (crtc->state->event) {
index aaa324bd557218694c719898dfeb2b7eb6a78155..b9c156e13156c28e0cb6b7f785480b4293b19b69 100644 (file)
@@ -303,7 +303,7 @@ ingenic_drm_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode
 }
 
 static void ingenic_drm_crtc_atomic_begin(struct drm_crtc *crtc,
-                                         struct drm_crtc_state *oldstate)
+                                         struct drm_atomic_state *state)
 {
        struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
        u32 ctrl = 0;
@@ -323,26 +323,27 @@ static void ingenic_drm_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
-                                         struct drm_crtc_state *oldstate)
+                                         struct drm_atomic_state *state)
 {
        struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
-       struct drm_crtc_state *state = crtc->state;
-       struct drm_pending_vblank_event *event = state->event;
+       struct drm_crtc_state *crtc_state = crtc->state;
+       struct drm_pending_vblank_event *event = crtc_state->event;
 
-       if (drm_atomic_crtc_needs_modeset(state)) {
-               ingenic_drm_crtc_update_timings(priv, &state->mode);
+       if (drm_atomic_crtc_needs_modeset(crtc_state)) {
+               ingenic_drm_crtc_update_timings(priv, &crtc_state->mode);
                priv->update_clk_rate = true;
        }
 
        if (priv->update_clk_rate) {
                mutex_lock(&priv->clk_mutex);
-               clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
+               clk_set_rate(priv->pix_clk,
+                            crtc_state->adjusted_mode.clock * 1000);
                priv->update_clk_rate = false;
                mutex_unlock(&priv->clk_mutex);
        }
 
        if (event) {
-               state->event = NULL;
+               crtc_state->event = NULL;
 
                spin_lock_irq(&crtc->dev->event_lock);
                if (drm_crtc_vblank_get(crtc) == 0)
index c28f5d7aac1a7a5e82919c07ede4cd68792f9cc3..23f5c10b0c674686e8c6128e13d784fd66cf4e74 100644 (file)
@@ -575,24 +575,24 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc,
-                                     struct drm_crtc_state *old_crtc_state)
+                                     struct drm_atomic_state *state)
 {
-       struct mtk_crtc_state *state = to_mtk_crtc_state(crtc->state);
+       struct mtk_crtc_state *crtc_state = to_mtk_crtc_state(crtc->state);
        struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 
-       if (mtk_crtc->event && state->base.event)
+       if (mtk_crtc->event && crtc_state->base.event)
                DRM_ERROR("new event while there is still a pending event\n");
 
-       if (state->base.event) {
-               state->base.event->pipe = drm_crtc_index(crtc);
+       if (crtc_state->base.event) {
+               crtc_state->base.event->pipe = drm_crtc_index(crtc);
                WARN_ON(drm_crtc_vblank_get(crtc) != 0);
-               mtk_crtc->event = state->base.event;
-               state->base.event = NULL;
+               mtk_crtc->event = crtc_state->base.event;
+               crtc_state->base.event = NULL;
        }
 }
 
 static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
-                                     struct drm_crtc_state *old_crtc_state)
+                                     struct drm_atomic_state *state)
 {
        struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
        int i;
index 247ce085886bf066c9ad0edc935b196164ca6aa3..d70616da8ce2fd974b57af6aadca5c98fbb88fce 100644 (file)
@@ -201,7 +201,7 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *state)
+                                   struct drm_atomic_state *state)
 {
        struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
        unsigned long flags;
@@ -217,7 +217,7 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_crtc_state)
+                                   struct drm_atomic_state *state)
 {
        struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
        struct meson_drm *priv = meson_crtc->priv;
index 169df7ca85fd0cdfda8fbc35cfd61724b6377fe3..e55be2922c2f9e52017fe7dd077ea6a56001be41 100644 (file)
@@ -486,7 +486,7 @@ static void _dpu_crtc_setup_cp_blocks(struct drm_crtc *crtc)
 }
 
 static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
-               struct drm_crtc_state *old_state)
+               struct drm_atomic_state *state)
 {
        struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
        struct drm_encoder *encoder;
@@ -527,7 +527,7 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void dpu_crtc_atomic_flush(struct drm_crtc *crtc,
-               struct drm_crtc_state *old_crtc_state)
+               struct drm_atomic_state *state)
 {
        struct dpu_crtc *dpu_crtc;
        struct drm_device *dev;
index af80f3baf05beac3df8da65485dba0e6ad6d67c7..34e3186e236de0fc05a50ccd0a327b07643b631e 100644 (file)
@@ -316,14 +316,14 @@ static int mdp4_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void mdp4_crtc_atomic_begin(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
        DBG("%s: begin", mdp4_crtc->name);
 }
 
 static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
        struct drm_device *dev = crtc->dev;
index 500f885c0eae2f361cf5a1190379b85a69bf1982..4a53d7b42e9c2dbb23e8caf611ba2f88e81da85d 100644 (file)
@@ -772,13 +772,13 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void mdp5_crtc_atomic_begin(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        DBG("%s: begin", crtc->name);
 }
 
 static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
        struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
index b0757f84a979d0f5845551971ba26778d0f77d64..eb0e2b08329b4d5a2b3f07e251bb5bdd286183f2 100644 (file)
@@ -285,7 +285,7 @@ static int mxsfb_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_state)
+                                   struct drm_atomic_state *state)
 {
        struct drm_pending_vblank_event *event;
 
index 69a0770ba38e76b644291210bf3c9dd980f74161..d7442aa55f89c5bc02d631e36914e34d15a872a3 100644 (file)
@@ -601,12 +601,12 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void omap_crtc_atomic_begin(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
 }
 
 static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct omap_drm_private *priv = crtc->dev->dev_private;
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
index 45fd76e04bdce62b5e6d3df64ee67fb0058cfb1a..07a3e3c23f09be60dee75e07bd976037c083e4d0 100644 (file)
@@ -372,7 +372,7 @@ static void qxl_crtc_update_monitors_config(struct drm_crtc *crtc,
 }
 
 static void qxl_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
        qxl_crtc_update_monitors_config(crtc, "flush");
 }
index 460fb07b786f72c11f4711806b361c511dc6d536..b5fb941e0f534c590da278445620983599f3e523 100644 (file)
@@ -785,7 +785,7 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
-                                     struct drm_crtc_state *old_crtc_state)
+                                     struct drm_atomic_state *state)
 {
        struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
 
@@ -814,7 +814,7 @@ static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
-                                     struct drm_crtc_state *old_crtc_state)
+                                     struct drm_atomic_state *state)
 {
        struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
        struct drm_device *dev = rcrtc->crtc.dev;
index fcbd758e653173cfb6ee7cbb28ba52d9ad18248f..8cd39fca81a301f02d43beda86ab14ec88718a90 100644 (file)
@@ -1246,8 +1246,10 @@ static void vop_crtc_gamma_set(struct vop *vop, struct drm_crtc *crtc,
 }
 
 static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
+       struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
+                                                                             crtc);
        struct vop *vop = to_vop(crtc);
 
        /*
@@ -1462,8 +1464,10 @@ static int vop_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
+       struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
+                                                                             crtc);
        struct drm_atomic_state *old_state = old_crtc_state->state;
        struct drm_plane_state *old_plane_state, *new_plane_state;
        struct vop *vop = to_vop(crtc);
index 5726746f6d1806ea2aff37cbe2bba12ff594ddec..409795786f0390c71fd444e04a8e2f108d9a5cac 100644 (file)
@@ -133,7 +133,7 @@ sti_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_crtc_state)
+                                 struct drm_atomic_state *state)
 {
        struct drm_device *drm_dev = crtc->dev;
        struct sti_mixer *mixer = to_sti_mixer(crtc);
index e9af92d4a74b46f4e8ea109a7eca77a884567e00..3980677435cbf0a2df5c2af37959ace06a615caa 100644 (file)
@@ -596,7 +596,7 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct ltdc_device *ldev = crtc_to_ltdc(crtc);
        struct drm_device *ddev = crtc->dev;
index 8f91391832dbbcdccafe889434b1f32bf13d3671..45d9eb552d869597424cbdcb2e332e40ad666131 100644 (file)
@@ -61,8 +61,10 @@ static int sun4i_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void sun4i_crtc_atomic_begin(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);
        struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
        struct drm_device *dev = crtc->dev;
        struct sunxi_engine *engine = scrtc->engine;
@@ -82,7 +84,7 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_state)
+                                   struct drm_atomic_state *state)
 {
        struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
        struct drm_pending_vblank_event *event = crtc->state->event;
index 52acc2f8f79887b978482576a082e515e4459d3b..2d86627b0d4ecc03fbbc7979824ec85534b83168 100644 (file)
@@ -1918,7 +1918,7 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,
 }
 
 static void tegra_crtc_atomic_begin(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_crtc_state)
+                                   struct drm_atomic_state *state)
 {
        unsigned long flags;
 
@@ -1937,17 +1937,17 @@ static void tegra_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void tegra_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_crtc_state)
+                                   struct drm_atomic_state *state)
 {
-       struct tegra_dc_state *state = to_dc_state(crtc->state);
+       struct tegra_dc_state *crtc_state = to_dc_state(crtc->state);
        struct tegra_dc *dc = to_tegra_dc(crtc);
        u32 value;
 
-       value = state->planes << 8 | GENERAL_UPDATE;
+       value = crtc_state->planes << 8 | GENERAL_UPDATE;
        tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
        value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
 
-       value = state->planes | GENERAL_ACT_REQ;
+       value = crtc_state->planes | GENERAL_ACT_REQ;
        tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
        value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
 }
index 6739f489dfdfe6e739e5ccad6b9b5510053ba804..2218da3b3ca3445d3f94f88bcfeb478d711529d6 100644 (file)
@@ -163,8 +163,10 @@ static void tidss_crtc_position_planes(struct tidss_device *tidss,
 }
 
 static void tidss_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *old_crtc_state)
+                                   struct drm_atomic_state *state)
 {
+       struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
+                                                                             crtc);
        struct tidss_crtc *tcrtc = to_tidss_crtc(crtc);
        struct drm_device *ddev = crtc->dev;
        struct tidss_device *tidss = to_tidss(ddev);
index d87a9fd4a20391c1d02481c52eef308adedd7a9b..40c59f4bd962adbc838a2ae91c027402123274b7 100644 (file)
@@ -535,7 +535,7 @@ static void tilcdc_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void tilcdc_crtc_atomic_flush(struct drm_crtc *crtc,
-                                    struct drm_crtc_state *old_state)
+                                    struct drm_atomic_state *state)
 {
        if (!crtc->state->event)
                return;
index 931c55126148be0feab045261d5d259637a78c72..322bf7133ba1289e48c44a40769d7f109e8b9f7a 100644 (file)
@@ -223,7 +223,7 @@ static void vbox_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void vbox_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
 }
 
index 7003e7f14a48149d00320f9d50899387a476ca8b..5d3d8ed0b775139bf92a191c55a4c855078d41ad 100644 (file)
@@ -916,7 +916,8 @@ int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output);
 int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
 void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
 void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
-void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *state);
+void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
+                         struct drm_atomic_state *state);
 void vc4_hvs_dump_state(struct drm_device *dev);
 void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel);
 void vc4_hvs_mask_underrun(struct drm_device *dev, int channel);
index 4d0a833366cee10eb6fca2644433738b78985eeb..0bd5ea4351205a9c013a0e6cea76774363732757 100644 (file)
@@ -414,8 +414,10 @@ void vc4_hvs_atomic_disable(struct drm_crtc *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);
        struct drm_device *dev = crtc->dev;
        struct vc4_dev *vc4 = to_vc4_dev(dev);
        struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
index e81183ab87e0567da03ff5e1ed9cd7edcc24f068..4bf74836bd53fd3fe3e20b51c1d1a080d2cc90cb 100644 (file)
@@ -117,7 +117,7 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
 }
 
 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
-                                        struct drm_crtc_state *old_state)
+                                        struct drm_atomic_state *state)
 {
        struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
 
index 6a49e70bdf18451de6bbf1251f0cd96112bb60c5..0443b7deeaef603dd98003cb6207705e53803b10 100644 (file)
@@ -228,7 +228,7 @@ static void vkms_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void vkms_crtc_atomic_begin(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
 
@@ -239,7 +239,7 @@ static void vkms_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static void vkms_crtc_atomic_flush(struct drm_crtc *crtc,
-                                  struct drm_crtc_state *old_crtc_state)
+                                  struct drm_atomic_state *state)
 {
        struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
 
index a74c9454ade2e582a220478e1dee58cf607fa594..bc67f2b930e1f17e8e4356f09385b980133d02b8 100644 (file)
@@ -554,13 +554,13 @@ int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
 
 
 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state)
+                             struct drm_atomic_state *state)
 {
 }
 
 
 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state)
+                             struct drm_atomic_state *state)
 {
        struct drm_pending_vblank_event *event = crtc->state->event;
 
index b3d4e7b4c8c573ab1e8543c6f1ce8d41118a1b0e..03f3694015cecfa8ae1df9aed0c8f25be1adaf7a 100644 (file)
@@ -475,9 +475,9 @@ void vmw_du_plane_unpin_surf(struct vmw_plane_state *vps,
 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
                             struct drm_atomic_state *state);
 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state);
+                             struct drm_atomic_state *state);
 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state);
+                             struct drm_atomic_state *state);
 void vmw_du_crtc_reset(struct drm_crtc *crtc);
 struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc);
 void vmw_du_crtc_destroy_state(struct drm_crtc *crtc,
index 058fbcebe6ce7dba535734e3c60d05aca974ffc8..444865af9e36ee14bd343ae9a893ddd785fc85a5 100644 (file)
@@ -1513,14 +1513,14 @@ static int zynqmp_disp_crtc_atomic_check(struct drm_crtc *crtc,
 
 static void
 zynqmp_disp_crtc_atomic_begin(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state)
+                             struct drm_atomic_state *state)
 {
        drm_crtc_vblank_on(crtc);
 }
 
 static void
 zynqmp_disp_crtc_atomic_flush(struct drm_crtc *crtc,
-                             struct drm_crtc_state *old_crtc_state)
+                             struct drm_atomic_state *state)
 {
        if (crtc->state->event) {
                struct drm_pending_vblank_event *event;
index d2a529eba3c9999ce1912eedef627e5b33f8ff19..904f62f3bfc173d5d1b8fa64ef98a5c993179dab 100644 (file)
@@ -473,7 +473,7 @@ static void zx_crtc_atomic_disable(struct drm_crtc *crtc,
 }
 
 static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
-                                 struct drm_crtc_state *old_state)
+                                 struct drm_atomic_state *state)
 {
        struct drm_pending_vblank_event *event = crtc->state->event;
 
index b97441deaf93e2f70a257c369cd277451699e4a0..f2de050085be7c390ee9681ac04edb2be687f68f 100644 (file)
@@ -373,7 +373,7 @@ struct drm_crtc_helper_funcs {
         * transitional plane helpers, but it is optional.
         */
        void (*atomic_begin)(struct drm_crtc *crtc,
-                            struct drm_crtc_state *old_crtc_state);
+                            struct drm_atomic_state *state);
        /**
         * @atomic_flush:
         *
@@ -397,7 +397,7 @@ struct drm_crtc_helper_funcs {
         * transitional plane helpers, but it is optional.
         */
        void (*atomic_flush)(struct drm_crtc *crtc,
-                            struct drm_crtc_state *old_crtc_state);
+                            struct drm_atomic_state *state);
 
        /**
         * @atomic_enable: