drm: Add old state pointer to CRTC .enable() helper function
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 30 Jun 2017 09:36:44 +0000 (12:36 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 30 Jun 2017 12:53:14 +0000 (14:53 +0200)
The old state is useful for drivers that need to perform operations at
enable time that depend on the transition between the old and new
states.

While at it, rename the operation to .atomic_enable() to be consistent
with .atomic_disable(), as the .enable() operation is used by atomic
helpers only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> # for sun4i
Acked-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-drm and mediatek
Acked-by: Alexey Brodkin <abrodkin@synopsys.com> # for arcpgu
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> # for atmel-hlcdc
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> # for hdlcd and mali-dp
Acked-by: Stefan Agner <stefan@agner.ch> # for fsl-dcu
Tested-by: Philippe Cornu <philippe.cornu@st.com> # for stm
Acked-by: Philippe Cornu <philippe.cornu@st.com> # for stm
Acked-by: Vincent Abriou <vincent.abriou@st.com> # for sti
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> # for vmwgfx
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170630093646.7928-2-laurent.pinchart+renesas@ideasonboard.com
31 files changed:
drivers/gpu/drm/arc/arcpgu_crtc.c
drivers/gpu/drm/arm/hdlcd_crtc.c
drivers/gpu/drm/arm/malidp_crtc.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_simple_kms_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/ipuv3-crtc.c
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/meson/meson_crtc.c
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.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/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/vc4/vc4_crtc.c
drivers/gpu/drm/virtio/virtgpu_display.c
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
drivers/gpu/drm/zte/zx_vou.c
include/drm/drm_modeset_helper_vtables.h

index 1f306781c9d5b4f61b67a08eaf2baa5fe5b44a89..c9bc6a90ac83c3fb8330d89382caed822faebc4a 100644 (file)
@@ -119,7 +119,8 @@ static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
        clk_set_rate(arcpgu->clk, m->crtc_clock * 1000);
 }
 
-static void arc_pgu_crtc_enable(struct drm_crtc *crtc)
+static void arc_pgu_crtc_atomic_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
        struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
 
@@ -161,9 +162,9 @@ static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = {
        .mode_set       = drm_helper_crtc_mode_set,
        .mode_set_base  = drm_helper_crtc_mode_set_base,
        .mode_set_nofb  = arc_pgu_crtc_mode_set_nofb,
-       .enable         = arc_pgu_crtc_enable,
        .disable        = arc_pgu_crtc_disable,
        .atomic_begin   = arc_pgu_crtc_atomic_begin,
+       .atomic_enable  = arc_pgu_crtc_atomic_enable,
 };
 
 static void arc_pgu_plane_atomic_update(struct drm_plane *plane,
index d67b6f15e8b8a03f902d02861e51cb696eb1e9b5..2b7f4f05d91f466217eb13d9675b1d41378cb534 100644 (file)
@@ -165,7 +165,8 @@ static void hdlcd_crtc_mode_set_nofb(struct drm_crtc *crtc)
        clk_set_rate(hdlcd->clk, m->crtc_clock * 1000);
 }
 
-static void hdlcd_crtc_enable(struct drm_crtc *crtc)
+static void hdlcd_crtc_atomic_enable(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *old_state)
 {
        struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
 
@@ -218,10 +219,10 @@ static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
-       .enable         = hdlcd_crtc_enable,
        .disable        = hdlcd_crtc_disable,
        .atomic_check   = hdlcd_crtc_atomic_check,
        .atomic_begin   = hdlcd_crtc_atomic_begin,
+       .atomic_enable  = hdlcd_crtc_atomic_enable,
 };
 
 static int hdlcd_plane_atomic_check(struct drm_plane *plane,
index 4bb38a21efecb6e0741a626f986515570ed3b1f3..8e5b1c0181ab70614c87b043e9c0e2a4f35529de 100644 (file)
@@ -46,7 +46,8 @@ static enum drm_mode_status malidp_crtc_mode_valid(struct drm_crtc *crtc,
        return MODE_OK;
 }
 
-static void malidp_crtc_enable(struct drm_crtc *crtc)
+static void malidp_crtc_atomic_enable(struct drm_crtc *crtc,
+                                     struct drm_crtc_state *old_state)
 {
        struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
        struct malidp_hw_device *hwdev = malidp->dev;
@@ -408,9 +409,9 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
 
 static const struct drm_crtc_helper_funcs malidp_crtc_helper_funcs = {
        .mode_valid = malidp_crtc_mode_valid,
-       .enable = malidp_crtc_enable,
        .disable = malidp_crtc_disable,
        .atomic_check = malidp_crtc_atomic_check,
+       .atomic_enable = malidp_crtc_atomic_enable,
 };
 
 static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc)
index f6b8c5908a20946410bc8187e2f94fe6e969af74..e54e503180f45ac1a7f00806e2e66fa198525958 100644 (file)
@@ -183,7 +183,8 @@ static void atmel_hlcdc_crtc_disable(struct drm_crtc *c)
        pm_runtime_put_sync(dev->dev);
 }
 
-static void atmel_hlcdc_crtc_enable(struct drm_crtc *c)
+static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
+                                          struct drm_crtc_state *old_state)
 {
        struct drm_device *dev = c->dev;
        struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
@@ -320,10 +321,10 @@ static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = {
        .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb,
        .mode_set_base = drm_helper_crtc_mode_set_base,
        .disable = atmel_hlcdc_crtc_disable,
-       .enable = atmel_hlcdc_crtc_enable,
        .atomic_check = atmel_hlcdc_crtc_atomic_check,
        .atomic_begin = atmel_hlcdc_crtc_atomic_begin,
        .atomic_flush = atmel_hlcdc_crtc_atomic_flush,
+       .atomic_enable = atmel_hlcdc_crtc_atomic_enable,
 };
 
 static void atmel_hlcdc_crtc_destroy(struct drm_crtc *c)
index 2f269e4267da1c8fd40cf11da9deb0c1cad68b1b..23e4661a62feaa56423cc36538f513b61a24c60f 100644 (file)
@@ -1069,12 +1069,13 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
                                              struct drm_atomic_state *old_state)
 {
        struct drm_crtc *crtc;
+       struct drm_crtc_state *old_crtc_state;
        struct drm_crtc_state *new_crtc_state;
        struct drm_connector *connector;
        struct drm_connector_state *new_conn_state;
        int i;
 
-       for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
+       for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) {
                const struct drm_crtc_helper_funcs *funcs;
 
                /* Need to filter out CRTCs where only planes change. */
@@ -1090,8 +1091,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
                        DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
                                         crtc->base.id, crtc->name);
 
-                       if (funcs->enable)
-                               funcs->enable(crtc);
+                       if (funcs->atomic_enable)
+                               funcs->atomic_enable(crtc, old_crtc_state);
                        else
                                funcs->commit(crtc);
                }
index e084f9f8ca666c168e1df7e7108abdb1cc39744b..58c27ab1756f46fdbd4289b9eebc3eb3e6a77946 100644 (file)
@@ -40,7 +40,8 @@ static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
        return drm_atomic_add_affected_planes(state->state, crtc);
 }
 
-static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc)
+static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
        struct drm_simple_display_pipe *pipe;
 
@@ -64,8 +65,8 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc)
 
 static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
        .atomic_check = drm_simple_kms_crtc_check,
+       .atomic_enable = drm_simple_kms_crtc_enable,
        .disable = drm_simple_kms_crtc_disable,
-       .enable = drm_simple_kms_crtc_enable,
 };
 
 static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
index d72777f6411a73144ffb3142c2bdca2e8585ac61..b7e2fadb6442351c74592e8e3cfdf572fa5cd4c8 100644 (file)
@@ -21,7 +21,8 @@
 #include "exynos_drm_drv.h"
 #include "exynos_drm_plane.h"
 
-static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
+static void exynos_drm_crtc_atomic_enable(struct drm_crtc *crtc,
+                                         struct drm_crtc_state *old_state)
 {
        struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
@@ -82,11 +83,11 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
-       .enable         = exynos_drm_crtc_enable,
        .disable        = exynos_drm_crtc_disable,
        .atomic_check   = exynos_crtc_atomic_check,
        .atomic_begin   = exynos_crtc_atomic_begin,
        .atomic_flush   = exynos_crtc_atomic_flush,
+       .atomic_enable  = exynos_drm_crtc_atomic_enable,
 };
 
 void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc)
index cc4e944a1d3c668a595616ca208cc587bc794b1f..0e3752437e44fd822e91949db7c234e9889c30c1 100644 (file)
@@ -63,7 +63,8 @@ static void fsl_dcu_drm_crtc_atomic_disable(struct drm_crtc *crtc,
        clk_disable_unprepare(fsl_dev->pix_clk);
 }
 
-static void fsl_dcu_drm_crtc_enable(struct drm_crtc *crtc)
+static void fsl_dcu_drm_crtc_atomic_enable(struct drm_crtc *crtc,
+                                          struct drm_crtc_state *old_state)
 {
        struct drm_device *dev = crtc->dev;
        struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -133,7 +134,7 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static const struct drm_crtc_helper_funcs fsl_dcu_drm_crtc_helper_funcs = {
        .atomic_disable = fsl_dcu_drm_crtc_atomic_disable,
        .atomic_flush = fsl_dcu_drm_crtc_atomic_flush,
-       .enable = fsl_dcu_drm_crtc_enable,
+       .atomic_enable = fsl_dcu_drm_crtc_atomic_enable,
        .mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb,
 };
 
index 59542bddc9802838316d2a04e9a023ff546de014..49ef47c0c81ab928f153ede38c8dcf4ec151bac3 100644 (file)
@@ -192,7 +192,8 @@ static struct drm_plane *hibmc_plane_init(struct hibmc_drm_private *priv)
        return plane;
 }
 
-static void hibmc_crtc_enable(struct drm_crtc *crtc)
+static void hibmc_crtc_atomic_enable(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *old_state)
 {
        unsigned int reg;
        struct hibmc_drm_private *priv = crtc->dev->dev_private;
@@ -453,11 +454,11 @@ static const struct drm_crtc_funcs hibmc_crtc_funcs = {
 };
 
 static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
-       .enable         = hibmc_crtc_enable,
        .disable        = hibmc_crtc_disable,
        .mode_set_nofb  = hibmc_crtc_mode_set_nofb,
        .atomic_begin   = hibmc_crtc_atomic_begin,
        .atomic_flush   = hibmc_crtc_atomic_flush,
+       .atomic_enable  = hibmc_crtc_atomic_enable,
 };
 
 int hibmc_de_init(struct hibmc_drm_private *priv)
index c96c228a98980810d220eec84b2a8a3326e0c487..8e00818b24fc2305da04f5f396de5edf81c73f2b 100644 (file)
@@ -467,7 +467,8 @@ static void ade_dump_regs(void __iomem *base)
 static void ade_dump_regs(void __iomem *base) { }
 #endif
 
-static void ade_crtc_enable(struct drm_crtc *crtc)
+static void ade_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        struct ade_crtc *acrtc = to_ade_crtc(crtc);
        struct ade_hw_ctx *ctx = acrtc->ctx;
@@ -553,11 +554,11 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs ade_crtc_helper_funcs = {
-       .enable         = ade_crtc_enable,
        .disable        = ade_crtc_disable,
        .mode_set_nofb  = ade_crtc_mode_set_nofb,
        .atomic_begin   = ade_crtc_atomic_begin,
        .atomic_flush   = ade_crtc_atomic_flush,
+       .atomic_enable  = ade_crtc_atomic_enable,
 };
 
 static const struct drm_crtc_funcs ade_crtc_funcs = {
index 5456c15d962c525a4879b9b8a2b9cf63814ffc12..53e0b24beda6e0e2ee44c57550d5c752393b5863 100644 (file)
@@ -50,7 +50,8 @@ static inline struct ipu_crtc *to_ipu_crtc(struct drm_crtc *crtc)
        return container_of(crtc, struct ipu_crtc, base);
 }
 
-static void ipu_crtc_enable(struct drm_crtc *crtc)
+static void ipu_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
        struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
@@ -293,7 +294,7 @@ static const struct drm_crtc_helper_funcs ipu_helper_funcs = {
        .atomic_check = ipu_crtc_atomic_check,
        .atomic_begin = ipu_crtc_atomic_begin,
        .atomic_disable = ipu_crtc_atomic_disable,
-       .enable = ipu_crtc_enable,
+       .atomic_enable = ipu_crtc_atomic_enable,
 };
 
 static void ipu_put_resources(struct ipu_crtc *ipu_crtc)
index 6582e1f56d37cfb23bcf54a740ddf22a207c7ded..5971b0827d1b342fa9fe8fe200c0823d2787bbbd 100644 (file)
@@ -366,7 +366,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc)
        }
 }
 
-static void mtk_drm_crtc_enable(struct drm_crtc *crtc)
+static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
        struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
        struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
@@ -487,10 +488,10 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = {
 static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
        .mode_fixup     = mtk_drm_crtc_mode_fixup,
        .mode_set_nofb  = mtk_drm_crtc_mode_set_nofb,
-       .enable         = mtk_drm_crtc_enable,
        .disable        = mtk_drm_crtc_disable,
        .atomic_begin   = mtk_drm_crtc_atomic_begin,
        .atomic_flush   = mtk_drm_crtc_atomic_flush,
+       .atomic_enable  = mtk_drm_crtc_atomic_enable,
 };
 
 static int mtk_drm_crtc_init(struct drm_device *drm,
index c986eb03b9d98d57356c016375878a593f13cf09..6f148307b0e091610975363f910f3a9255ec7d35 100644 (file)
@@ -79,7 +79,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = {
 
 };
 
-static void meson_crtc_enable(struct drm_crtc *crtc)
+static void meson_crtc_atomic_enable(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *old_state)
 {
        struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
        struct drm_crtc_state *crtc_state = crtc->state;
@@ -149,10 +150,10 @@ static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs meson_crtc_helper_funcs = {
-       .enable         = meson_crtc_enable,
        .disable        = meson_crtc_disable,
        .atomic_begin   = meson_crtc_atomic_begin,
        .atomic_flush   = meson_crtc_atomic_flush,
+       .atomic_enable  = meson_crtc_atomic_enable,
 };
 
 void meson_crtc_irq(struct meson_drm *priv)
index 615e1def64d9482f2609f0545652f340d4d9743f..9c20133f3f8d53bc84b8a7a899cb41d5ecdeedf0 100644 (file)
@@ -295,7 +295,8 @@ static void mdp4_crtc_disable(struct drm_crtc *crtc)
        mdp4_crtc->enabled = false;
 }
 
-static void mdp4_crtc_enable(struct drm_crtc *crtc)
+static void mdp4_crtc_atomic_enable(struct drm_crtc *crtc,
+                                   struct drm_crtc_state *old_state)
 {
        struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
        struct mdp4_kms *mdp4_kms = get_kms(crtc);
@@ -493,10 +494,10 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
        .mode_set_nofb = mdp4_crtc_mode_set_nofb,
        .disable = mdp4_crtc_disable,
-       .enable = mdp4_crtc_enable,
        .atomic_check = mdp4_crtc_atomic_check,
        .atomic_begin = mdp4_crtc_atomic_begin,
        .atomic_flush = mdp4_crtc_atomic_flush,
+       .atomic_enable = mdp4_crtc_atomic_enable,
 };
 
 static void mdp4_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
index cb5415d6c04b7ab6e1e80503d26b32891a934dee..d39d9d24d16958fc8751990ddc89205b4c513a69 100644 (file)
@@ -429,7 +429,8 @@ static void mdp5_crtc_disable(struct drm_crtc *crtc)
        mdp5_crtc->enabled = false;
 }
 
-static void mdp5_crtc_enable(struct drm_crtc *crtc)
+static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
+                                   struct drm_crtc_state *old_state)
 {
        struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
        struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
@@ -940,10 +941,10 @@ static const struct drm_crtc_funcs mdp5_crtc_no_lm_cursor_funcs = {
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
        .mode_set_nofb = mdp5_crtc_mode_set_nofb,
        .disable = mdp5_crtc_disable,
-       .enable = mdp5_crtc_enable,
        .atomic_check = mdp5_crtc_atomic_check,
        .atomic_begin = mdp5_crtc_atomic_begin,
        .atomic_flush = mdp5_crtc_atomic_flush,
+       .atomic_enable = mdp5_crtc_atomic_enable,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
index dd0ef40ca46929ee192b6e2bcf7fbc9a44721d84..7a1b7a9cc270884b543cae24998917fe14066e0a 100644 (file)
@@ -356,7 +356,8 @@ static void omap_crtc_arm_event(struct drm_crtc *crtc)
        }
 }
 
-static void omap_crtc_enable(struct drm_crtc *crtc)
+static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
+                                   struct drm_crtc_state *old_state)
 {
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
        int ret;
@@ -568,10 +569,10 @@ static const struct drm_crtc_funcs omap_crtc_funcs = {
 static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = {
        .mode_set_nofb = omap_crtc_mode_set_nofb,
        .disable = omap_crtc_disable,
-       .enable = omap_crtc_enable,
        .atomic_check = omap_crtc_atomic_check,
        .atomic_begin = omap_crtc_atomic_begin,
        .atomic_flush = omap_crtc_atomic_flush,
+       .atomic_enable = omap_crtc_atomic_enable,
 };
 
 /* -----------------------------------------------------------------------------
index 7ede5f131a5cddf6442e4ced0861c9e927e1ab9c..ea95e7e7cc7fe34b88a59c4b8383aa6f615e3a89 100644 (file)
@@ -447,7 +447,8 @@ static void qxl_mode_set_nofb(struct drm_crtc *crtc)
 
 }
 
-static void qxl_crtc_enable(struct drm_crtc *crtc)
+static void qxl_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        DRM_DEBUG("\n");
 }
@@ -466,8 +467,8 @@ static const struct drm_crtc_helper_funcs qxl_crtc_helper_funcs = {
        .disable = qxl_crtc_disable,
        .mode_fixup = qxl_crtc_mode_fixup,
        .mode_set_nofb = qxl_mode_set_nofb,
-       .enable = qxl_crtc_enable,
        .atomic_flush = qxl_crtc_atomic_flush,
+       .atomic_enable = qxl_crtc_atomic_enable,
 };
 
 static int qxl_primary_atomic_check(struct drm_plane *plane,
index 345eff72f581943a6d7b25c63644e274cc2cf394..6aa3fa8d06f986a844736512fd44f89d3e6f8202 100644 (file)
@@ -552,7 +552,8 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc)
  * CRTC Functions
  */
 
-static void rcar_du_crtc_enable(struct drm_crtc *crtc)
+static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
        struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
 
@@ -610,9 +611,9 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
 
 static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
        .disable = rcar_du_crtc_disable,
-       .enable = rcar_du_crtc_enable,
        .atomic_begin = rcar_du_crtc_atomic_begin,
        .atomic_flush = rcar_du_crtc_atomic_flush,
+       .atomic_enable = rcar_du_crtc_atomic_enable,
 };
 
 static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)
index 5d450332c2fd79fd8c1052aca84d7d15c5db3ef8..bb59f7410634e07160a2f99741b81fca874950c5 100644 (file)
@@ -871,7 +871,8 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
        return true;
 }
 
-static void vop_crtc_enable(struct drm_crtc *crtc)
+static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        struct vop *vop = to_vop(crtc);
        const struct vop_data *vop_data = vop->data;
@@ -1079,11 +1080,11 @@ static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = {
-       .enable = vop_crtc_enable,
        .disable = vop_crtc_disable,
        .mode_fixup = vop_crtc_mode_fixup,
        .atomic_flush = vop_crtc_atomic_flush,
        .atomic_begin = vop_crtc_atomic_begin,
+       .atomic_enable = vop_crtc_atomic_enable,
 };
 
 static void vop_crtc_destroy(struct drm_crtc *crtc)
index d45a4335df5df92a213be2119eb84d792aa59c3f..bb864345fedfa92d6c88a408f0202b2993fea36c 100644 (file)
@@ -20,7 +20,8 @@
 #include "sti_vid.h"
 #include "sti_vtg.h"
 
-static void sti_crtc_enable(struct drm_crtc *crtc)
+static void sti_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        struct sti_mixer *mixer = to_sti_mixer(crtc);
 
@@ -222,10 +223,10 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
-       .enable = sti_crtc_enable,
        .disable = sti_crtc_disabling,
        .mode_set_nofb = sti_crtc_mode_set_nofb,
        .atomic_flush = sti_crtc_atomic_flush,
+       .atomic_enable = sti_crtc_atomic_enable,
 };
 
 static void sti_crtc_destroy(struct drm_crtc *crtc)
index 1b9483d4f2a4ec3b80dea15acdd38ca730733381..337fce004d088217f1940ec01816aecf941aa7f5 100644 (file)
@@ -386,7 +386,8 @@ static void ltdc_crtc_load_lut(struct drm_crtc *crtc)
                                  ldev->clut[i]);
 }
 
-static void ltdc_crtc_enable(struct drm_crtc *crtc)
+static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
+                                   struct drm_crtc_state *old_state)
 {
        struct ltdc_device *ldev = crtc_to_ltdc(crtc);
 
@@ -524,10 +525,10 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 
 static struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
        .load_lut = ltdc_crtc_load_lut,
-       .enable = ltdc_crtc_enable,
        .disable = ltdc_crtc_disable,
        .mode_set_nofb = ltdc_crtc_mode_set_nofb,
        .atomic_flush = ltdc_crtc_atomic_flush,
+       .atomic_enable = ltdc_crtc_atomic_enable,
 };
 
 int ltdc_crtc_enable_vblank(struct drm_device *ddev, unsigned int pipe)
index f8c70439d1e2f030b9173deace6bc1700afa0fa1..509e4d8014f36cb4f71a4925f2c2153de3fffcfb 100644 (file)
@@ -86,7 +86,8 @@ static void sun4i_crtc_disable(struct drm_crtc *crtc)
        }
 }
 
-static void sun4i_crtc_enable(struct drm_crtc *crtc)
+static void sun4i_crtc_atomic_enable(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *old_state)
 {
        struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
 
@@ -98,8 +99,8 @@ static void sun4i_crtc_enable(struct drm_crtc *crtc)
 static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
        .atomic_begin   = sun4i_crtc_atomic_begin,
        .atomic_flush   = sun4i_crtc_atomic_flush,
+       .atomic_enable  = sun4i_crtc_atomic_enable,
        .disable        = sun4i_crtc_disable,
-       .enable         = sun4i_crtc_enable,
 };
 
 static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc)
index c875f11786b933612e85cdeba677ecb706130954..2e0d167cb657a16a0c9991b651e772b542261156 100644 (file)
@@ -1243,7 +1243,8 @@ static void tegra_crtc_disable(struct drm_crtc *crtc)
        pm_runtime_put_sync(dc->dev);
 }
 
-static void tegra_crtc_enable(struct drm_crtc *crtc)
+static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *old_state)
 {
        struct drm_display_mode *mode = &crtc->state->adjusted_mode;
        struct tegra_dc_state *state = to_dc_state(crtc->state);
@@ -1352,10 +1353,10 @@ static void tegra_crtc_atomic_flush(struct drm_crtc *crtc,
 
 static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = {
        .disable = tegra_crtc_disable,
-       .enable = tegra_crtc_enable,
        .atomic_check = tegra_crtc_atomic_check,
        .atomic_begin = tegra_crtc_atomic_begin,
        .atomic_flush = tegra_crtc_atomic_flush,
+       .atomic_enable = tegra_crtc_atomic_enable,
 };
 
 static irqreturn_t tegra_dc_irq(int irq, void *data)
index d524ed0d5146ca8ee0caf9e1a290163af0470f46..6c5892763d27f31b4d5288d115e615a04b166ede 100644 (file)
@@ -504,6 +504,12 @@ static void tilcdc_crtc_enable(struct drm_crtc *crtc)
        mutex_unlock(&tilcdc_crtc->enable_lock);
 }
 
+static void tilcdc_crtc_atomic_enable(struct drm_crtc *crtc,
+                                     struct drm_crtc_state *old_state)
+{
+       tilcdc_crtc_enable(crtc);
+}
+
 static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown)
 {
        struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
@@ -729,9 +735,9 @@ static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
 
 static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
                .mode_fixup     = tilcdc_crtc_mode_fixup,
-               .enable         = tilcdc_crtc_enable,
                .disable        = tilcdc_crtc_disable,
                .atomic_check   = tilcdc_crtc_atomic_check,
+               .atomic_enable  = tilcdc_crtc_atomic_enable,
 };
 
 int tilcdc_crtc_max_width(struct drm_crtc *crtc)
index f20c01759c0d30128094d1a931b952665548d613..4c03a565b2765c8385b87bc77fa79f81b19eaaf9 100644 (file)
@@ -533,7 +533,8 @@ static void vc4_crtc_disable(struct drm_crtc *crtc)
        }
 }
 
-static void vc4_crtc_enable(struct drm_crtc *crtc)
+static void vc4_crtc_atomic_enable(struct drm_crtc *crtc,
+                                  struct drm_crtc_state *old_state)
 {
        struct drm_device *dev = crtc->dev;
        struct vc4_dev *vc4 = to_vc4_dev(dev);
@@ -870,10 +871,10 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
        .mode_set_nofb = vc4_crtc_mode_set_nofb,
        .disable = vc4_crtc_disable,
-       .enable = vc4_crtc_enable,
        .mode_valid = vc4_crtc_mode_valid,
        .atomic_check = vc4_crtc_atomic_check,
        .atomic_flush = vc4_crtc_atomic_flush,
+       .atomic_enable = vc4_crtc_atomic_enable,
 };
 
 static const struct vc4_crtc_data pv0_data = {
index d51bd4521f170df0ab60472892fb013ff9989c42..03a3c12ed10074501b0206d53edbb7f62fd7dab0 100644 (file)
@@ -113,7 +113,8 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
                                   crtc->mode.vdisplay, 0, 0);
 }
 
-static void virtio_gpu_crtc_enable(struct drm_crtc *crtc)
+static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
+                                         struct drm_crtc_state *old_state)
 {
 }
 
@@ -145,11 +146,11 @@ static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
-       .enable        = virtio_gpu_crtc_enable,
        .disable       = virtio_gpu_crtc_disable,
        .mode_set_nofb = virtio_gpu_crtc_mode_set_nofb,
        .atomic_check  = virtio_gpu_crtc_atomic_check,
        .atomic_flush  = virtio_gpu_crtc_atomic_flush,
+       .atomic_enable = virtio_gpu_crtc_atomic_enable,
 };
 
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
index f8acd3a15523851635900aed3388981b3ea943cf..832b83c582c2cc639caa7c7ca905d53433fd79e0 100644 (file)
@@ -203,7 +203,7 @@ static void vmw_ldu_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 /**
- * vmw_ldu_crtc_helper_enable - Noop
+ * vmw_ldu_crtc_atomic_enable - Noop
  *
  * @crtc: CRTC associated with the new screen
  *
@@ -212,7 +212,8 @@ static void vmw_ldu_crtc_mode_set_nofb(struct drm_crtc *crtc)
  * but since for LDU the display plane is closely tied to the
  * CRTC, it makes more sense to do those at plane update time.
  */
-static void vmw_ldu_crtc_helper_enable(struct drm_crtc *crtc)
+static void vmw_ldu_crtc_atomic_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
 }
 
@@ -376,12 +377,12 @@ drm_plane_helper_funcs vmw_ldu_primary_plane_helper_funcs = {
 };
 
 static const struct drm_crtc_helper_funcs vmw_ldu_crtc_helper_funcs = {
-       .enable = vmw_ldu_crtc_helper_enable,
        .disable = vmw_ldu_crtc_helper_disable,
        .mode_set_nofb = vmw_ldu_crtc_mode_set_nofb,
        .atomic_check = vmw_du_crtc_atomic_check,
        .atomic_begin = vmw_du_crtc_atomic_begin,
        .atomic_flush = vmw_du_crtc_atomic_flush,
+       .atomic_enable = vmw_ldu_crtc_atomic_enable,
 };
 
 
index 1cb826c503bfb673f20444ba279c64a011e238e1..8ba3bad06909f557f42c449a86429584cea83f43 100644 (file)
@@ -270,13 +270,14 @@ static void vmw_sou_crtc_helper_prepare(struct drm_crtc *crtc)
 }
 
 /**
- * vmw_sou_crtc_helper_enable - Noop
+ * vmw_sou_crtc_atomic_enable - Noop
  *
  * @crtc: CRTC associated with the new screen
  *
  * This is called after a mode set has been completed.
  */
-static void vmw_sou_crtc_helper_enable(struct drm_crtc *crtc)
+static void vmw_sou_crtc_atomic_enable(struct drm_crtc *crtc,
+                                      struct drm_crtc_state *old_state)
 {
 }
 
@@ -573,12 +574,12 @@ drm_plane_helper_funcs vmw_sou_primary_plane_helper_funcs = {
 
 static const struct drm_crtc_helper_funcs vmw_sou_crtc_helper_funcs = {
        .prepare = vmw_sou_crtc_helper_prepare,
-       .enable = vmw_sou_crtc_helper_enable,
        .disable = vmw_sou_crtc_helper_disable,
        .mode_set_nofb = vmw_sou_crtc_mode_set_nofb,
        .atomic_check = vmw_du_crtc_atomic_check,
        .atomic_begin = vmw_du_crtc_atomic_begin,
        .atomic_flush = vmw_du_crtc_atomic_flush,
+       .atomic_enable = vmw_sou_crtc_atomic_enable,
 };
 
 
index 4eb93b47d6dbb73a8fa7eba419e4298826fd6f0b..f2b39d9c51cc4c94b95e0c3e1ab95cff083c9562 100644 (file)
@@ -412,7 +412,8 @@ static void vmw_stdu_crtc_helper_prepare(struct drm_crtc *crtc)
 }
 
 
-static void vmw_stdu_crtc_helper_enable(struct drm_crtc *crtc)
+static void vmw_stdu_crtc_atomic_enable(struct drm_crtc *crtc,
+                                       struct drm_crtc_state *old_state)
 {
        struct vmw_private *dev_priv;
        struct vmw_screen_target_display_unit *stdu;
@@ -1415,12 +1416,12 @@ drm_plane_helper_funcs vmw_stdu_primary_plane_helper_funcs = {
 
 static const struct drm_crtc_helper_funcs vmw_stdu_crtc_helper_funcs = {
        .prepare = vmw_stdu_crtc_helper_prepare,
-       .enable = vmw_stdu_crtc_helper_enable,
        .disable = vmw_stdu_crtc_helper_disable,
        .mode_set_nofb = vmw_stdu_crtc_mode_set_nofb,
        .atomic_check = vmw_du_crtc_atomic_check,
        .atomic_begin = vmw_du_crtc_atomic_begin,
        .atomic_flush = vmw_du_crtc_atomic_flush,
+       .atomic_enable = vmw_stdu_crtc_atomic_enable,
 };
 
 
index 5fbd10b60ee516de96c48bf5f4eb09558a2b64c8..ccb4b0bdb8c65c1b8bb68b5db7a91967c7f87713 100644 (file)
@@ -350,7 +350,8 @@ static inline void vou_chn_set_update(struct zx_crtc *zcrtc)
        zx_writel(zcrtc->chnreg + CHN_UPDATE, 1);
 }
 
-static void zx_crtc_enable(struct drm_crtc *crtc)
+static void zx_crtc_atomic_enable(struct drm_crtc *crtc,
+                                 struct drm_crtc_state *old_state)
 {
        struct drm_display_mode *mode = &crtc->state->adjusted_mode;
        bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE;
@@ -490,9 +491,9 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs zx_crtc_helper_funcs = {
-       .enable = zx_crtc_enable,
        .disable = zx_crtc_disable,
        .atomic_flush = zx_crtc_atomic_flush,
+       .atomic_enable = zx_crtc_atomic_enable,
 };
 
 static int zx_vou_enable_vblank(struct drm_crtc *crtc)
index 474a1029ec7941a374b396b8f08a71d2bb2fdd5c..c85124f687baab4669518d6cc37caebc0fb732ce 100644 (file)
@@ -71,7 +71,7 @@ struct drm_crtc_helper_funcs {
         * This callback is used by the legacy CRTC helpers.  Atomic helpers
         * also support using this hook for enabling and disabling a CRTC to
         * facilitate transitions to atomic, but it is deprecated. Instead
-        * @enable and @disable should be used.
+        * @atomic_enable and @atomic_disable should be used.
         */
        void (*dpms)(struct drm_crtc *crtc, int mode);
 
@@ -85,8 +85,8 @@ struct drm_crtc_helper_funcs {
         *
         * This callback is used by the legacy CRTC helpers.  Atomic helpers
         * also support using this hook for disabling a CRTC to facilitate
-        * transitions to atomic, but it is deprecated. Instead @disable should
-        * be used.
+        * transitions to atomic, but it is deprecated. Instead @atomic_disable
+        * should be used.
         */
        void (*prepare)(struct drm_crtc *crtc);
 
@@ -100,8 +100,8 @@ struct drm_crtc_helper_funcs {
         *
         * This callback is used by the legacy CRTC helpers.  Atomic helpers
         * also support using this hook for enabling a CRTC to facilitate
-        * transitions to atomic, but it is deprecated. Instead @enable should
-        * be used.
+        * transitions to atomic, but it is deprecated. Instead @atomic_enable
+        * should be used.
         */
        void (*commit)(struct drm_crtc *crtc);
 
@@ -222,7 +222,7 @@ struct drm_crtc_helper_funcs {
         * pipeline is suspended using either DPMS or the new "ACTIVE" property.
         * Which means register values set in this callback might get reset when
         * the CRTC is suspended, but not restored.  Such drivers should instead
-        * move all their CRTC setup into the @enable callback.
+        * move all their CRTC setup into the @atomic_enable callback.
         *
         * This callback is optional.
         */
@@ -297,7 +297,7 @@ struct drm_crtc_helper_funcs {
         * Atomic drivers don't need to implement it if there's no need to
         * disable anything at the CRTC level. To ensure that runtime PM
         * handling (using either DPMS or the new "ACTIVE" property) works
-        * @disable must be the inverse of @enable for atomic drivers.
+        * @disable must be the inverse of @atomic_enable for atomic drivers.
         * Atomic drivers should consider to use @atomic_disable instead of
         * this one.
         *
@@ -315,24 +315,6 @@ struct drm_crtc_helper_funcs {
         */
        void (*disable)(struct drm_crtc *crtc);
 
-       /**
-        * @enable:
-        *
-        * This callback should be used to enable the CRTC. With the atomic
-        * drivers it is called before all encoders connected to this CRTC are
-        * enabled through the encoder's own &drm_encoder_helper_funcs.enable
-        * hook.  If that sequence is too simple drivers can just add their own
-        * hooks and call it from this CRTC callback here by looping over all
-        * encoders connected to it using for_each_encoder_on_crtc().
-        *
-        * This hook is used only by atomic helpers, for symmetry with @disable.
-        * Atomic drivers don't need to implement it if there's no need to
-        * enable anything at the CRTC level. To ensure that runtime PM handling
-        * (using either DPMS or the new "ACTIVE" property) works
-        * @enable must be the inverse of @disable for atomic drivers.
-        */
-       void (*enable)(struct drm_crtc *crtc);
-
        /**
         * @atomic_check:
         *
@@ -432,6 +414,30 @@ struct drm_crtc_helper_funcs {
        void (*atomic_flush)(struct drm_crtc *crtc,
                             struct drm_crtc_state *old_crtc_state);
 
+       /**
+        * @atomic_enable:
+        *
+        * This callback should be used to enable the CRTC. With the atomic
+        * drivers it is called before all encoders connected to this CRTC are
+        * enabled through the encoder's own &drm_encoder_helper_funcs.enable
+        * hook.  If that sequence is too simple drivers can just add their own
+        * hooks and call it from this CRTC callback here by looping over all
+        * encoders connected to it using for_each_encoder_on_crtc().
+        *
+        * This hook is used only by atomic helpers, for symmetry with
+        * @atomic_disable. Atomic drivers don't need to implement it if there's
+        * no need to enable anything at the CRTC level. To ensure that runtime
+        * PM handling (using either DPMS or the new "ACTIVE" property) works
+        * @atomic_enable must be the inverse of @atomic_disable for atomic
+        * drivers.
+        *
+        * Drivers can use the @old_crtc_state input parameter if the operations
+        * needed to enable the CRTC don't depend solely on the new state but
+        * also on the transition between the old state and the new state.
+        */
+       void (*atomic_enable)(struct drm_crtc *crtc,
+                             struct drm_crtc_state *old_crtc_state);
+
        /**
         * @atomic_disable:
         *