Files
build/patch/kernel/archive/meson-6.12/0048-drm-meson-Use-a-separate-list-of-supported-formats-f.patch
Dominik Wójt 5b29f4dd4b meson: kernel update: legacy -> 6.6, current -> 6.12 (#7801)
* Add MXQ target. Copy HDMI fix from odroid-c1.
* meson8, MXQ: add boot from usb support, configurable dtb
* MXQ: remove boot logo
Built-in U-BOOT is used, so the logo will not be displayed anyway.
* meson: kernel update: legacy -> 6.6, current -> 6.12
* Change Odroid C1 and Onecloud to community supported as build now passes
---------
Co-authored-by: Igor Pecovnik <igor@armbian.com>
2025-02-08 23:08:34 +01:00

84 lines
3.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: Sat, 25 Apr 2020 21:53:21 +0200
Subject: drm/meson: Use a separate list of supported formats for 32-bit SoCs
The VIU_OSD1_CTRL_STAT2 and VIU_OSD2_CTRL_STAT2 registers on
Meson8/Meson8b/Meson8m2 don't have the following bits:
- replaced_alpha_en in bit [14]
- replaced_alpha in bits [13:6]
This results in formats with X component (currently DRM_FORMAT_XRGB8888
and DRM_FORMAT_XBGR8888 are supported on GXBB and later) are not
supported. Depending on the application this may work (kmscube for
example - which seems to properly set 0xff as alpha component), but
there's other examples (Kodi for example) where there are alpha blending
issues because the alpha value is not defined (and thus some random
value).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/gpu/drm/meson/meson_plane.c | 30 +++++++++-
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index 111111111111..222222222222 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -471,7 +471,20 @@ static const struct drm_plane_funcs meson_plane_funcs = {
.format_mod_supported = meson_plane_format_mod_supported,
};
-static const uint32_t supported_drm_formats[] = {
+/*
+ * X components (for example in DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888)
+ * are not supported because these older SoC's are lacking the OSD_REPLACE_EN
+ * bit to replace the X alpha component with a static value, leaving the alpha
+ * component in an undefined state.
+ */
+static const uint32_t supported_drm_formats_m8[] = {
+ DRM_FORMAT_ARGB8888,
+ DRM_FORMAT_ABGR8888,
+ DRM_FORMAT_RGB888,
+ DRM_FORMAT_RGB565,
+};
+
+static const uint32_t supported_drm_formats_gx[] = {
DRM_FORMAT_ARGB8888,
DRM_FORMAT_ABGR8888,
DRM_FORMAT_XRGB8888,
@@ -533,6 +546,8 @@ int meson_plane_create(struct meson_drm *priv)
{
struct meson_plane *meson_plane;
struct drm_plane *plane;
+ unsigned int num_drm_formats;
+ const uint32_t *drm_formats;
const uint64_t *format_modifiers = format_modifiers_default;
int ret;
@@ -549,10 +564,19 @@ int meson_plane_create(struct meson_drm *priv)
else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A))
format_modifiers = format_modifiers_afbc_g12a;
+ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) ||
+ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) ||
+ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) {
+ drm_formats = supported_drm_formats_m8;
+ num_drm_formats = ARRAY_SIZE(supported_drm_formats_m8);
+ } else {
+ drm_formats = supported_drm_formats_gx;
+ num_drm_formats = ARRAY_SIZE(supported_drm_formats_gx);
+ }
+
ret = drm_universal_plane_init(priv->drm, plane, 0xFF,
&meson_plane_funcs,
- supported_drm_formats,
- ARRAY_SIZE(supported_drm_formats),
+ drm_formats, num_drm_formats,
format_modifiers,
DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane");
if (ret) {
--
Armbian