From: Stefan Schake <stschake@gmail.com>
To: eric@anholt.net
Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org,
dri-devel@lists.freedesktop.org,
Stefan Schake <stschake@gmail.com>
Subject: [PATCH 3/3] drm/vc4: Enable background color fill when necessary
Date: Tue, 6 Mar 2018 02:48:39 +0100 [thread overview]
Message-ID: <1520300919-103427-4-git-send-email-stschake@gmail.com> (raw)
In-Reply-To: <1520300919-103427-1-git-send-email-stschake@gmail.com>
Using the hint from the plane state, we turn on the background color
to avoid display corruption from planes blending with the background.
Signed-off-by: Stefan Schake <stschake@gmail.com>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index ce1e3b9..728845f 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -643,9 +643,11 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
{
struct drm_device *dev = crtc->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
+ struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
struct drm_plane *plane;
bool debug_dump_regs = false;
+ bool enable_bg_fill = false;
u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start;
u32 __iomem *dlist_next = dlist_start;
@@ -656,6 +658,18 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
/* Copy all the active planes' dlist contents to the hardware dlist. */
drm_atomic_crtc_for_each_plane(plane, crtc) {
+ /* Is this the first active plane? */
+ if (dlist_next == dlist_start)
+ /* We need to enable background fill when a plane
+ * could be alpha blending from the background, i.e.
+ * where no other plane is underneath. It suffices to
+ * consider the first active plane here since we set
+ * needs_bg_fill such that either the first plane
+ * already needs it or all planes on top blend from
+ * the first or a lower plane.
+ */
+ enable_bg_fill = to_vc4_plane(plane)->needs_bg_fill;
+
dlist_next += vc4_plane_write_dlist(plane, dlist_next);
}
@@ -664,6 +678,14 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size);
+ if (enable_bg_fill)
+ /* This sets a black background color fill, as is the case
+ * with other DRM drivers.
+ */
+ HVS_WRITE(SCALER_DISPBKGNDX(vc4_crtc->channel),
+ HVS_READ(SCALER_DISPBKGNDX(vc4_crtc->channel)) |
+ SCALER_DISPBKGND_FILL);
+
/* Only update DISPLIST if the CRTC was already running and is not
* being disabled.
* vc4_crtc_enable() takes care of updating the dlist just after
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2018-03-06 1:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-06 1:48 [PATCH 0/3] drm/vc4: Improve alpha format plane support Stefan Schake
2018-03-06 1:48 ` [PATCH 1/3] drm/vc4: Set premultiplied for alpha formats Stefan Schake
2018-03-06 19:35 ` Eric Anholt
2018-03-06 19:43 ` Stefan Schake
2018-03-06 1:48 ` [PATCH 2/3] drm/vc4: Check if plane requires background fill Stefan Schake
2018-03-06 19:43 ` Ville Syrjälä
2018-03-07 0:10 ` Eric Anholt
2018-03-07 15:05 ` Ville Syrjälä
2018-03-07 15:50 ` Eric Anholt
2018-03-06 1:48 ` Stefan Schake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520300919-103427-4-git-send-email-stschake@gmail.com \
--to=stschake@gmail.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=linux-rpi-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox