1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:38:12 +00:00

Kernel: Only use multiboot framebuffer details if present

We should only look at the framebuffer structure members if the
MULTIBOOT_INFO_FRAMEBUFFER_INFO bit is set in the flags field.

Also add some logging if we ignored the fbdev command line argument
due to either not having a framebuffer provided by the bootloader, or
because we don't support the framebuffer format.
This commit is contained in:
Tom 2022-01-05 15:05:09 -07:00 committed by Linus Groh
parent 785c10fda9
commit 6a4d06e739
3 changed files with 18 additions and 8 deletions

View file

@ -88,7 +88,13 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
RefPtr<GenericGraphicsAdapter> adapter;
auto create_bootloader_framebuffer_device = [&]() {
if (multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB) {
if (multiboot_framebuffer_addr.is_null()) {
// Prekernel sets the framebuffer address to 0 if MULTIBOOT_INFO_FRAMEBUFFER_INFO
// is not present, as there is likely never a valid framebuffer at this physical address.
dmesgln("Graphics: Bootloader did not set up a framebuffer, ignoring fbdev argument");
} else if (multiboot_framebuffer_type != MULTIBOOT_FRAMEBUFFER_TYPE_RGB) {
dmesgln("Graphics: The framebuffer set up by the bootloader is not RGB, ignoring fbdev argument");
} else {
dmesgln("Graphics: Using a preset resolution from the bootloader");
adapter = VGACompatibleAdapter::initialize_with_preset_resolution(device_identifier,
multiboot_framebuffer_addr,