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

Kernel: Simplify graphics initialization somewhat

We use a switch-case statements to ensure we try to find the best
suitable driver for a specific graphics card. In case we don't find
such, we use the default statement to initialize the graphics card as a
generic VGA adapter, if the adapter is VGA compatible.

If we couldn't initialize the driver, we don't touch this adapter
anymore.

Also, GraphicsDevice should not be tied to a PCI::Address member, as it
can be theortically be used with other buses (e.g. ISA cards).
This commit is contained in:
Liav A 2021-07-03 05:04:02 +03:00 committed by Gunnar Beutner
parent 27fe2b45e5
commit 053a832fac
7 changed files with 94 additions and 84 deletions

View file

@ -37,8 +37,7 @@ UNMAP_AFTER_INIT void VGACompatibleAdapter::initialize_framebuffer_devices()
}
UNMAP_AFTER_INIT VGACompatibleAdapter::VGACompatibleAdapter(PCI::Address address)
: GraphicsDevice(address)
, PCI::DeviceController(address)
: PCI::DeviceController(address)
{
m_framebuffer_console = Graphics::TextModeConsole::initialize(*this);
// FIXME: This is a very wrong way to do this...
@ -46,8 +45,7 @@ UNMAP_AFTER_INIT VGACompatibleAdapter::VGACompatibleAdapter(PCI::Address address
}
UNMAP_AFTER_INIT VGACompatibleAdapter::VGACompatibleAdapter(PCI::Address address, PhysicalAddress framebuffer_address, size_t framebuffer_width, size_t framebuffer_height, size_t framebuffer_pitch)
: GraphicsDevice(address)
, PCI::DeviceController(address)
: PCI::DeviceController(address)
, m_framebuffer_address(framebuffer_address)
, m_framebuffer_width(framebuffer_width)
, m_framebuffer_height(framebuffer_height)