Skip to content

Commit be09ec5

Browse files
stschakePhil Elwell
authored and
Phil Elwell
committed
drm/vc4: Enable background color fill when necessary
commit 1d49f2e upstream. Using the hint from the plane state, we turn on the background color to avoid display corruption from planes blending with the background. Changes from v1: - Use needs_bg_fill from plane state Signed-off-by: Stefan Schake <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9563c45 commit be09ec5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,12 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
646646
{
647647
struct drm_device *dev = crtc->dev;
648648
struct vc4_dev *vc4 = to_vc4_dev(dev);
649+
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
649650
struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
650651
struct drm_plane *plane;
652+
struct vc4_plane_state *vc4_plane_state;
651653
bool debug_dump_regs = false;
654+
bool enable_bg_fill = false;
652655
u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start;
653656
u32 __iomem *dlist_next = dlist_start;
654657

@@ -659,6 +662,20 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
659662

660663
/* Copy all the active planes' dlist contents to the hardware dlist. */
661664
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+
662679
dlist_next += vc4_plane_write_dlist(plane, dlist_next);
663680
}
664681

@@ -667,6 +684,14 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
667684

668685
WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size);
669686

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+
670695
/* Only update DISPLIST if the CRTC was already running and is not
671696
* being disabled.
672697
* vc4_crtc_enable() takes care of updating the dlist just after

0 commit comments

Comments
 (0)