1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

Kernel: Instantiate a TextModeConsole early on if there's no framebuffer

If the bootloader that loaded us is providing a framebuffer details from
the Multiboot protocol then we can instantiate a framebuffer console.
Otherwise, we should use a text mode console, assuming that the BIOS and
the bootloader didn't try to modeset the screen resolution so we have is
a VGA 80x25 text mode being displayed on screen.

Since "boot_framebuffer_console" is no longer a good representative as a
global variable name, it's changed to g_boot_console to match the fact
that it can be assigned with a text mode console and not framebuffer
console if needed.
This commit is contained in:
Liav A 2022-02-09 21:09:41 +02:00 committed by Linus Groh
parent 278b0aa629
commit c6c3e2a7fd
3 changed files with 14 additions and 9 deletions

View file

@ -23,7 +23,7 @@ namespace Kernel {
static Singleton<GraphicsManagement> s_the;
extern Atomic<Graphics::BootFramebufferConsole*> boot_framebuffer_console;
extern Atomic<Graphics::Console*> g_boot_console;
GraphicsManagement& GraphicsManagement::the()
{
@ -221,7 +221,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
if (!m_console) {
// If no graphics driver was instantiated and we had a bootloader provided
// framebuffer console we can simply re-use it.
if (auto* boot_console = boot_framebuffer_console.load()) {
if (auto* boot_console = g_boot_console.load()) {
m_console = *boot_console;
boot_console->unref(); // Drop the leaked reference from Kernel::init()
}
@ -247,7 +247,7 @@ void GraphicsManagement::set_console(Graphics::Console& console)
{
m_console = console;
if (auto* boot_console = boot_framebuffer_console.exchange(nullptr)) {
if (auto* boot_console = g_boot_console.exchange(nullptr)) {
// Disable the initial boot framebuffer console permanently
boot_console->disable();
// TODO: Even though we swapped the pointer and disabled the console