9696a45390af1bc65515a6899e513e4534c8507a
[openwrt/openwrt.git] /
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
5 and flush
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Commit f6ebe9f9c9233a6114eb922aba9a0c9ccc2d2e14 upstream.
11
12 The current atomic helpers have either their object state being passed as
13 an argument or the full atomic state.
14
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.
17
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.
20
21 The conversion was done using the coccinelle script below, built tested on
22 all the drivers and actually tested on vc4.
23
24 virtual report
25
26 @@
27 struct drm_crtc_helper_funcs *FUNCS;
28 identifier old_crtc_state, old_state;
29 identifier crtc;
30 identifier f;
31 @@
32
33 f(struct drm_crtc_state *old_crtc_state)
34 {
35 ...
36 struct drm_atomic_state *old_state = old_crtc_state->state;
37 <...
38 - FUNCS->atomic_begin(crtc, old_crtc_state);
39 + FUNCS->atomic_begin(crtc, old_state);
40 ...>
41 }
42
43 @@
44 struct drm_crtc_helper_funcs *FUNCS;
45 identifier old_crtc_state, old_state;
46 identifier crtc;
47 identifier f;
48 @@
49
50 f(struct drm_crtc_state *old_crtc_state)
51 {
52 ...
53 struct drm_atomic_state *old_state = old_crtc_state->state;
54 <...
55 - FUNCS->atomic_flush(crtc, old_crtc_state);
56 + FUNCS->atomic_flush(crtc, old_state);
57 ...>
58 }
59
60 @@
61 struct drm_crtc_helper_funcs *FUNCS;
62 struct drm_crtc *crtc;
63 struct drm_crtc_state *crtc_state;
64 identifier dev, state;
65 identifier f;
66 @@
67
68 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
69 {
70 <...
71 - FUNCS->atomic_begin(crtc, crtc_state);
72 + FUNCS->atomic_begin(crtc, state);
73 ...>
74 }
75
76 @@
77 struct drm_crtc_helper_funcs *FUNCS;
78 struct drm_crtc *crtc;
79 struct drm_crtc_state *crtc_state;
80 identifier dev, state;
81 identifier f;
82 @@
83
84 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
85 {
86 <...
87 - FUNCS->atomic_flush(crtc, crtc_state);
88 + FUNCS->atomic_flush(crtc, state);
89 ...>
90 }
91
92 @@
93 identifier crtc, old_state;
94 @@
95
96 struct drm_crtc_helper_funcs {
97 ...
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);
100 ...
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);
103 ...
104 }
105
106 @ crtc_atomic_func @
107 identifier helpers;
108 identifier func;
109 @@
110
111 (
112 static struct drm_crtc_helper_funcs helpers = {
113 ...,
114 .atomic_begin = func,
115 ...,
116 };
117 |
118 static struct drm_crtc_helper_funcs helpers = {
119 ...,
120 .atomic_flush = func,
121 ...,
122 };
123 )
124
125 @ ignores_old_state @
126 identifier crtc_atomic_func.func;
127 identifier crtc, old_state;
128 @@
129
130 void func(struct drm_crtc *crtc,
131 struct drm_crtc_state *old_state)
132 {
133 ... when != old_state
134 }
135
136 @ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
137 identifier crtc_atomic_func.func;
138 identifier crtc, old_state;
139 @@
140
141 void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
142 {
143 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
144 ...
145 }
146
147 @ depends on crtc_atomic_func @
148 identifier crtc_atomic_func.func;
149 expression E;
150 type T;
151 @@
152
153 void func(...)
154 {
155 ...
156 - T state = E;
157 + T crtc_state = E;
158 <+...
159 - state
160 + crtc_state
161 ...+>
162
163 }
164
165 @ depends on crtc_atomic_func @
166 identifier crtc_atomic_func.func;
167 type T;
168 @@
169
170 void func(...)
171 {
172 ...
173 - T state;
174 + T crtc_state;
175 <+...
176 - state
177 + crtc_state
178 ...+>
179
180 }
181
182 @@
183 identifier old_state;
184 identifier crtc;
185 @@
186
187 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
188 - struct drm_crtc_state *old_state
189 + struct drm_atomic_state *state
190 )
191 {
192 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
193 ...
194 }
195
196 @@
197 identifier old_state;
198 identifier crtc;
199 @@
200
201 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
202 - struct drm_crtc_state *old_state
203 + struct drm_atomic_state *state
204 );
205
206 @@
207 identifier old_state;
208 identifier crtc;
209 @@
210
211 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
212 - struct drm_crtc_state *old_state
213 + struct drm_atomic_state *state
214 )
215 {
216 ...
217 }
218
219 @@
220 identifier old_state;
221 identifier crtc;
222 @@
223
224 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
225 - struct drm_crtc_state *old_state
226 + struct drm_atomic_state *state
227 );
228
229 @@
230 identifier old_state;
231 identifier crtc;
232 @@
233
234 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
235 - struct drm_crtc_state *old_state
236 + struct drm_atomic_state *state
237 )
238 {
239 ...
240 }
241
242 @@
243 identifier old_state;
244 identifier crtc;
245 @@
246
247 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
248 - struct drm_crtc_state *old_state
249 + struct drm_atomic_state *state
250 );
251
252 @ depends on crtc_atomic_func @
253 identifier crtc_atomic_func.func;
254 identifier old_state;
255 identifier crtc;
256 @@
257
258 void func(struct drm_crtc *crtc,
259 - struct drm_crtc_state *old_state
260 + struct drm_atomic_state *state
261 )
262 { ... }
263
264 @ include depends on adds_old_state @
265 @@
266
267 #include <drm/drm_atomic.h>
268
269 @ no_include depends on !include && adds_old_state @
270 @@
271
272 + #include <drm/drm_atomic.h>
273 #include <drm/...>
274
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
280 ---
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(-)
320
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
324
325 static void
326 komeda_crtc_atomic_flush(struct drm_crtc *crtc,
327 - struct drm_crtc_state *old)
328 + struct drm_atomic_state *state)
329 {
330 + struct drm_crtc_state *old = drm_atomic_get_old_crtc_state(state,
331 + crtc);
332 /* commit with modeset will be handled in enable/disable */
333 if (drm_atomic_crtc_needs_modeset(crtc->state))
334 return;
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
338 }
339
340 static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
341 - struct drm_crtc_state *state)
342 + struct drm_atomic_state *state)
343 {
344 struct drm_pending_vblank_event *event = crtc->state->event;
345
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(
349 }
350
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)
354 {
355 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
356
357 @@ -443,7 +443,7 @@ static void armada_drm_crtc_atomic_begin
358 }
359
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)
363 {
364 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
365
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
369 }
370
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)
374 {
375 struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
376
377 @@ -357,7 +357,7 @@ static void atmel_hlcdc_crtc_atomic_begi
378 }
379
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)
383 {
384 /* TODO: write common plane control register if available */
385 }
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)
390 continue;
391
392 - funcs->atomic_begin(crtc, old_crtc_state);
393 + funcs->atomic_begin(crtc, old_state);
394 }
395
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)
399 continue;
400
401 - funcs->atomic_flush(crtc, old_crtc_state);
402 + funcs->atomic_flush(crtc, old_state);
403 }
404 }
405 EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
406 @@ -2603,7 +2603,7 @@ drm_atomic_helper_commit_planes_on_crtc(
407
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);
412
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(
416 }
417
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);
421 }
422 EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
423
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
427 }
428
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)
432 {
433 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
434
435 @@ -74,7 +74,7 @@ static void exynos_crtc_atomic_begin(str
436 }
437
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)
441 {
442 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
443
444 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
445 +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
446 @@ -21,7 +21,7 @@
447 #include "fsl_dcu_drm_plane.h"
448
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)
452 {
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
458 }
459
460 static void hibmc_crtc_atomic_begin(struct drm_crtc *crtc,
461 - struct drm_crtc_state *old_state)
462 + struct drm_atomic_state *state)
463 {
464 unsigned int reg;
465 struct drm_device *dev = crtc->dev;
466 @@ -413,7 +413,7 @@ static void hibmc_crtc_atomic_begin(stru
467 }
468
469 static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
470 - struct drm_crtc_state *old_state)
471 + struct drm_atomic_state *state)
472
473 {
474 unsigned long flags;
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
478 }
479
480 static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
481 - struct drm_crtc_state *old_state)
482 + struct drm_atomic_state *state)
483 {
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
487 }
488
489 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
490 - struct drm_crtc_state *old_state)
491 + struct drm_atomic_state *state)
492
493 {
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_
498 };
499
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)
503 {
504 drm_crtc_vblank_on(crtc);
505 }
506
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)
510 {
511 struct dcss_crtc *dcss_crtc = container_of(crtc, struct dcss_crtc,
512 base);
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
516 }
517
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)
521 {
522 drm_crtc_vblank_on(crtc);
523 }
524
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)
528 {
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
534 }
535
536 static void ingenic_drm_crtc_atomic_begin(struct drm_crtc *crtc,
537 - struct drm_crtc_state *oldstate)
538 + struct drm_atomic_state *state)
539 {
540 struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
541 u32 ctrl = 0;
542 @@ -273,20 +273,20 @@ static void ingenic_drm_crtc_atomic_begi
543 }
544
545 static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
546 - struct drm_crtc_state *oldstate)
547 + struct drm_atomic_state *state)
548 {
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;
554
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);
559
560 clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
561 }
562
563 if (event) {
564 - state->event = NULL;
565 + crtc_state->event = NULL;
566
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(
572 }
573
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)
577 {
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);
581
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");
585
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;
595 }
596 }
597
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)
601 {
602 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
603 int i;
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
607 }
608
609 static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
610 - struct drm_crtc_state *state)
611 + struct drm_atomic_state *state)
612 {
613 struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
614 unsigned long flags;
615 @@ -217,7 +217,7 @@ static void meson_crtc_atomic_begin(stru
616 }
617
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)
621 {
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
627 }
628
629 static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
630 - struct drm_crtc_state *old_state)
631 + struct drm_atomic_state *state)
632 {
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
636 }
637
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)
641 {
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
647 }
648
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)
652 {
653 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
654 DBG("%s: begin", mdp4_crtc->name);
655 }
656
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)
660 {
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
666 }
667
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)
671 {
672 DBG("%s: begin", crtc->name);
673 }
674
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)
678 {
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
684 }
685
686 static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
687 - struct drm_crtc_state *old_state)
688 + struct drm_atomic_state *state)
689 {
690 struct drm_pending_vblank_event *event;
691
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
695 }
696
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)
700 {
701 }
702
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)
706 {
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
712 }
713
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)
717 {
718 qxl_crtc_update_monitors_config(crtc, "flush");
719 }
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(
723 }
724
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)
728 {
729 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
730
731 @@ -808,7 +808,7 @@ static void rcar_du_crtc_atomic_begin(st
732 }
733
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)
737 {
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
743 }
744
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)
748 {
749 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
750 + crtc);
751 struct vop *vop = to_vop(crtc);
752
753 /*
754 @@ -1463,8 +1465,10 @@ static int vop_crtc_atomic_check(struct
755 }
756
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)
760 {
761 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
762 + crtc);
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 *
769 }
770
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)
774 {
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
780 }
781
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)
785 {
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
791 }
792
793 static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
794 - struct drm_crtc_state *old_state)
795 + struct drm_atomic_state *state)
796 {
797 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
798 + crtc);
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
803 }
804
805 static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
806 - struct drm_crtc_state *old_state)
807 + struct drm_atomic_state *state)
808 {
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
814 }
815
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)
819 {
820 unsigned long flags;
821
822 @@ -1943,17 +1943,17 @@ static void tegra_crtc_atomic_begin(stru
823 }
824
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)
828 {
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);
832 u32 value;
833
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);
838
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);
843 }
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
847 }
848
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)
852 {
853 + struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
854 + crtc);
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
861 }
862
863 static void tilcdc_crtc_atomic_flush(struct drm_crtc *crtc,
864 - struct drm_crtc_state *old_state)
865 + struct drm_atomic_state *state)
866 {
867 if (!crtc->state->event)
868 return;
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
872 }
873
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)
877 {
878 }
879
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
895 }
896
897 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
898 - struct drm_crtc_state *old_state)
899 + struct drm_atomic_state *state)
900 {
901 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
902 + crtc);
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(
909 }
910
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)
914 {
915 struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
916
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
920 }
921
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)
925 {
926 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
927
928 @@ -240,7 +240,7 @@ static void vkms_crtc_atomic_begin(struc
929 }
930
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)
934 {
935 struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc);
936
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_
940
941
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)
945 {
946 }
947
948
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)
952 {
953 struct drm_pending_vblank_event *event = crtc->state->event;
954
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
972
973 static void
974 zynqmp_disp_crtc_atomic_begin(struct drm_crtc *crtc,
975 - struct drm_crtc_state *old_crtc_state)
976 + struct drm_atomic_state *state)
977 {
978 drm_crtc_vblank_on(crtc);
979 }
980
981 static void
982 zynqmp_disp_crtc_atomic_flush(struct drm_crtc *crtc,
983 - struct drm_crtc_state *old_crtc_state)
984 + struct drm_atomic_state *state)
985 {
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
991 }
992
993 static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
994 - struct drm_crtc_state *old_state)
995 + struct drm_atomic_state *state)
996 {
997 struct drm_pending_vblank_event *event = crtc->state->event;
998
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.
1003 */
1004 void (*atomic_begin)(struct drm_crtc *crtc,
1005 - struct drm_crtc_state *old_crtc_state);
1006 + struct drm_atomic_state *state);
1007 /**
1008 * @atomic_flush:
1009 *
1010 @@ -397,7 +397,7 @@ struct drm_crtc_helper_funcs {
1011 * transitional plane helpers, but it is optional.
1012 */
1013 void (*atomic_flush)(struct drm_crtc *crtc,
1014 - struct drm_crtc_state *old_crtc_state);
1015 + struct drm_atomic_state *state);
1016
1017 /**
1018 * @atomic_enable: