Hi

Am 03.12.25 um 10:39 schrieb Tvrtko Ursulin:
PIXEL_BIT_MASK formats can have either less or more than four bytes per
pixel so lets fix the lfb_linelenght calculation when applying the
swapped width and height quirks.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Suggested-by: Thomas Zimmermann <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Melissa Wen <[email protected]>
Cc: [email protected]
---
  drivers/firmware/efi/sysfb_efi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index 1d8b6966731c..14b61414c33a 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -358,7 +358,9 @@ __init void sysfb_apply_efi_quirks(void)
        if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
            dmi_check_system(efifb_dmi_swap_width_height)) {
                swap(screen_info.lfb_width, screen_info.lfb_height);
-               screen_info.lfb_linelength = 4 * screen_info.lfb_width;
+               screen_info.lfb_linelength = (unsigned 
int)screen_info.lfb_depth *

Rather than using lfb_depth directly, call __screen_info_lfb_bits_per_pixel(). [1] See the lengthy comment there on why depth is broken.

Best regards
Thomas

[1] https://elixir.bootlin.com/linux/v6.18/source/drivers/video/screen_info_generic.c#L170

+                                            screen_info.lfb_width /
+                                            BITS_PER_BYTE;
        }
  }

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to