public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
@ 2025-04-17 10:34 Fabio Estevam
  2025-04-22 21:53 ` Javier Martinez Canillas
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2025-04-17 10:34 UTC (permalink / raw)
  To: simona
  Cc: airlied, maarten.lankhorst, mripard, noralf, tzimmermann, javierm,
	dri-devel, Fabio Estevam, stable

From: Fabio Estevam <festevam@denx.de>

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.

Cc: stable@vger.kernel.org
Fixes: 559358282e5b ("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>
---
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(-)

diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index 0460ecaef4bd..23914a9f7fd3 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -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;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
  2025-04-17 10:34 [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc() Fabio Estevam
@ 2025-04-22 21:53 ` Javier Martinez Canillas
  2025-05-09 11:06   ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Javier Martinez Canillas @ 2025-04-22 21:53 UTC (permalink / raw)
  To: Fabio Estevam, simona
  Cc: airlied, maarten.lankhorst, mripard, noralf, tzimmermann,
	dri-devel, Fabio Estevam, stable

Fabio Estevam <festevam@gmail.com> writes:

Hello Fabio,

> From: Fabio Estevam <festevam@denx.de>
>
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: 559358282e5b ("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>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
  2025-04-22 21:53 ` Javier Martinez Canillas
@ 2025-05-09 11:06   ` Fabio Estevam
  2025-05-12  6:58     ` Thomas Zimmermann
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2025-05-09 11:06 UTC (permalink / raw)
  To: Javier Martinez Canillas, tzimmermann
  Cc: simona, airlied, maarten.lankhorst, mripard, noralf, dri-devel,
	Fabio Estevam, stable

Hi Javier and Thomas,

On Tue, Apr 22, 2025 at 6:53 PM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> Fabio Estevam <festevam@gmail.com> writes:
>
> Hello Fabio,
>
> > From: Fabio Estevam <festevam@denx.de>
> >
> > 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.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 559358282e5b ("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>

Could you please help apply this fix?

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
  2025-05-09 11:06   ` Fabio Estevam
@ 2025-05-12  6:58     ` Thomas Zimmermann
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Zimmermann @ 2025-05-12  6:58 UTC (permalink / raw)
  To: Fabio Estevam, Javier Martinez Canillas
  Cc: simona, airlied, maarten.lankhorst, mripard, noralf, dri-devel,
	Fabio Estevam, stable



Am 09.05.25 um 13:06 schrieb Fabio Estevam:
> Hi Javier and Thomas,
>
> On Tue, Apr 22, 2025 at 6:53 PM Javier Martinez Canillas
> <javierm@redhat.com> wrote:
>> Fabio Estevam <festevam@gmail.com> writes:
>>
>> Hello Fabio,
>>
>>> From: Fabio Estevam <festevam@denx.de>
>>>
>>> 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.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: 559358282e5b ("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>
> Could you please help apply this fix?

Merged into drm-misc-fixes

Best regards
Thomas

>
> Thanks

-- 
--
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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-12  6:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 10:34 [PATCH v2] drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc() Fabio Estevam
2025-04-22 21:53 ` Javier Martinez Canillas
2025-05-09 11:06   ` Fabio Estevam
2025-05-12  6:58     ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox