1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

Kernel: Separate framebuffers from bootmode

Bootmode used to control framebuffers, panic behavior, and SystemServer.
This patch factors framebuffer control into a separate flag.
Note that the combination 'bootmode=self-test fbdev=on' leads to
unexpected behavior, which can only be fixed in a later commit.
This commit is contained in:
Ben Wiederhake 2021-10-23 17:18:57 +02:00 committed by Andreas Kling
parent 314b8a374b
commit 542a88a7be
16 changed files with 26 additions and 26 deletions

View file

@ -214,10 +214,9 @@ BootMode CommandLine::boot_mode(Validate should_validate) const
return BootMode::Unknown;
}
UNMAP_AFTER_INIT bool CommandLine::is_no_framebuffer_devices_mode() const
UNMAP_AFTER_INIT bool CommandLine::are_framebuffer_devices_enabled() const
{
const auto mode = boot_mode();
return mode == BootMode::NoFramebufferDevices || mode == BootMode::SelfTest;
return lookup("fbdev"sv).value_or("on"sv) == "on"sv;
}
StringView CommandLine::userspace_init() const

View file

@ -66,7 +66,7 @@ public:
[[nodiscard]] bool is_vmmouse_enabled() const;
[[nodiscard]] PCIAccessLevel pci_access_level() const;
[[nodiscard]] bool is_legacy_time_enabled() const;
[[nodiscard]] bool is_no_framebuffer_devices_mode() const;
[[nodiscard]] bool are_framebuffer_devices_enabled() const;
[[nodiscard]] bool is_force_pio() const;
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;

View file

@ -33,10 +33,14 @@ bool GraphicsManagement::is_initialized()
}
UNMAP_AFTER_INIT GraphicsManagement::GraphicsManagement()
: m_framebuffer_devices_allowed(!kernel_command_line().is_no_framebuffer_devices_mode())
{
}
bool GraphicsManagement::framebuffer_devices_allowed() const
{
return kernel_command_line().are_framebuffer_devices_enabled();
}
void GraphicsManagement::deactivate_graphical_mode()
{
for (auto& graphics_device : m_graphics_devices) {
@ -69,7 +73,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
VERIFY(is_vga_compatible_pci_device(device_identifier) || is_display_controller_pci_device(device_identifier));
auto add_and_configure_adapter = [&](GraphicsDevice& graphics_device) {
m_graphics_devices.append(graphics_device);
if (!m_framebuffer_devices_allowed) {
if (!framebuffer_devices_allowed()) {
graphics_device.enable_consoles();
return;
}
@ -175,9 +179,8 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
* be created, so SystemServer will not try to initialize WindowServer.
*/
if (kernel_command_line().is_no_framebuffer_devices_mode()) {
dbgln("Forcing no initialization of framebuffer devices");
}
if (!framebuffer_devices_allowed())
dbgln("Forcing non-initialization of framebuffer devices");
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
// Note: Each graphics controller will try to set its native screen resolution

View file

@ -37,7 +37,7 @@ public:
unsigned allocate_minor_device_number() { return m_current_minor_number++; };
GraphicsManagement();
bool framebuffer_devices_allowed() const { return m_framebuffer_devices_allowed; }
bool framebuffer_devices_allowed() const;
bool framebuffer_devices_exist() const;
Spinlock& main_vga_lock() { return m_main_vga_lock; }
@ -54,7 +54,6 @@ private:
// Note: there could be multiple VGA adapters, but only one can operate in VGA mode
RefPtr<VGACompatibleAdapter> m_vga_adapter;
unsigned m_current_minor_number { 0 };
const bool m_framebuffer_devices_allowed;
Spinlock m_main_vga_lock;
};