@@ -61,6 +61,7 @@ struct mtk_drm_crtc {
61
61
62
62
/* lock for display hardware access */
63
63
struct mutex hw_lock ;
64
+ bool config_updating ;
64
65
};
65
66
66
67
struct mtk_crtc_state {
@@ -97,7 +98,7 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)
97
98
static void mtk_drm_finish_page_flip (struct mtk_drm_crtc * mtk_crtc )
98
99
{
99
100
drm_crtc_handle_vblank (& mtk_crtc -> base );
100
- if (mtk_crtc -> pending_needs_vblank ) {
101
+ if (! mtk_crtc -> config_updating && mtk_crtc -> pending_needs_vblank ) {
101
102
mtk_drm_crtc_finish_page_flip (mtk_crtc );
102
103
mtk_crtc -> pending_needs_vblank = false;
103
104
}
@@ -425,7 +426,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
425
426
}
426
427
}
427
428
428
- static void mtk_drm_crtc_hw_config (struct mtk_drm_crtc * mtk_crtc )
429
+ static void mtk_drm_crtc_update_config (struct mtk_drm_crtc * mtk_crtc ,
430
+ bool needs_vblank )
429
431
{
430
432
#if IS_REACHABLE (CONFIG_MTK_CMDQ )
431
433
struct cmdq_pkt * cmdq_handle ;
@@ -436,6 +438,10 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
436
438
int i ;
437
439
438
440
mutex_lock (& mtk_crtc -> hw_lock );
441
+ mtk_crtc -> config_updating = true;
442
+ if (needs_vblank )
443
+ mtk_crtc -> pending_needs_vblank = true;
444
+
439
445
for (i = 0 ; i < mtk_crtc -> layer_nr ; i ++ ) {
440
446
struct drm_plane * plane = & mtk_crtc -> planes [i ];
441
447
struct mtk_plane_state * plane_state ;
@@ -472,6 +478,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
472
478
cmdq_pkt_flush_async (cmdq_handle , ddp_cmdq_cb , cmdq_handle );
473
479
}
474
480
#endif
481
+ mtk_crtc -> config_updating = false;
475
482
mutex_unlock (& mtk_crtc -> hw_lock );
476
483
}
477
484
@@ -532,7 +539,7 @@ void mtk_drm_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane,
532
539
return ;
533
540
534
541
plane_helper_funcs -> atomic_update (plane , new_state );
535
- mtk_drm_crtc_hw_config (mtk_crtc );
542
+ mtk_drm_crtc_update_config (mtk_crtc , false );
536
543
}
537
544
538
545
static void mtk_drm_crtc_atomic_enable (struct drm_crtc * crtc ,
@@ -582,7 +589,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
582
589
}
583
590
mtk_crtc -> pending_planes = true;
584
591
585
- mtk_drm_crtc_hw_config (mtk_crtc );
592
+ mtk_drm_crtc_update_config (mtk_crtc , false );
586
593
/* Wait for planes to be disabled */
587
594
drm_crtc_wait_one_vblank (crtc );
588
595
@@ -618,14 +625,12 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
618
625
struct mtk_drm_crtc * mtk_crtc = to_mtk_crtc (crtc );
619
626
int i ;
620
627
621
- if (mtk_crtc -> event )
622
- mtk_crtc -> pending_needs_vblank = true;
623
628
if (crtc -> state -> color_mgmt_changed )
624
629
for (i = 0 ; i < mtk_crtc -> ddp_comp_nr ; i ++ ) {
625
630
mtk_ddp_gamma_set (mtk_crtc -> ddp_comp [i ], crtc -> state );
626
631
mtk_ddp_ctm_set (mtk_crtc -> ddp_comp [i ], crtc -> state );
627
632
}
628
- mtk_drm_crtc_hw_config (mtk_crtc );
633
+ mtk_drm_crtc_update_config (mtk_crtc , !! mtk_crtc -> event );
629
634
}
630
635
631
636
static const struct drm_crtc_funcs mtk_crtc_funcs = {
0 commit comments