drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
PATCH v2 1/1 drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
From: Fabio Estevam <[email protected]>
Since commit 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP default"), RGB565 displays such as the CFAF240320X no longer render correctly: colors are distorted and the content is shown twice horizontally.
This regression is due to the fbdev emulation layer defaulting to 32 bits per pixel, whereas the display expects 16 bpp (RGB565). As a result, the framebuffer data is incorrectly interpreted by the panel.
Fix the issue by calling drm_client_setup_with_fourcc() with a format explicitly selected based on the display's bits-per-pixel value. For 16 bpp, use DRM_FORMAT_RGB565; for other values, fall back to the previous behavior. This ensures that the allocated framebuffer format matches the hardware expectations, avoiding color and layout corruption.
Tested on a CFAF240320X display with an RGB565 configuration, confirming correct colors and layout after applying this patch.
---
Changes since v1:
- Improved the commit log.
- Added Thomas' Reviewed-by tag.
- Added more maintainers on Cc as panel-mipi-dbi.c has been marked as orphan.
drivers/gpu/drm/tiny/panel-mipi-dbi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/panel-mipi-dbi.c +4 -1
@@ -390,7 +390,10 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)spi_set_drvdata (spi, drm); -drm_client_setup (drm,NULL ); +if (bpp ==16 ) +drm_client_setup_with_fourcc (drm,DRM_FORMAT_RGB565 ); +else +drm_client_setup_with_fourcc (drm,DRM_FORMAT_RGB888 );return 0 ; }
Signature · 1 line
2.34.1
Fabio Estevam <[email protected]> writes:
Hello Fabio,
Quoted 17 lines
From: Fabio Estevam <[email protected]>
Since commit
559358282e5b("drm/fb-helper: Don't use the preferred depth for the BPP default"), RGB565 displays such as the CFAF240320X no longer render correctly: colors are distorted and the content is shown twice horizontally.This regression is due to the fbdev emulation layer defaulting to 32 bits per pixel, whereas the display expects 16 bpp (RGB565). As a result, the framebuffer data is incorrectly interpreted by the panel.
Fix the issue by calling
drm_client_setup_with_fourcc()with a format explicitly selected based on the display's bits-per-pixel value. For 16 bpp, useDRM_FORMAT_RGB565; for other values, fall back to the previous behavior. This ensures that the allocated framebuffer format matches the hardware expectations, avoiding color and layout corruption.
Quoted 8 lines
Tested on a CFAF240320X display with an RGB565 configuration, confirming correct colors and layout after applying this patch.
Fixes 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP default")Signed-off-by Fabio Estevam <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Hi Javier and Thomas,
Quoted 25 lines · Javier Martinez Canillas
Fabio Estevam <[email protected]> writes:
Hello Fabio,
Quoted 20 lines
From: Fabio Estevam <[email protected]>
Since commit
559358282e5b("drm/fb-helper: Don't use the preferred depth for the BPP default"), RGB565 displays such as the CFAF240320X no longer render correctly: colors are distorted and the content is shown twice horizontally.This regression is due to the fbdev emulation layer defaulting to 32 bits per pixel, whereas the display expects 16 bpp (RGB565). As a result, the framebuffer data is incorrectly interpreted by the panel.
Fix the issue by calling
drm_client_setup_with_fourcc()with a format explicitly selected based on the display's bits-per-pixel value. For 16 bpp, useDRM_FORMAT_RGB565; for other values, fall back to the previous behavior. This ensures that the allocated framebuffer format matches the hardware expectations, avoiding color and layout corruption.Tested on a CFAF240320X display with an RGB565 configuration, confirming correct colors and layout after applying this patch.
Quoted 7 lines
Quoted 5 lines
Fixes 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP default")Signed-off-by Fabio Estevam <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Reviewed-by Javier Martinez Canillas <[email protected]>
Could you please help apply this fix?
Thanks
Am 09.05.25 um 13:06 schrieb Fabio Estevam:
Quoted 28 lines
Hi Javier and Thomas,
Quoted 24 lines · Javier Martinez Canillas
Fabio Estevam <[email protected]> writes:
Hello Fabio,
Quoted 20 lines
From: Fabio Estevam <[email protected]>
Since commit
559358282e5b("drm/fb-helper: Don't use the preferred depth for the BPP default"), RGB565 displays such as the CFAF240320X no longer render correctly: colors are distorted and the content is shown twice horizontally.This regression is due to the fbdev emulation layer defaulting to 32 bits per pixel, whereas the display expects 16 bpp (RGB565). As a result, the framebuffer data is incorrectly interpreted by the panel.
Fix the issue by calling
drm_client_setup_with_fourcc()with a format explicitly selected based on the display's bits-per-pixel value. For 16 bpp, useDRM_FORMAT_RGB565; for other values, fall back to the previous behavior. This ensures that the allocated framebuffer format matches the hardware expectations, avoiding color and layout corruption.Tested on a CFAF240320X display with an RGB565 configuration, confirming correct colors and layout after applying this patch.
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Fixes 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP default")Signed-off-by Fabio Estevam <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Reviewed-by Javier Martinez Canillas <[email protected]>Could you please help apply this fix?
Merged into drm-misc-fixes
Best regards
Thomas
Quoted 2 lines
Thanks
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)