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] drm/vc4: Ignore alpha on primary plane
Date: Fri, 2 Mar 2018 01:32:40 +0100 [thread overview]
Message-ID: <1519950760-68447-1-git-send-email-stschake@gmail.com> (raw)
We allow alpha formats on the primary plane but a partially transparent
framebuffer will cause a corrupted display. With this change black pixels
are output instead, in line with the behavior for other DRM drivers.
Signed-off-by: Stefan Schake <stschake@gmail.com>
---
Test program is available at https://github.com/stschake/vc4-alpha-test
drivers/gpu/drm/vc4/vc4_plane.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 61ad955..8c829fa 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -521,6 +521,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
u32 ctl0_offset = vc4_state->dlist_count;
const struct hvs_format *format = vc4_get_hvs_format(fb->format->format);
int num_planes = drm_format_num_planes(format->drm);
+ bool primary_plane = state->crtc->primary == plane;
u32 scl0, scl1, pitch0;
u32 lbm_size, tiling;
unsigned long irqflags;
@@ -620,8 +621,12 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
/* Position Word 2: Source Image Size, Alpha Mode */
vc4_state->pos2_offset = vc4_state->dlist_count;
+ /* We do not enable the HVS background color fill so the primary plane
+ * must be opaque to avoid display artifacts. Achieve this by always
+ * using fixed alpha (initialized to 0xff above) on the primary plane.
+ */
vc4_dlist_write(vc4_state,
- VC4_SET_FIELD(fb->format->has_alpha ?
+ VC4_SET_FIELD(fb->format->has_alpha && !primary_plane ?
SCALER_POS2_ALPHA_MODE_PIPELINE :
SCALER_POS2_ALPHA_MODE_FIXED,
SCALER_POS2_ALPHA_MODE) |
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-03-02 0:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 0:32 Stefan Schake [this message]
2018-03-02 14:39 ` [PATCH] drm/vc4: Ignore alpha on primary plane Ville Syrjälä
2018-03-02 14:43 ` Ville Syrjälä
2018-03-02 15:06 ` Stefan Schake
2018-03-02 15:21 ` Ville Syrjälä
2018-03-02 15:48 ` Stefan Schake
2018-03-02 16:04 ` Ville Syrjälä
2018-03-02 17:13 ` Eric Anholt
2018-03-02 17:58 ` Ville Syrjälä
2018-03-05 21:15 ` Eric Anholt
2018-03-06 1:55 ` Stefan Schake
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=1519950760-68447-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.