Skip to content

Commit 9c17982

Browse files
Fabio EstevamThomas Zimmermann
authored andcommitted
drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
Since commit 5593582 ("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. Cc: stable@vger.kernel.org Fixes: 5593582 ("drm/fb-helper: Don't use the preferred depth for the BPP default") Signed-off-by: Fabio Estevam <festevam@denx.de> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20250417103458.2496790-1-festevam@gmail.com
1 parent eb0851e commit 9c17982

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/tiny/panel-mipi-dbi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
390390

391391
spi_set_drvdata(spi, drm);
392392

393-
drm_client_setup(drm, NULL);
393+
if (bpp == 16)
394+
drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB565);
395+
else
396+
drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB888);
394397

395398
return 0;
396399
}

0 commit comments

Comments
 (0)