Skip to contentSkip to conversation

drm/fbdev-dma: Fix framebuffer mode for big endian devices

PATCH In review Thomas Huth 3 participants 4 messages Jul 2, 2024 – Jul 8, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/fbdev-dma: Fix framebuffer mode for big endian devices

The drm_mode_legacy_fb_format() function only generates formats suitable for little endian devices. switch to drm_driver_legacy_fb_format() here instead to take the device endianness into consideration, too.

---
Note: Patch has only been compile-tested since I lack an environment
for testing it. But it's the same fix as I required for the drm_mode_legacy_fb_format() in drm_fbdev_generic.c / drm_fbdev_ttm.c so I think this should be fine.

 drivers/gpu/drm/drm_fbdev_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_dma.c +2 -1
index 97ef6300d47e..fdef4a2f883f 100644
@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 		    sizes->surface_width, sizes->surface_height,
 		    sizes->surface_bpp);
 
-	format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
+					     sizes->surface_depth);
 	buffer = drm_client_framebuffer_create(client, sizes->surface_width,
 					       sizes->surface_height, format);
 	if (IS_ERR(buffer))
Signature · 1 line
2.45.2
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi

Am 02.07.24 um 14:17 schrieb Thomas Huth:

Quoted 6 lines

The drm_mode_legacy_fb_format() function only generates formats suitable for little endian devices. switch to drm_driver_legacy_fb_format() here instead to take the device endianness into consideration, too.

Thank you for taking the time to make the patch for fbdev-dma. I'll take care of merging both patches into the correct branches.

Best regards
Thomas

Quoted 23 lines

---
Note: Patch has only been compile-tested since I lack an environment
for testing it. But it's the same fix as I required for the drm_mode_legacy_fb_format() in drm_fbdev_generic.c / drm_fbdev_ttm.c so I think this should be fine.

  drivers/gpu/drm/drm_fbdev_dma.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_dma.c +2 -1
index 97ef6300d47e..fdef4a2f883f 100644
@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
  		    sizes->surface_width, sizes->surface_height,
  		    sizes->surface_bpp);
 
-	format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
+					     sizes->surface_depth);
  	buffer = drm_client_framebuffer_create(client, sizes->surface_width,
  					       sizes->surface_height, format);
  	if (IS_ERR(buffer))
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)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth

Thomas Huth <[email protected]> writes:

Hello Thomas,

Quoted 20 lines

The drm_mode_legacy_fb_format() function only generates formats suitable for little endian devices. switch to drm_driver_legacy_fb_format() here instead to take the device endianness into consideration, too.

---
Note: Patch has only been compile-tested since I lack an environment
for testing it. But it's the same fix as I required for the drm_mode_legacy_fb_format() in drm_fbdev_generic.c / drm_fbdev_ttm.c so I think this should be fine.

 drivers/gpu/drm/drm_fbdev_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_dma.c +0 -0
index 97ef6300d47e..fdef4a2f883f 100644

drivers/gpu/drm/drm_fbdev_dma.c static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, · line 108

Quoted 9 lines
drivers/gpu/drm/drm_fbdev_dma.c +2 -1
@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 		    sizes->surface_width, sizes->surface_height,
 		    sizes->surface_bpp);
 
-	format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
+					     sizes->surface_depth);
 	buffer = drm_client_framebuffer_create(client, sizes->surface_width,
 					       sizes->surface_height, format);
 	if (IS_ERR(buffer))

Makes sense to me.

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
#3 lore raw
In reply to Thomas Huth

Hi,

I've added a Fixes tag and merged the patch into drm-misc-next-fixes.

Best regards
Thomas

Am 02.07.24 um 14:17 schrieb Thomas Huth:

Quoted 29 lines

The drm_mode_legacy_fb_format() function only generates formats suitable for little endian devices. switch to drm_driver_legacy_fb_format() here instead to take the device endianness into consideration, too.

---
Note: Patch has only been compile-tested since I lack an environment
for testing it. But it's the same fix as I required for the drm_mode_legacy_fb_format() in drm_fbdev_generic.c / drm_fbdev_ttm.c so I think this should be fine.

  drivers/gpu/drm/drm_fbdev_dma.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_dma.c +2 -1
index 97ef6300d47e..fdef4a2f883f 100644
@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
  		    sizes->surface_width, sizes->surface_height,
  		    sizes->surface_bpp);
 
-	format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
+					     sizes->surface_depth);
  	buffer = drm_client_framebuffer_create(client, sizes->surface_width,
  					       sizes->surface_height, format);
  	if (IS_ERR(buffer))
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)