@@ -646,9 +646,12 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
646
646
{
647
647
struct drm_device * dev = crtc -> dev ;
648
648
struct vc4_dev * vc4 = to_vc4_dev (dev );
649
+ struct vc4_crtc * vc4_crtc = to_vc4_crtc (crtc );
649
650
struct vc4_crtc_state * vc4_state = to_vc4_crtc_state (crtc -> state );
650
651
struct drm_plane * plane ;
652
+ struct vc4_plane_state * vc4_plane_state ;
651
653
bool debug_dump_regs = false;
654
+ bool enable_bg_fill = false;
652
655
u32 __iomem * dlist_start = vc4 -> hvs -> dlist + vc4_state -> mm .start ;
653
656
u32 __iomem * dlist_next = dlist_start ;
654
657
@@ -659,6 +662,20 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
659
662
660
663
/* Copy all the active planes' dlist contents to the hardware dlist. */
661
664
drm_atomic_crtc_for_each_plane (plane , crtc ) {
665
+ /* Is this the first active plane? */
666
+ if (dlist_next == dlist_start ) {
667
+ /* We need to enable background fill when a plane
668
+ * could be alpha blending from the background, i.e.
669
+ * where no other plane is underneath. It suffices to
670
+ * consider the first active plane here since we set
671
+ * needs_bg_fill such that either the first plane
672
+ * already needs it or all planes on top blend from
673
+ * the first or a lower plane.
674
+ */
675
+ vc4_plane_state = to_vc4_plane_state (plane -> state );
676
+ enable_bg_fill = vc4_plane_state -> needs_bg_fill ;
677
+ }
678
+
662
679
dlist_next += vc4_plane_write_dlist (plane , dlist_next );
663
680
}
664
681
@@ -667,6 +684,14 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
667
684
668
685
WARN_ON_ONCE (dlist_next - dlist_start != vc4_state -> mm .size );
669
686
687
+ if (enable_bg_fill )
688
+ /* This sets a black background color fill, as is the case
689
+ * with other DRM drivers.
690
+ */
691
+ HVS_WRITE (SCALER_DISPBKGNDX (vc4_crtc -> channel ),
692
+ HVS_READ (SCALER_DISPBKGNDX (vc4_crtc -> channel )) |
693
+ SCALER_DISPBKGND_FILL );
694
+
670
695
/* Only update DISPLIST if the CRTC was already running and is not
671
696
* being disabled.
672
697
* vc4_crtc_enable() takes care of updating the dlist just after
0 commit comments