Skip to content

Commit 449b87e

Browse files
Tvrtko Ursulinardbiesheuvel
authored andcommitted
efi: sysfb_efi: Fix lfb_linelength calculation when applying quirks
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 <tvrtko.ursulin@igalia.com> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Melissa Wen <mwen@igalia.com> Cc: linux-efi@vger.kernel.org Tested-by: Melissa Wen <mwen@igalia.com> # v3 Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent bb2c941 commit 449b87e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/firmware/efi/sysfb_efi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,11 @@ __init void sysfb_apply_efi_quirks(void)
357357

358358
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
359359
dmi_check_system(efifb_dmi_swap_width_height)) {
360+
u32 bpp = __screen_info_lfb_bits_per_pixel(&screen_info);
361+
360362
swap(screen_info.lfb_width, screen_info.lfb_height);
361-
screen_info.lfb_linelength = 4 * screen_info.lfb_width;
363+
screen_info.lfb_linelength = bpp * screen_info.lfb_width /
364+
BITS_PER_BYTE;
362365
}
363366
}
364367

0 commit comments

Comments
 (0)