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