From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Blumenstingl Date: Sun, 26 Apr 2020 00:00:09 +0200 Subject: drm/meson: Use 24 bits per pixel for the framebuffer on Meson8/8b/8m2 All SoC generations before GXBB don't have a way to configure the alpha value for DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888. These formats have an X component instead of an alpha component. On Meson8/8b/8m2 there is no way to configure the alpha value to use instead of the X component. This results in the fact that the formats with X component are only supported on GXBB and newer. Use 24 bits per pixel and therefore DRM_FORMAT_RGB888 to get a working framebuffer console. Signed-off-by: Martin Blumenstingl --- drivers/gpu/drm/meson/meson_drv.c | 26 +++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 111111111111..222222222222 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -159,6 +159,30 @@ static void meson_vpu_init(struct meson_drm *priv) writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); } +static void meson_fbdev_setup(struct meson_drm *priv) +{ + unsigned int preferred_bpp; + + /* + * All SoC generations before GXBB don't have a way to configure the + * alpha value for DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888. These + * formats have an X component instead of an alpha component. On + * Meson8/8b/8m2 there is no way to configure the alpha value to use + * instead of the X component. This results in the fact that the + * formats with X component are only supported on GXBB and newer. Use + * 24 bits per pixel and therefore DRM_FORMAT_RGB888 to get a + * working framebuffer console. + */ + 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)) + preferred_bpp = 24; + else + preferred_bpp = 32; + + drm_fbdev_dma_setup(priv->drm, preferred_bpp); +} + struct meson_drm_soc_attr { struct meson_drm_soc_limits limits; const struct soc_device_attribute *attrs; @@ -353,7 +377,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) if (ret) goto uninstall_irq; - drm_fbdev_dma_setup(drm, 32); + meson_fbdev_setup(priv); return 0; -- Armbian