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 @@ -2517,7 +2517,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 @@ -2575,7 +2575,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 @@ -2613,7 +2613,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 @@ -2639,7 +2639,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 @@ -292,7 +292,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 @@ -312,26 +312,26 @@ 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 + if (drm_atomic_crtc_needs_modeset(crtc_state)) {
557 ingenic_drm_crtc_update_timings(priv, &state->mode);
558 priv->update_clk_rate = true;
561 if (priv->update_clk_rate) {
562 mutex_lock(&priv->clk_mutex);
563 - clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
564 + clk_set_rate(priv->pix_clk, crtc_state->adjusted_mode.clock * 1000);
565 priv->update_clk_rate = false;
566 mutex_unlock(&priv->clk_mutex);
570 - state->event = NULL;
571 + crtc_state->event = NULL;
573 spin_lock_irq(&crtc->dev->event_lock);
574 if (drm_crtc_vblank_get(crtc) == 0)
575 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
576 +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
577 @@ -575,24 +575,24 @@ static void mtk_drm_crtc_atomic_disable(
580 static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc,
581 - struct drm_crtc_state *old_crtc_state)
582 + struct drm_atomic_state *state)
584 - struct mtk_crtc_state *state = to_mtk_crtc_state(crtc->state);
585 + struct mtk_crtc_state *crtc_state = to_mtk_crtc_state(crtc->state);
586 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
588 - if (mtk_crtc->event && state->base.event)
589 + if (mtk_crtc->event && crtc_state->base.event)
590 DRM_ERROR("new event while there is still a pending event\n");
592 - if (state->base.event) {
593 - state->base.event->pipe = drm_crtc_index(crtc);
594 + if (crtc_state->base.event) {
595 + crtc_state->base.event->pipe = drm_crtc_index(crtc);
596 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
597 - mtk_crtc->event = state->base.event;
598 - state->base.event = NULL;
599 + mtk_crtc->event = crtc_state->base.event;
600 + crtc_state->base.event = NULL;
604 static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
605 - struct drm_crtc_state *old_crtc_state)
606 + struct drm_atomic_state *state)
608 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
610 --- a/drivers/gpu/drm/meson/meson_crtc.c
611 +++ b/drivers/gpu/drm/meson/meson_crtc.c
612 @@ -201,7 +201,7 @@ static void meson_crtc_atomic_disable(st
615 static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
616 - struct drm_crtc_state *state)
617 + struct drm_atomic_state *state)
619 struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
621 @@ -217,7 +217,7 @@ static void meson_crtc_atomic_begin(stru
624 static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
625 - struct drm_crtc_state *old_crtc_state)
626 + struct drm_atomic_state *state)
628 struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
629 struct meson_drm *priv = meson_crtc->priv;
630 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
631 +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
632 @@ -486,7 +486,7 @@ static void _dpu_crtc_setup_cp_blocks(st
635 static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
636 - struct drm_crtc_state *old_state)
637 + struct drm_atomic_state *state)
639 struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
640 struct drm_encoder *encoder;
641 @@ -527,7 +527,7 @@ static void dpu_crtc_atomic_begin(struct
644 static void dpu_crtc_atomic_flush(struct drm_crtc *crtc,
645 - struct drm_crtc_state *old_crtc_state)
646 + struct drm_atomic_state *state)
648 struct dpu_crtc *dpu_crtc;
649 struct drm_device *dev;
650 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
651 +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
652 @@ -316,14 +316,14 @@ static int mdp4_crtc_atomic_check(struct
655 static void mdp4_crtc_atomic_begin(struct drm_crtc *crtc,
656 - struct drm_crtc_state *old_crtc_state)
657 + struct drm_atomic_state *state)
659 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
660 DBG("%s: begin", mdp4_crtc->name);
663 static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc,
664 - struct drm_crtc_state *old_crtc_state)
665 + struct drm_atomic_state *state)
667 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
668 struct drm_device *dev = crtc->dev;
669 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
670 +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
671 @@ -778,13 +778,13 @@ static int mdp5_crtc_atomic_check(struct
674 static void mdp5_crtc_atomic_begin(struct drm_crtc *crtc,
675 - struct drm_crtc_state *old_crtc_state)
676 + struct drm_atomic_state *state)
678 DBG("%s: begin", crtc->name);
681 static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc,
682 - struct drm_crtc_state *old_crtc_state)
683 + struct drm_atomic_state *state)
685 struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
686 struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
687 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
688 +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
689 @@ -326,7 +326,7 @@ static int mxsfb_crtc_atomic_check(struc
692 static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
693 - struct drm_crtc_state *old_state)
694 + struct drm_atomic_state *state)
696 struct drm_pending_vblank_event *event;
698 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
699 +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
700 @@ -601,12 +601,12 @@ static int omap_crtc_atomic_check(struct
703 static void omap_crtc_atomic_begin(struct drm_crtc *crtc,
704 - struct drm_crtc_state *old_crtc_state)
705 + struct drm_atomic_state *state)
709 static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
710 - struct drm_crtc_state *old_crtc_state)
711 + struct drm_atomic_state *state)
713 struct omap_drm_private *priv = crtc->dev->dev_private;
714 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
715 --- a/drivers/gpu/drm/qxl/qxl_display.c
716 +++ b/drivers/gpu/drm/qxl/qxl_display.c
717 @@ -373,7 +373,7 @@ static void qxl_crtc_update_monitors_con
720 static void qxl_crtc_atomic_flush(struct drm_crtc *crtc,
721 - struct drm_crtc_state *old_crtc_state)
722 + struct drm_atomic_state *state)
724 qxl_crtc_update_monitors_config(crtc, "flush");
726 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
727 +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
728 @@ -785,7 +785,7 @@ static void rcar_du_crtc_atomic_disable(
731 static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
732 - struct drm_crtc_state *old_crtc_state)
733 + struct drm_atomic_state *state)
735 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
737 @@ -814,7 +814,7 @@ static void rcar_du_crtc_atomic_begin(st
740 static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
741 - struct drm_crtc_state *old_crtc_state)
742 + struct drm_atomic_state *state)
744 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
745 struct drm_device *dev = rcrtc->crtc.dev;
746 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
747 +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
748 @@ -1247,8 +1247,10 @@ static void vop_crtc_gamma_set(struct vo
751 static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
752 - struct drm_crtc_state *old_crtc_state)
753 + struct drm_atomic_state *state)
755 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
757 struct vop *vop = to_vop(crtc);
760 @@ -1463,8 +1465,10 @@ static int vop_crtc_atomic_check(struct
763 static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
764 - struct drm_crtc_state *old_crtc_state)
765 + struct drm_atomic_state *state)
767 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
769 struct drm_atomic_state *old_state = old_crtc_state->state;
770 struct drm_plane_state *old_plane_state, *new_plane_state;
771 struct vop *vop = to_vop(crtc);
772 --- a/drivers/gpu/drm/sti/sti_crtc.c
773 +++ b/drivers/gpu/drm/sti/sti_crtc.c
774 @@ -133,7 +133,7 @@ sti_crtc_mode_set_nofb(struct drm_crtc *
777 static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
778 - struct drm_crtc_state *old_crtc_state)
779 + struct drm_atomic_state *state)
781 struct drm_device *drm_dev = crtc->dev;
782 struct sti_mixer *mixer = to_sti_mixer(crtc);
783 --- a/drivers/gpu/drm/stm/ltdc.c
784 +++ b/drivers/gpu/drm/stm/ltdc.c
785 @@ -629,7 +629,7 @@ static void ltdc_crtc_mode_set_nofb(stru
788 static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
789 - struct drm_crtc_state *old_crtc_state)
790 + struct drm_atomic_state *state)
792 struct ltdc_device *ldev = crtc_to_ltdc(crtc);
793 struct drm_device *ddev = crtc->dev;
794 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
795 +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
796 @@ -61,8 +61,10 @@ static int sun4i_crtc_atomic_check(struc
799 static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
800 - struct drm_crtc_state *old_state)
801 + struct drm_atomic_state *state)
803 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
805 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
806 struct drm_device *dev = crtc->dev;
807 struct sunxi_engine *engine = scrtc->engine;
808 @@ -82,7 +84,7 @@ static void sun4i_crtc_atomic_begin(stru
811 static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
812 - struct drm_crtc_state *old_state)
813 + struct drm_atomic_state *state)
815 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
816 struct drm_pending_vblank_event *event = crtc->state->event;
817 --- a/drivers/gpu/drm/tegra/dc.c
818 +++ b/drivers/gpu/drm/tegra/dc.c
819 @@ -1924,7 +1924,7 @@ static void tegra_crtc_atomic_enable(str
822 static void tegra_crtc_atomic_begin(struct drm_crtc *crtc,
823 - struct drm_crtc_state *old_crtc_state)
824 + struct drm_atomic_state *state)
828 @@ -1943,17 +1943,17 @@ static void tegra_crtc_atomic_begin(stru
831 static void tegra_crtc_atomic_flush(struct drm_crtc *crtc,
832 - struct drm_crtc_state *old_crtc_state)
833 + struct drm_atomic_state *state)
835 - struct tegra_dc_state *state = to_dc_state(crtc->state);
836 + struct tegra_dc_state *crtc_state = to_dc_state(crtc->state);
837 struct tegra_dc *dc = to_tegra_dc(crtc);
840 - value = state->planes << 8 | GENERAL_UPDATE;
841 + value = crtc_state->planes << 8 | GENERAL_UPDATE;
842 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
843 value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
845 - value = state->planes | GENERAL_ACT_REQ;
846 + value = crtc_state->planes | GENERAL_ACT_REQ;
847 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
848 value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
850 --- a/drivers/gpu/drm/tidss/tidss_crtc.c
851 +++ b/drivers/gpu/drm/tidss/tidss_crtc.c
852 @@ -163,8 +163,10 @@ static void tidss_crtc_position_planes(s
855 static void tidss_crtc_atomic_flush(struct drm_crtc *crtc,
856 - struct drm_crtc_state *old_crtc_state)
857 + struct drm_atomic_state *state)
859 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
861 struct tidss_crtc *tcrtc = to_tidss_crtc(crtc);
862 struct drm_device *ddev = crtc->dev;
863 struct tidss_device *tidss = to_tidss(ddev);
864 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
865 +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
866 @@ -547,7 +547,7 @@ static void tilcdc_crtc_atomic_disable(s
869 static void tilcdc_crtc_atomic_flush(struct drm_crtc *crtc,
870 - struct drm_crtc_state *old_state)
871 + struct drm_atomic_state *state)
873 if (!crtc->state->event)
875 --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
876 +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
877 @@ -223,7 +223,7 @@ static void vbox_crtc_atomic_disable(str
880 static void vbox_crtc_atomic_flush(struct drm_crtc *crtc,
881 - struct drm_crtc_state *old_crtc_state)
882 + struct drm_atomic_state *state)
886 --- a/drivers/gpu/drm/vc4/vc4_drv.h
887 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
888 @@ -927,7 +927,8 @@ int vc4_hvs_get_fifo_from_output(struct
889 int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
890 void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
891 void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
892 -void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *state);
893 +void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
894 + struct drm_atomic_state *state);
895 void vc4_hvs_dump_state(struct drm_device *dev);
896 void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel);
897 void vc4_hvs_mask_underrun(struct drm_device *dev, int channel);
898 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
899 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
900 @@ -453,8 +453,10 @@ void vc4_hvs_atomic_disable(struct drm_c
903 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
904 - struct drm_crtc_state *old_state)
905 + struct drm_atomic_state *state)
907 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
909 struct drm_device *dev = crtc->dev;
910 struct vc4_dev *vc4 = to_vc4_dev(dev);
911 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
912 --- a/drivers/gpu/drm/virtio/virtgpu_display.c
913 +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
914 @@ -117,7 +117,7 @@ static int virtio_gpu_crtc_atomic_check(
917 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
918 - struct drm_crtc_state *old_state)
919 + struct drm_atomic_state *state)
921 struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
923 --- a/drivers/gpu/drm/vkms/vkms_crtc.c
924 +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
925 @@ -229,7 +229,7 @@ static void vkms_crtc_atomic_disable(str
928 static void vkms_crtc_atomic_begin(struct drm_crtc *crtc,
929 - struct drm_crtc_state *old_crtc_state)
930 + struct drm_atomic_state *state)
932 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
934 @@ -240,7 +240,7 @@ static void vkms_crtc_atomic_begin(struc
937 static void vkms_crtc_atomic_flush(struct drm_crtc *crtc,
938 - struct drm_crtc_state *old_crtc_state)
939 + struct drm_atomic_state *state)
941 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
943 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
944 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
945 @@ -555,13 +555,13 @@ int vmw_du_crtc_atomic_check(struct drm_
948 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
949 - struct drm_crtc_state *old_crtc_state)
950 + struct drm_atomic_state *state)
955 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
956 - struct drm_crtc_state *old_crtc_state)
957 + struct drm_atomic_state *state)
959 struct drm_pending_vblank_event *event = crtc->state->event;
961 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
962 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
963 @@ -475,9 +475,9 @@ void vmw_du_plane_unpin_surf(struct vmw_
964 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
965 struct drm_atomic_state *state);
966 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
967 - struct drm_crtc_state *old_crtc_state);
968 + struct drm_atomic_state *state);
969 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
970 - struct drm_crtc_state *old_crtc_state);
971 + struct drm_atomic_state *state);
972 void vmw_du_crtc_reset(struct drm_crtc *crtc);
973 struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc);
974 void vmw_du_crtc_destroy_state(struct drm_crtc *crtc,
975 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
976 +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
977 @@ -1515,14 +1515,14 @@ static int zynqmp_disp_crtc_atomic_check
980 zynqmp_disp_crtc_atomic_begin(struct drm_crtc *crtc,
981 - struct drm_crtc_state *old_crtc_state)
982 + struct drm_atomic_state *state)
984 drm_crtc_vblank_on(crtc);
988 zynqmp_disp_crtc_atomic_flush(struct drm_crtc *crtc,
989 - struct drm_crtc_state *old_crtc_state)
990 + struct drm_atomic_state *state)
992 if (crtc->state->event) {
993 struct drm_pending_vblank_event *event;
994 --- a/drivers/gpu/drm/zte/zx_vou.c
995 +++ b/drivers/gpu/drm/zte/zx_vou.c
996 @@ -473,7 +473,7 @@ static void zx_crtc_atomic_disable(struc
999 static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
1000 - struct drm_crtc_state *old_state)
1001 + struct drm_atomic_state *state)
1003 struct drm_pending_vblank_event *event = crtc->state->event;
1005 --- a/include/drm/drm_modeset_helper_vtables.h
1006 +++ b/include/drm/drm_modeset_helper_vtables.h
1007 @@ -373,7 +373,7 @@ struct drm_crtc_helper_funcs {
1008 * transitional plane helpers, but it is optional.
1010 void (*atomic_begin)(struct drm_crtc *crtc,
1011 - struct drm_crtc_state *old_crtc_state);
1012 + struct drm_atomic_state *state);
1016 @@ -397,7 +397,7 @@ struct drm_crtc_helper_funcs {
1017 * transitional plane helpers, but it is optional.
1019 void (*atomic_flush)(struct drm_crtc *crtc,
1020 - struct drm_crtc_state *old_crtc_state);
1021 + struct drm_atomic_state *state);