Blob Blame History Raw
From: Thierry Reding <treding@nvidia.com>
Date: Mon, 8 Jan 2018 13:40:44 +0100
Subject: drm/tegra: dc: Restore YUV overlay support
Git-commit: 5467a8b8da9890e6216dd786e7f65cce5f23d014
Patch-mainline: v4.16-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

Commit ebae8d07435a ("drm/tegra: dc: Implement legacy blending") broke
support for YUV overlays by accident. The reason is that YUV formats are
considered opaque because they have no alpha component, but on the other
hand no corresponding format with an alpha component can be returned. In
the case of YUV formats, the opaque format is the same as the alpha
format, so add the special case to restore YUV overlay support.

Reported-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/tegra/plane.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/gpu/drm/tegra/plane.c
+++ b/drivers/gpu/drm/tegra/plane.c
@@ -276,6 +276,11 @@ bool tegra_plane_format_has_alpha(unsign
 
 int tegra_plane_format_get_alpha(unsigned int opaque, unsigned int *alpha)
 {
+	if (tegra_plane_format_is_yuv(opaque, NULL)) {
+		*alpha = opaque;
+		return 0;
+	}
+
 	switch (opaque) {
 	case WIN_COLOR_DEPTH_B5G5R5X1:
 		*alpha = WIN_COLOR_DEPTH_B5G5R5A1;