All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: Ignore alpha on primary plane
@ 2018-03-02  0:32 Stefan Schake
  2018-03-02 14:39 ` Ville Syrjälä
  2018-03-05 21:15 ` Eric Anholt
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Schake @ 2018-03-02  0:32 UTC (permalink / raw)
  To: eric; +Cc: airlied, linux-rpi-kernel, dri-devel, Stefan Schake

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-06  1:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-02  0:32 [PATCH] drm/vc4: Ignore alpha on primary plane Stefan Schake
2018-03-02 14:39 ` 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

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.