From 8b70c9652f65a53cfdcc813c4963e09ff9c631b4 Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jackpot51@gmail.com> Date: Sat, 27 Aug 2022 18:18:48 -0600 Subject: [PATCH] Allow any modes where stride is identical to width --- src/os/bios/vbe.rs | 4 ++-- src/os/uefi/mod.rs | 4 +++- src/os/uefi/video_mode.rs | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/os/bios/vbe.rs b/src/os/bios/vbe.rs index 78e0547..ca1e942 100644 --- a/src/os/bios/vbe.rs +++ b/src/os/bios/vbe.rs @@ -131,8 +131,8 @@ impl Iterator for VideoModeIter { let width = mode_info.xresolution as u32; let height = mode_info.yresolution as u32; - //TODO: support resolutions that are not perfect multiples of 4 - if width % 4 != 0 { + // We do not support framebuffers which have padding on each line + if width * 4 != mode_info.bytesperscanline as u32 { continue; } diff --git a/src/os/uefi/mod.rs b/src/os/uefi/mod.rs index 04c26b5..87c3a67 100644 --- a/src/os/uefi/mod.rs +++ b/src/os/uefi/mod.rs @@ -112,7 +112,9 @@ impl Os< (output.0.SetMode)(output.0, mode.id) ).unwrap(); - // Update frame buffer base + // Update with actual mode information + mode.width = output.0.Mode.Info.HorizontalResolution; + mode.height = output.0.Mode.Info.VerticalResolution; mode.base = output.0.Mode.FrameBufferBase as u64; } diff --git a/src/os/uefi/video_mode.rs b/src/os/uefi/video_mode.rs index 38bb1bb..d61410c 100644 --- a/src/os/uefi/video_mode.rs +++ b/src/os/uefi/video_mode.rs @@ -43,8 +43,8 @@ impl Iterator for VideoModeIter { let width = mode.HorizontalResolution; let height = mode.VerticalResolution; - //TODO: support resolutions that are not perfect multiples of 4 - if width % 4 != 0 { + // We do not support framebuffers which have padding on each line + if width != mode.PixelsPerScanLine { continue; } -- GitLab