All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: Filter out alpha formats for primary plane
@ 2018-04-16 19:01 Kristian H. Kristensen
  2018-04-16 20:38 ` Sean Paul
  2018-04-16 21:59 ` Eric Anholt
  0 siblings, 2 replies; 4+ messages in thread
From: Kristian H. Kristensen @ 2018-04-16 19:01 UTC (permalink / raw)
  To: dri-devel; +Cc: Kristian H. Kristensen

Rockchip doesn't support per-pixel alpha blending for the lowest
window in the stack. While the hw supports restacking the windows, we
don't expose that in KMS, so just filter out alpha formats for the
primary plane.

Change-Id: I7828d5bf0f0b5c6dd23f9e52aa01a5a683131d2f
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fae37b1cd691..2efe78600fd0 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1547,6 +1547,28 @@ static irqreturn_t vop_isr(int irq, void *data)
 	return ret;
 }
 
+static uint32_t formats_for_win(const struct vop_win_phy *phy, uint32_t win,
+				uint32_t *formats, uint32_t max_formats)
+{
+	uint32_t i, j;
+
+	BUG_ON(max_formats < phy->nformats);
+
+	j = 0;
+	for (i = 0; i < phy->nformats; i++) {
+		/*
+		 * win0 doesn't support per-pixel alpha, so don't add any RGBA
+		 * formats for that plane.
+		 */
+		if (win == 0 && is_alpha_support(phy->data_formats[i]))
+			continue;
+
+		formats[j++] = phy->data_formats[i];
+	}
+
+	return j;
+}
+
 static int vop_create_crtc(struct vop *vop)
 {
 	const struct vop_data *vop_data = vop->data;
@@ -1568,15 +1590,17 @@ static int vop_create_crtc(struct vop *vop)
 	for (i = 0; i < vop_data->win_size; i++) {
 		struct vop_win *vop_win = &vop->win[i];
 		const struct vop_win_data *win_data = vop_win->data;
+		uint32_t nformats, formats[16];
 
 		if (win_data->type != DRM_PLANE_TYPE_PRIMARY &&
 		    win_data->type != DRM_PLANE_TYPE_CURSOR)
 			continue;
 
+		nformats = formats_for_win(win_data->phy, i,
+					   formats, ARRAY_SIZE(formats));
 		ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base,
 					       0, &vop_plane_funcs,
-					       win_data->phy->data_formats,
-					       win_data->phy->nformats,
+					       formats, nformats,
 					       win_data->phy->format_modifiers,
 					       win_data->type, NULL);
 		if (ret) {
-- 
2.13.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-04-16 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 19:01 [PATCH] drm/rockchip: Filter out alpha formats for primary plane Kristian H. Kristensen
2018-04-16 20:38 ` Sean Paul
2018-04-16 21:59 ` Eric Anholt
2018-04-16 22:04   ` Kristian Høgsberg

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.