ladybird/Kernel/Graphics/Console/VGAConsole.h
Liav A 20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00

39 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/Types.h>
#include <Kernel/Graphics/Console/Console.h>
#include <Kernel/Graphics/VGACompatibleAdapter.h>
namespace Kernel::Graphics {
class VGAConsole : public Console {
public:
// Note: these are the modes we will support and only these
enum class Mode {
TextMode = 1, // Text Mode
Colored256, // 320x200 256 color mode
Colored16, // 640x480 16 color mode
};
public:
static NonnullRefPtr<VGAConsole> initialize(const VGACompatibleAdapter&, Mode, size_t width, size_t height);
virtual bool is_hardware_paged_capable() const override { return false; }
virtual bool has_hardware_cursor() const override { return false; }
virtual ~VGAConsole() = default;
protected:
VGAConsole(const VGACompatibleAdapter&, Mode, size_t width, size_t height);
NonnullOwnPtr<Region> m_vga_region;
NonnullRefPtr<VGACompatibleAdapter> m_adapter;
const Mode m_mode;
};
}