diff --git a/projects/Allwinner/patches/linux/0001-backport-from-5.6.patch b/projects/Allwinner/patches/linux/0001-backport-from-5.6.patch index faba049136..4bf09fe522 100644 --- a/projects/Allwinner/patches/linux/0001-backport-from-5.6.patch +++ b/projects/Allwinner/patches/linux/0001-backport-from-5.6.patch @@ -1900,426 +1900,6 @@ index c17d30e74bb1..ce497d0197df 100644 -- 2.24.1 -From deda8aa0bedde60a7a8e0b471acad67bce60670b Mon Sep 17 00:00:00 2001 -From: Jernej Skrabec -Date: Tue, 18 Feb 2020 17:52:59 +0100 -Subject: [PATCH 1/7] drm/sun4i: de2/de3: Remove unsupported VI layer formats - -YUV444 and YVU444 are planar formats, but HW format RGB888 is packed. -This means that those two mappings were never correct. Remove them. - -Fixes: 60a3dcf96aa8 ("drm/sun4i: Add DE2 definitions for YUV formats") -Signed-off-by: Jernej Skrabec ---- - drivers/gpu/drm/sun4i/sun8i_mixer.c | 12 ------------ - drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 -- - 2 files changed, 14 deletions(-) - -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c -index 7c24f8f832a5..3a78dbbceb8a 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c -@@ -196,12 +196,6 @@ static const struct de2_fmt_info de2_formats[] = { - .rgb = false, - .csc = SUN8I_CSC_MODE_YUV2RGB, - }, -- { -- .drm_fmt = DRM_FORMAT_YUV444, -- .de2_fmt = SUN8I_MIXER_FBFMT_RGB888, -- .rgb = true, -- .csc = SUN8I_CSC_MODE_YUV2RGB, -- }, - { - .drm_fmt = DRM_FORMAT_YUV422, - .de2_fmt = SUN8I_MIXER_FBFMT_YUV422, -@@ -220,12 +214,6 @@ static const struct de2_fmt_info de2_formats[] = { - .rgb = false, - .csc = SUN8I_CSC_MODE_YUV2RGB, - }, -- { -- .drm_fmt = DRM_FORMAT_YVU444, -- .de2_fmt = SUN8I_MIXER_FBFMT_RGB888, -- .rgb = true, -- .csc = SUN8I_CSC_MODE_YVU2RGB, -- }, - { - .drm_fmt = DRM_FORMAT_YVU422, - .de2_fmt = SUN8I_MIXER_FBFMT_YUV422, -diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -index 42d445d23773..6a244d6fafd9 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -@@ -431,11 +431,9 @@ static const u32 sun8i_vi_layer_formats[] = { - DRM_FORMAT_YUV411, - DRM_FORMAT_YUV420, - DRM_FORMAT_YUV422, -- DRM_FORMAT_YUV444, - DRM_FORMAT_YVU411, - DRM_FORMAT_YVU420, - DRM_FORMAT_YVU422, -- DRM_FORMAT_YVU444, - }; - - struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, --- -2.25.1 - -From 3d1e6278957050416a425e0b2f3108c1e070ef4f Mon Sep 17 00:00:00 2001 -From: Jernej Skrabec -Date: Mon, 17 Feb 2020 17:32:10 +0100 -Subject: [PATCH 2/7] drm/sun4i: Add separate DE3 VI layer formats - -DE3 VI layers support alpha blending, but DE2 VI layers do not. -Additionally, DE3 VI layers support 10-bit RGB and YUV formats. - -Make a separate list for DE3. - -Fixes: c50519e6db4d ("drm/sun4i: Add basic support for DE3") -Signed-off-by: Jernej Skrabec ---- - drivers/gpu/drm/sun4i/sun8i_mixer.c | 36 ++++++++++++++++ - drivers/gpu/drm/sun4i/sun8i_mixer.h | 11 +++++ - drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 58 ++++++++++++++++++++++++-- - 3 files changed, 102 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c -index 3a78dbbceb8a..655445bfe64a 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c -@@ -148,6 +148,30 @@ static const struct de2_fmt_info de2_formats[] = { - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ .drm_fmt = DRM_FORMAT_ARGB2101010, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, -+ { -+ .drm_fmt = DRM_FORMAT_ABGR2101010, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR2101010, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, -+ { -+ .drm_fmt = DRM_FORMAT_RGBA1010102, -+ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA1010102, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, -+ { -+ .drm_fmt = DRM_FORMAT_BGRA1010102, -+ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA1010102, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_UYVY, - .de2_fmt = SUN8I_MIXER_FBFMT_UYVY, -@@ -232,6 +256,18 @@ static const struct de2_fmt_info de2_formats[] = { - .rgb = false, - .csc = SUN8I_CSC_MODE_YVU2RGB, - }, -+ { -+ .drm_fmt = DRM_FORMAT_P010, -+ .de2_fmt = SUN8I_MIXER_FBFMT_P010_YUV, -+ .rgb = false, -+ .csc = SUN8I_CSC_MODE_YUV2RGB, -+ }, -+ { -+ .drm_fmt = DRM_FORMAT_P210, -+ .de2_fmt = SUN8I_MIXER_FBFMT_P210_YUV, -+ .rgb = false, -+ .csc = SUN8I_CSC_MODE_YUV2RGB, -+ }, - }; - - const struct de2_fmt_info *sun8i_mixer_format_info(u32 format) -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h -index c6cc94057faf..345b28b0a80a 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.h -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h -@@ -93,6 +93,10 @@ - #define SUN8I_MIXER_FBFMT_ABGR1555 17 - #define SUN8I_MIXER_FBFMT_RGBA5551 18 - #define SUN8I_MIXER_FBFMT_BGRA5551 19 -+#define SUN8I_MIXER_FBFMT_ARGB2101010 20 -+#define SUN8I_MIXER_FBFMT_ABGR2101010 21 -+#define SUN8I_MIXER_FBFMT_RGBA1010102 22 -+#define SUN8I_MIXER_FBFMT_BGRA1010102 23 - - #define SUN8I_MIXER_FBFMT_YUYV 0 - #define SUN8I_MIXER_FBFMT_UYVY 1 -@@ -109,6 +113,13 @@ - /* format 12 is semi-planar YUV411 UVUV */ - /* format 13 is semi-planar YUV411 VUVU */ - #define SUN8I_MIXER_FBFMT_YUV411 14 -+/* format 15 doesn't exist */ -+/* format 16 is P010 YVU */ -+#define SUN8I_MIXER_FBFMT_P010_YUV 17 -+/* format 18 is P210 YVU */ -+#define SUN8I_MIXER_FBFMT_P210_YUV 19 -+/* format 20 is packed YVU444 10-bit */ -+/* format 21 is packed YUV444 10-bit */ - - /* - * Sub-engines listed bellow are unused for now. The EN registers are here only -diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -index 6a244d6fafd9..6c0084a3c3d7 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -@@ -436,24 +436,76 @@ static const u32 sun8i_vi_layer_formats[] = { - DRM_FORMAT_YVU422, - }; - -+static const u32 sun8i_vi_layer_de3_formats[] = { -+ DRM_FORMAT_ABGR1555, -+ DRM_FORMAT_ABGR2101010, -+ DRM_FORMAT_ABGR4444, -+ DRM_FORMAT_ABGR8888, -+ DRM_FORMAT_ARGB1555, -+ DRM_FORMAT_ARGB2101010, -+ DRM_FORMAT_ARGB4444, -+ DRM_FORMAT_ARGB8888, -+ DRM_FORMAT_BGR565, -+ DRM_FORMAT_BGR888, -+ DRM_FORMAT_BGRA1010102, -+ DRM_FORMAT_BGRA5551, -+ DRM_FORMAT_BGRA4444, -+ DRM_FORMAT_BGRA8888, -+ DRM_FORMAT_BGRX8888, -+ DRM_FORMAT_RGB565, -+ DRM_FORMAT_RGB888, -+ DRM_FORMAT_RGBA1010102, -+ DRM_FORMAT_RGBA4444, -+ DRM_FORMAT_RGBA5551, -+ DRM_FORMAT_RGBA8888, -+ DRM_FORMAT_RGBX8888, -+ DRM_FORMAT_XBGR8888, -+ DRM_FORMAT_XRGB8888, -+ -+ DRM_FORMAT_NV16, -+ DRM_FORMAT_NV12, -+ DRM_FORMAT_NV21, -+ DRM_FORMAT_NV61, -+ DRM_FORMAT_P010, -+ DRM_FORMAT_P210, -+ DRM_FORMAT_UYVY, -+ DRM_FORMAT_VYUY, -+ DRM_FORMAT_YUYV, -+ DRM_FORMAT_YVYU, -+ DRM_FORMAT_YUV411, -+ DRM_FORMAT_YUV420, -+ DRM_FORMAT_YUV422, -+ DRM_FORMAT_YVU411, -+ DRM_FORMAT_YVU420, -+ DRM_FORMAT_YVU422, -+}; -+ - struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, - struct sun8i_mixer *mixer, - int index) - { - u32 supported_encodings, supported_ranges; -+ unsigned int plane_cnt, format_count; - struct sun8i_vi_layer *layer; -- unsigned int plane_cnt; -+ const u32 *formats; - int ret; - - layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL); - if (!layer) - return ERR_PTR(-ENOMEM); - -+ if (mixer->cfg->is_de3) { -+ formats = sun8i_vi_layer_de3_formats; -+ format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats); -+ } else { -+ formats = sun8i_vi_layer_formats; -+ format_count = ARRAY_SIZE(sun8i_vi_layer_formats); -+ } -+ - /* possible crtcs are set later */ - ret = drm_universal_plane_init(drm, &layer->plane, 0, - &sun8i_vi_layer_funcs, -- sun8i_vi_layer_formats, -- ARRAY_SIZE(sun8i_vi_layer_formats), -+ formats, format_count, - NULL, DRM_PLANE_TYPE_OVERLAY, NULL); - if (ret) { - dev_err(drm->dev, "Couldn't initialize layer\n"); --- -2.25.1 - -From 9cdf885761bd5fc00ad3a34249b083999e4a0b8c Mon Sep 17 00:00:00 2001 -From: Jernej Skrabec -Date: Mon, 17 Feb 2020 18:02:46 +0100 -Subject: [PATCH 3/7] drm/sun4i: Fix DE2 VI layer format support - -DE2 VI layer doesn't support blending which means alpha channel is -ignored. Replace all formats with alpha with "don't care" (X) channel. - -Signed-off-by: Jernej Skrabec ---- - drivers/gpu/drm/sun4i/sun8i_mixer.c | 56 ++++++++++++++++++++++++++ - drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 22 +++++----- - 2 files changed, 67 insertions(+), 11 deletions(-) - -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c -index 655445bfe64a..4a64f7ae437a 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c -@@ -106,48 +106,104 @@ static const struct de2_fmt_info de2_formats[] = { - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_XRGB4444, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB4444, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_ABGR4444, - .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_XBGR4444, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_RGBA4444, - .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_RGBX4444, -+ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_BGRA4444, - .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_BGRX4444, -+ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_ARGB1555, - .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_XRGB1555, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_ABGR1555, - .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_XBGR1555, -+ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_RGBA5551, - .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_RGBX5551, -+ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_BGRA5551, - .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551, - .rgb = true, - .csc = SUN8I_CSC_MODE_OFF, - }, -+ { -+ /* for DE2 VI layer which ignores alpha */ -+ .drm_fmt = DRM_FORMAT_BGRX5551, -+ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551, -+ .rgb = true, -+ .csc = SUN8I_CSC_MODE_OFF, -+ }, - { - .drm_fmt = DRM_FORMAT_ARGB2101010, - .de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010, -diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -index 6c0084a3c3d7..b8398ca18b0f 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -@@ -398,26 +398,26 @@ static const struct drm_plane_funcs sun8i_vi_layer_funcs = { - }; - - /* -- * While all RGB formats are supported, VI planes don't support -- * alpha blending, so there is no point having formats with alpha -- * channel if their opaque analog exist. -+ * While DE2 VI layer supports same RGB formats as UI layer, alpha -+ * channel is ignored. This structure lists all unique variants -+ * where alpha channel is replaced with "don't care" (X) channel. - */ - static const u32 sun8i_vi_layer_formats[] = { -- DRM_FORMAT_ABGR1555, -- DRM_FORMAT_ABGR4444, -- DRM_FORMAT_ARGB1555, -- DRM_FORMAT_ARGB4444, - DRM_FORMAT_BGR565, - DRM_FORMAT_BGR888, -- DRM_FORMAT_BGRA5551, -- DRM_FORMAT_BGRA4444, -+ DRM_FORMAT_BGRX4444, -+ DRM_FORMAT_BGRX5551, - DRM_FORMAT_BGRX8888, - DRM_FORMAT_RGB565, - DRM_FORMAT_RGB888, -- DRM_FORMAT_RGBA4444, -- DRM_FORMAT_RGBA5551, -+ DRM_FORMAT_RGBX4444, -+ DRM_FORMAT_RGBX5551, - DRM_FORMAT_RGBX8888, -+ DRM_FORMAT_XBGR1555, -+ DRM_FORMAT_XBGR4444, - DRM_FORMAT_XBGR8888, -+ DRM_FORMAT_XRGB1555, -+ DRM_FORMAT_XRGB4444, - DRM_FORMAT_XRGB8888, - - DRM_FORMAT_NV16, --- -2.25.1 - From ad659ce8a20e12b2508c977818e8c21487f67793 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 29 Feb 2020 09:49:49 +0100