1 From 0dd369ae91c3c4d2db2aa292935d12db5a0d97e1 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 28 Oct 2020 13:32:22 +0100
4 Subject: [PATCH] drm/atomic: Pass the full state to CRTC atomic begin
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Commit f6ebe9f9c9233a6114eb922aba9a0c9ccc2d2e14 upstream.
12 The current atomic helpers have either their object state being passed as
13 an argument or the full atomic state.
15 The former is the pattern that was done at first, before switching to the
16 latter for new hooks or when it was needed.
18 Let's start convert all the remaining helpers to provide a consistent
19 interface, starting with the CRTC's atomic_begin and atomic_flush.
21 The conversion was done using the coccinelle script below, built tested on
22 all the drivers and actually tested on vc4.
27 struct drm_crtc_helper_funcs *FUNCS;
28 identifier old_crtc_state, old_state;
33 f(struct drm_crtc_state *old_crtc_state)
36 struct drm_atomic_state *old_state = old_crtc_state->state;
38 - FUNCS->atomic_begin(crtc, old_crtc_state);
39 + FUNCS->atomic_begin(crtc, old_state);
44 struct drm_crtc_helper_funcs *FUNCS;
45 identifier old_crtc_state, old_state;
50 f(struct drm_crtc_state *old_crtc_state)
53 struct drm_atomic_state *old_state = old_crtc_state->state;
55 - FUNCS->atomic_flush(crtc, old_crtc_state);
56 + FUNCS->atomic_flush(crtc, old_state);
61 struct drm_crtc_helper_funcs *FUNCS;
62 struct drm_crtc *crtc;
63 struct drm_crtc_state *crtc_state;
64 identifier dev, state;
68 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
71 - FUNCS->atomic_begin(crtc, crtc_state);
72 + FUNCS->atomic_begin(crtc, state);
77 struct drm_crtc_helper_funcs *FUNCS;
78 struct drm_crtc *crtc;
79 struct drm_crtc_state *crtc_state;
80 identifier dev, state;
84 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
87 - FUNCS->atomic_flush(crtc, crtc_state);
88 + FUNCS->atomic_flush(crtc, state);
93 identifier crtc, old_state;
96 struct drm_crtc_helper_funcs {
98 - void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
99 + void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
101 - void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
102 + void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
112 static struct drm_crtc_helper_funcs helpers = {
114 .atomic_begin = func,
118 static struct drm_crtc_helper_funcs helpers = {
120 .atomic_flush = func,
125 @ ignores_old_state @
126 identifier crtc_atomic_func.func;
127 identifier crtc, old_state;
130 void func(struct drm_crtc *crtc,
131 struct drm_crtc_state *old_state)
133 ... when != old_state
136 @ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
137 identifier crtc_atomic_func.func;
138 identifier crtc, old_state;
141 void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
143 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
147 @ depends on crtc_atomic_func @
148 identifier crtc_atomic_func.func;
165 @ depends on crtc_atomic_func @
166 identifier crtc_atomic_func.func;
183 identifier old_state;
187 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
188 - struct drm_crtc_state *old_state
189 + struct drm_atomic_state *state
192 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
197 identifier old_state;
201 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
202 - struct drm_crtc_state *old_state
203 + struct drm_atomic_state *state
207 identifier old_state;
211 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
212 - struct drm_crtc_state *old_state
213 + struct drm_atomic_state *state
220 identifier old_state;
224 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
225 - struct drm_crtc_state *old_state
226 + struct drm_atomic_state *state
230 identifier old_state;
234 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
235 - struct drm_crtc_state *old_state
236 + struct drm_atomic_state *state
243 identifier old_state;
247 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
248 - struct drm_crtc_state *old_state
249 + struct drm_atomic_state *state
252 @ depends on crtc_atomic_func @
253 identifier crtc_atomic_func.func;
254 identifier old_state;
258 void func(struct drm_crtc *crtc,
259 - struct drm_crtc_state *old_state
260 + struct drm_atomic_state *state
264 @ include depends on adds_old_state @
267 #include <drm/drm_atomic.h>
269 @ no_include depends on !include && adds_old_state @
272 + #include <drm/drm_atomic.h>
275 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
276 Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
277 Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
278 Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
279 Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
281 drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 4 +++-
282 drivers/gpu/drm/arm/hdlcd_crtc.c | 2 +-
283 drivers/gpu/drm/armada/armada_crtc.c | 4 ++--
284 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
285 drivers/gpu/drm/drm_atomic_helper.c | 8 ++++----
286 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++--
287 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 2 +-
288 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 4 ++--
289 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 4 ++--
290 drivers/gpu/drm/imx/dcss/dcss-crtc.c | 4 ++--
291 drivers/gpu/drm/imx/ipuv3-crtc.c | 4 ++--
292 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 14 +++++++-------
293 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 16 ++++++++--------
294 drivers/gpu/drm/meson/meson_crtc.c | 4 ++--
295 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 ++--
296 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 ++--
297 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 ++--
298 drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 +-
299 drivers/gpu/drm/omapdrm/omap_crtc.c | 4 ++--
300 drivers/gpu/drm/qxl/qxl_display.c | 2 +-
301 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++--
302 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 ++++++--
303 drivers/gpu/drm/sti/sti_crtc.c | 2 +-
304 drivers/gpu/drm/stm/ltdc.c | 2 +-
305 drivers/gpu/drm/sun4i/sun4i_crtc.c | 6 ++++--
306 drivers/gpu/drm/tegra/dc.c | 10 +++++-----
307 drivers/gpu/drm/tidss/tidss_crtc.c | 4 +++-
308 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
309 drivers/gpu/drm/vboxvideo/vbox_mode.c | 2 +-
310 drivers/gpu/drm/vc4/vc4_drv.h | 3 ++-
311 drivers/gpu/drm/vc4/vc4_hvs.c | 4 +++-
312 drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
313 drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++--
314 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++--
315 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 ++--
316 drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 ++--
317 drivers/gpu/drm/zte/zx_vou.c | 2 +-
318 include/drm/drm_modeset_helper_vtables.h | 4 ++--
319 38 files changed, 91 insertions(+), 78 deletions(-)
321 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
322 +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
323 @@ -385,8 +385,10 @@ komeda_crtc_atomic_disable(struct drm_cr
326 komeda_crtc_atomic_flush(struct drm_crtc *crtc,
327 - struct drm_crtc_state *old)
328 + struct drm_atomic_state *state)
330 + struct drm_crtc_state *old = drm_atomic_get_old_crtc_state(state,
332 /* commit with modeset will be handled in enable/disable */
333 if (drm_atomic_crtc_needs_modeset(crtc->state))
335 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
336 +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
337 @@ -205,7 +205,7 @@ static enum drm_mode_status hdlcd_crtc_m
340 static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
341 - struct drm_crtc_state *state)
342 + struct drm_atomic_state *state)
344 struct drm_pending_vblank_event *event = crtc->state->event;
346 --- a/drivers/gpu/drm/armada/armada_crtc.c
347 +++ b/drivers/gpu/drm/armada/armada_crtc.c
348 @@ -429,7 +429,7 @@ static int armada_drm_crtc_atomic_check(
351 static void armada_drm_crtc_atomic_begin(struct drm_crtc *crtc,
352 - struct drm_crtc_state *old_crtc_state)
353 + struct drm_atomic_state *state)
355 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
357 @@ -443,7 +443,7 @@ static void armada_drm_crtc_atomic_begin
360 static void armada_drm_crtc_atomic_flush(struct drm_crtc *crtc,
361 - struct drm_crtc_state *old_crtc_state)
362 + struct drm_atomic_state *state)
364 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
366 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
367 +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
368 @@ -342,7 +342,7 @@ static int atmel_hlcdc_crtc_atomic_check
371 static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
372 - struct drm_crtc_state *old_s)
373 + struct drm_atomic_state *state)
375 struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
377 @@ -357,7 +357,7 @@ static void atmel_hlcdc_crtc_atomic_begi
380 static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
381 - struct drm_crtc_state *old_s)
382 + struct drm_atomic_state *state)
384 /* TODO: write common plane control register if available */
386 --- a/drivers/gpu/drm/drm_atomic_helper.c
387 +++ b/drivers/gpu/drm/drm_atomic_helper.c
388 @@ -2507,7 +2507,7 @@ void drm_atomic_helper_commit_planes(str
389 if (active_only && !new_crtc_state->active)
392 - funcs->atomic_begin(crtc, old_crtc_state);
393 + funcs->atomic_begin(crtc, old_state);
396 for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) {
397 @@ -2565,7 +2565,7 @@ void drm_atomic_helper_commit_planes(str
398 if (active_only && !new_crtc_state->active)
401 - funcs->atomic_flush(crtc, old_crtc_state);
402 + funcs->atomic_flush(crtc, old_state);
405 EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
406 @@ -2603,7 +2603,7 @@ drm_atomic_helper_commit_planes_on_crtc(
408 crtc_funcs = crtc->helper_private;
409 if (crtc_funcs && crtc_funcs->atomic_begin)
410 - crtc_funcs->atomic_begin(crtc, old_crtc_state);
411 + crtc_funcs->atomic_begin(crtc, old_state);
413 drm_for_each_plane_mask(plane, crtc->dev, plane_mask) {
414 struct drm_plane_state *old_plane_state =
415 @@ -2629,7 +2629,7 @@ drm_atomic_helper_commit_planes_on_crtc(
418 if (crtc_funcs && crtc_funcs->atomic_flush)
419 - crtc_funcs->atomic_flush(crtc, old_crtc_state);
420 + crtc_funcs->atomic_flush(crtc, old_state);
422 EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
424 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
425 +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
426 @@ -65,7 +65,7 @@ static int exynos_crtc_atomic_check(stru
429 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
430 - struct drm_crtc_state *old_crtc_state)
431 + struct drm_atomic_state *state)
433 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
435 @@ -74,7 +74,7 @@ static void exynos_crtc_atomic_begin(str
438 static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
439 - struct drm_crtc_state *old_crtc_state)
440 + struct drm_atomic_state *state)
442 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
444 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
445 +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
447 #include "fsl_dcu_drm_plane.h"
449 static void fsl_dcu_drm_crtc_atomic_flush(struct drm_crtc *crtc,
450 - struct drm_crtc_state *old_crtc_state)
451 + struct drm_atomic_state *state)
453 struct drm_device *dev = crtc->dev;
454 struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
455 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
456 +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
457 @@ -393,7 +393,7 @@ static void hibmc_crtc_mode_set_nofb(str
460 static void hibmc_crtc_atomic_begin(struct drm_crtc *crtc,
461 - struct drm_crtc_state *old_state)
462 + struct drm_atomic_state *state)
465 struct drm_device *dev = crtc->dev;
466 @@ -413,7 +413,7 @@ static void hibmc_crtc_atomic_begin(stru
469 static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
470 - struct drm_crtc_state *old_state)
471 + struct drm_atomic_state *state)
475 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
476 +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
477 @@ -485,7 +485,7 @@ static void ade_crtc_mode_set_nofb(struc
480 static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
481 - struct drm_crtc_state *old_state)
482 + struct drm_atomic_state *state)
484 struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
485 struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
486 @@ -498,7 +498,7 @@ static void ade_crtc_atomic_begin(struct
489 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
490 - struct drm_crtc_state *old_state)
491 + struct drm_atomic_state *state)
494 struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
495 --- a/drivers/gpu/drm/imx/dcss/dcss-crtc.c
496 +++ b/drivers/gpu/drm/imx/dcss/dcss-crtc.c
497 @@ -53,13 +53,13 @@ static const struct drm_crtc_funcs dcss_
500 static void dcss_crtc_atomic_begin(struct drm_crtc *crtc,
501 - struct drm_crtc_state *old_crtc_state)
502 + struct drm_atomic_state *state)
504 drm_crtc_vblank_on(crtc);
507 static void dcss_crtc_atomic_flush(struct drm_crtc *crtc,
508 - struct drm_crtc_state *old_crtc_state)
509 + struct drm_atomic_state *state)
511 struct dcss_crtc *dcss_crtc = container_of(crtc, struct dcss_crtc,
513 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c
514 +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
515 @@ -240,13 +240,13 @@ static int ipu_crtc_atomic_check(struct
518 static void ipu_crtc_atomic_begin(struct drm_crtc *crtc,
519 - struct drm_crtc_state *old_crtc_state)
520 + struct drm_atomic_state *state)
522 drm_crtc_vblank_on(crtc);
525 static void ipu_crtc_atomic_flush(struct drm_crtc *crtc,
526 - struct drm_crtc_state *old_crtc_state)
527 + struct drm_atomic_state *state)
529 spin_lock_irq(&crtc->dev->event_lock);
530 if (crtc->state->event) {
531 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
532 +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
533 @@ -253,7 +253,7 @@ ingenic_drm_crtc_mode_valid(struct drm_c
536 static void ingenic_drm_crtc_atomic_begin(struct drm_crtc *crtc,
537 - struct drm_crtc_state *oldstate)
538 + struct drm_atomic_state *state)
540 struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
542 @@ -273,20 +273,20 @@ static void ingenic_drm_crtc_atomic_begi
545 static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
546 - struct drm_crtc_state *oldstate)
547 + struct drm_atomic_state *state)
549 struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
550 - struct drm_crtc_state *state = crtc->state;
551 - struct drm_pending_vblank_event *event = state->event;
552 + struct drm_crtc_state *crtc_state = crtc->state;
553 + struct drm_pending_vblank_event *event = crtc_state->event;
555 - if (drm_atomic_crtc_needs_modeset(state)) {
556 - ingenic_drm_crtc_update_timings(priv, &state->mode);
557 + if (drm_atomic_crtc_needs_modeset(crtc_state)) {
558 + ingenic_drm_crtc_update_timings(priv, &crtc_state->mode);
560 clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
564 - state->event = NULL;
565 + crtc_state->event = NULL;
567 spin_lock_irq(&crtc->dev->event_lock);
568 if (drm_crtc_vblank_get(crtc) == 0)
569 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
570 +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
571 @@ -575,24 +575,24 @@ static void mtk_drm_crtc_atomic_disable(
574 static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc,
575 - struct drm_crtc_state *old_crtc_state)
576 + struct drm_atomic_state *state)
578 - struct mtk_crtc_state *state = to_mtk_crtc_state(crtc->state);
579 + struct mtk_crtc_state *crtc_state = to_mtk_crtc_state(crtc->state);
580 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
582 - if (mtk_crtc->event && state->base.event)
583 + if (mtk_crtc->event && crtc_state->base.event)
584 DRM_ERROR("new event while there is still a pending event\n");
586 - if (state->base.event) {
587 - state->base.event->pipe = drm_crtc_index(crtc);
588 + if (crtc_state->base.event) {
589 + crtc_state->base.event->pipe = drm_crtc_index(crtc);
590 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
591 - mtk_crtc->event = state->base.event;
592 - state->base.event = NULL;
593 + mtk_crtc->event = crtc_state->base.event;
594 + crtc_state->base.event = NULL;
598 static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
599 - struct drm_crtc_state *old_crtc_state)
600 + struct drm_atomic_state *state)
602 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
604 --- a/drivers/gpu/drm/meson/meson_crtc.c
605 +++ b/drivers/gpu/drm/meson/meson_crtc.c
606 @@ -201,7 +201,7 @@ static void meson_crtc_atomic_disable(st
609 static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
610 - struct drm_crtc_state *state)
611 + struct drm_atomic_state *state)
613 struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
615 @@ -217,7 +217,7 @@ static void meson_crtc_atomic_begin(stru
618 static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
619 - struct drm_crtc_state *old_crtc_state)
620 + struct drm_atomic_state *state)
622 struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
623 struct meson_drm *priv = meson_crtc->priv;
624 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
625 +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
626 @@ -486,7 +486,7 @@ static void _dpu_crtc_setup_cp_blocks(st
629 static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
630 - struct drm_crtc_state *old_state)
631 + struct drm_atomic_state *state)
633 struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
634 struct drm_encoder *encoder;
635 @@ -527,7 +527,7 @@ static void dpu_crtc_atomic_begin(struct
638 static void dpu_crtc_atomic_flush(struct drm_crtc *crtc,
639 - struct drm_crtc_state *old_crtc_state)
640 + struct drm_atomic_state *state)
642 struct dpu_crtc *dpu_crtc;
643 struct drm_device *dev;
644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
645 +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
646 @@ -316,14 +316,14 @@ static int mdp4_crtc_atomic_check(struct
649 static void mdp4_crtc_atomic_begin(struct drm_crtc *crtc,
650 - struct drm_crtc_state *old_crtc_state)
651 + struct drm_atomic_state *state)
653 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
654 DBG("%s: begin", mdp4_crtc->name);
657 static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc,
658 - struct drm_crtc_state *old_crtc_state)
659 + struct drm_atomic_state *state)
661 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
662 struct drm_device *dev = crtc->dev;
663 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
664 +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
665 @@ -772,13 +772,13 @@ static int mdp5_crtc_atomic_check(struct
668 static void mdp5_crtc_atomic_begin(struct drm_crtc *crtc,
669 - struct drm_crtc_state *old_crtc_state)
670 + struct drm_atomic_state *state)
672 DBG("%s: begin", crtc->name);
675 static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc,
676 - struct drm_crtc_state *old_crtc_state)
677 + struct drm_atomic_state *state)
679 struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
680 struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
681 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
682 +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
683 @@ -326,7 +326,7 @@ static int mxsfb_crtc_atomic_check(struc
686 static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
687 - struct drm_crtc_state *old_state)
688 + struct drm_atomic_state *state)
690 struct drm_pending_vblank_event *event;
692 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
693 +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
694 @@ -601,12 +601,12 @@ static int omap_crtc_atomic_check(struct
697 static void omap_crtc_atomic_begin(struct drm_crtc *crtc,
698 - struct drm_crtc_state *old_crtc_state)
699 + struct drm_atomic_state *state)
703 static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
704 - struct drm_crtc_state *old_crtc_state)
705 + struct drm_atomic_state *state)
707 struct omap_drm_private *priv = crtc->dev->dev_private;
708 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
709 --- a/drivers/gpu/drm/qxl/qxl_display.c
710 +++ b/drivers/gpu/drm/qxl/qxl_display.c
711 @@ -373,7 +373,7 @@ static void qxl_crtc_update_monitors_con
714 static void qxl_crtc_atomic_flush(struct drm_crtc *crtc,
715 - struct drm_crtc_state *old_crtc_state)
716 + struct drm_atomic_state *state)
718 qxl_crtc_update_monitors_config(crtc, "flush");
720 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
721 +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
722 @@ -779,7 +779,7 @@ static void rcar_du_crtc_atomic_disable(
725 static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
726 - struct drm_crtc_state *old_crtc_state)
727 + struct drm_atomic_state *state)
729 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
731 @@ -808,7 +808,7 @@ static void rcar_du_crtc_atomic_begin(st
734 static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
735 - struct drm_crtc_state *old_crtc_state)
736 + struct drm_atomic_state *state)
738 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
739 struct drm_device *dev = rcrtc->crtc.dev;
740 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
741 +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
742 @@ -1247,8 +1247,10 @@ static void vop_crtc_gamma_set(struct vo
745 static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
746 - struct drm_crtc_state *old_crtc_state)
747 + struct drm_atomic_state *state)
749 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
751 struct vop *vop = to_vop(crtc);
754 @@ -1463,8 +1465,10 @@ static int vop_crtc_atomic_check(struct
757 static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
758 - struct drm_crtc_state *old_crtc_state)
759 + struct drm_atomic_state *state)
761 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
763 struct drm_atomic_state *old_state = old_crtc_state->state;
764 struct drm_plane_state *old_plane_state, *new_plane_state;
765 struct vop *vop = to_vop(crtc);
766 --- a/drivers/gpu/drm/sti/sti_crtc.c
767 +++ b/drivers/gpu/drm/sti/sti_crtc.c
768 @@ -133,7 +133,7 @@ sti_crtc_mode_set_nofb(struct drm_crtc *
771 static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
772 - struct drm_crtc_state *old_crtc_state)
773 + struct drm_atomic_state *state)
775 struct drm_device *drm_dev = crtc->dev;
776 struct sti_mixer *mixer = to_sti_mixer(crtc);
777 --- a/drivers/gpu/drm/stm/ltdc.c
778 +++ b/drivers/gpu/drm/stm/ltdc.c
779 @@ -625,7 +625,7 @@ static void ltdc_crtc_mode_set_nofb(stru
782 static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
783 - struct drm_crtc_state *old_crtc_state)
784 + struct drm_atomic_state *state)
786 struct ltdc_device *ldev = crtc_to_ltdc(crtc);
787 struct drm_device *ddev = crtc->dev;
788 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
789 +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
790 @@ -61,8 +61,10 @@ static int sun4i_crtc_atomic_check(struc
793 static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
794 - struct drm_crtc_state *old_state)
795 + struct drm_atomic_state *state)
797 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
799 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
800 struct drm_device *dev = crtc->dev;
801 struct sunxi_engine *engine = scrtc->engine;
802 @@ -82,7 +84,7 @@ static void sun4i_crtc_atomic_begin(stru
805 static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
806 - struct drm_crtc_state *old_state)
807 + struct drm_atomic_state *state)
809 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
810 struct drm_pending_vblank_event *event = crtc->state->event;
811 --- a/drivers/gpu/drm/tegra/dc.c
812 +++ b/drivers/gpu/drm/tegra/dc.c
813 @@ -1924,7 +1924,7 @@ static void tegra_crtc_atomic_enable(str
816 static void tegra_crtc_atomic_begin(struct drm_crtc *crtc,
817 - struct drm_crtc_state *old_crtc_state)
818 + struct drm_atomic_state *state)
822 @@ -1943,17 +1943,17 @@ static void tegra_crtc_atomic_begin(stru
825 static void tegra_crtc_atomic_flush(struct drm_crtc *crtc,
826 - struct drm_crtc_state *old_crtc_state)
827 + struct drm_atomic_state *state)
829 - struct tegra_dc_state *state = to_dc_state(crtc->state);
830 + struct tegra_dc_state *crtc_state = to_dc_state(crtc->state);
831 struct tegra_dc *dc = to_tegra_dc(crtc);
834 - value = state->planes << 8 | GENERAL_UPDATE;
835 + value = crtc_state->planes << 8 | GENERAL_UPDATE;
836 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
837 value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
839 - value = state->planes | GENERAL_ACT_REQ;
840 + value = crtc_state->planes | GENERAL_ACT_REQ;
841 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
842 value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
844 --- a/drivers/gpu/drm/tidss/tidss_crtc.c
845 +++ b/drivers/gpu/drm/tidss/tidss_crtc.c
846 @@ -163,8 +163,10 @@ static void tidss_crtc_position_planes(s
849 static void tidss_crtc_atomic_flush(struct drm_crtc *crtc,
850 - struct drm_crtc_state *old_crtc_state)
851 + struct drm_atomic_state *state)
853 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
855 struct tidss_crtc *tcrtc = to_tidss_crtc(crtc);
856 struct drm_device *ddev = crtc->dev;
857 struct tidss_device *tidss = to_tidss(ddev);
858 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
859 +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
860 @@ -547,7 +547,7 @@ static void tilcdc_crtc_atomic_disable(s
863 static void tilcdc_crtc_atomic_flush(struct drm_crtc *crtc,
864 - struct drm_crtc_state *old_state)
865 + struct drm_atomic_state *state)
867 if (!crtc->state->event)
869 --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
870 +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
871 @@ -223,7 +223,7 @@ static void vbox_crtc_atomic_disable(str
874 static void vbox_crtc_atomic_flush(struct drm_crtc *crtc,
875 - struct drm_crtc_state *old_crtc_state)
876 + struct drm_atomic_state *state)
880 --- a/drivers/gpu/drm/vc4/vc4_drv.h
881 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
882 @@ -928,7 +928,8 @@ int vc4_hvs_get_fifo_from_output(struct
883 int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
884 void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
885 void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
886 -void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *state);
887 +void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
888 + struct drm_atomic_state *state);
889 void vc4_hvs_dump_state(struct drm_device *dev);
890 void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel);
891 void vc4_hvs_mask_underrun(struct drm_device *dev, int channel);
892 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
893 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
894 @@ -453,8 +453,10 @@ void vc4_hvs_atomic_disable(struct drm_c
897 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
898 - struct drm_crtc_state *old_state)
899 + struct drm_atomic_state *state)
901 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
903 struct drm_device *dev = crtc->dev;
904 struct vc4_dev *vc4 = to_vc4_dev(dev);
905 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
906 --- a/drivers/gpu/drm/virtio/virtgpu_display.c
907 +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
908 @@ -117,7 +117,7 @@ static int virtio_gpu_crtc_atomic_check(
911 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
912 - struct drm_crtc_state *old_state)
913 + struct drm_atomic_state *state)
915 struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
917 --- a/drivers/gpu/drm/vkms/vkms_crtc.c
918 +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
919 @@ -229,7 +229,7 @@ static void vkms_crtc_atomic_disable(str
922 static void vkms_crtc_atomic_begin(struct drm_crtc *crtc,
923 - struct drm_crtc_state *old_crtc_state)
924 + struct drm_atomic_state *state)
926 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
928 @@ -240,7 +240,7 @@ static void vkms_crtc_atomic_begin(struc
931 static void vkms_crtc_atomic_flush(struct drm_crtc *crtc,
932 - struct drm_crtc_state *old_crtc_state)
933 + struct drm_atomic_state *state)
935 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
937 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
938 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
939 @@ -554,13 +554,13 @@ int vmw_du_crtc_atomic_check(struct drm_
942 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
943 - struct drm_crtc_state *old_crtc_state)
944 + struct drm_atomic_state *state)
949 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
950 - struct drm_crtc_state *old_crtc_state)
951 + struct drm_atomic_state *state)
953 struct drm_pending_vblank_event *event = crtc->state->event;
955 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
956 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
957 @@ -475,9 +475,9 @@ void vmw_du_plane_unpin_surf(struct vmw_
958 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
959 struct drm_atomic_state *state);
960 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
961 - struct drm_crtc_state *old_crtc_state);
962 + struct drm_atomic_state *state);
963 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
964 - struct drm_crtc_state *old_crtc_state);
965 + struct drm_atomic_state *state);
966 void vmw_du_crtc_reset(struct drm_crtc *crtc);
967 struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc);
968 void vmw_du_crtc_destroy_state(struct drm_crtc *crtc,
969 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
970 +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
971 @@ -1514,14 +1514,14 @@ static int zynqmp_disp_crtc_atomic_check
974 zynqmp_disp_crtc_atomic_begin(struct drm_crtc *crtc,
975 - struct drm_crtc_state *old_crtc_state)
976 + struct drm_atomic_state *state)
978 drm_crtc_vblank_on(crtc);
982 zynqmp_disp_crtc_atomic_flush(struct drm_crtc *crtc,
983 - struct drm_crtc_state *old_crtc_state)
984 + struct drm_atomic_state *state)
986 if (crtc->state->event) {
987 struct drm_pending_vblank_event *event;
988 --- a/drivers/gpu/drm/zte/zx_vou.c
989 +++ b/drivers/gpu/drm/zte/zx_vou.c
990 @@ -473,7 +473,7 @@ static void zx_crtc_atomic_disable(struc
993 static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
994 - struct drm_crtc_state *old_state)
995 + struct drm_atomic_state *state)
997 struct drm_pending_vblank_event *event = crtc->state->event;
999 --- a/include/drm/drm_modeset_helper_vtables.h
1000 +++ b/include/drm/drm_modeset_helper_vtables.h
1001 @@ -373,7 +373,7 @@ struct drm_crtc_helper_funcs {
1002 * transitional plane helpers, but it is optional.
1004 void (*atomic_begin)(struct drm_crtc *crtc,
1005 - struct drm_crtc_state *old_crtc_state);
1006 + struct drm_atomic_state *state);
1010 @@ -397,7 +397,7 @@ struct drm_crtc_helper_funcs {
1011 * transitional plane helpers, but it is optional.
1013 void (*atomic_flush)(struct drm_crtc *crtc,
1014 - struct drm_crtc_state *old_crtc_state);
1015 + struct drm_atomic_state *state);