mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
3699c2e8ac
Plain old VGA text mode functionality was introduced in 1987, and is obviously still used on some (even modern) x86 machines. However, it's very limited in what it gives to us, because by using a 80x25 text mode console, it's guaranteed that no desktop functionality is available during such OS runtime session. It's also quite complicated to handle access arbitration on the VGA ISA ports which means that only one VGA card can work in VGA mode, which makes it very cumbersome to manage multiple cards at once. Since we never relied on the VGA text mode console for anything serious, as booting on a QEMU machine always gives a proper framebuffer to work with, VGA text mode console was used in bare metal sessions due to lack of drivers. However, since we "force" multiboot-compatible bootloaders to provide us a framebuffer, it's basically a non-issue to have a functional console on bare metal machines even if we don't have the required drivers.
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) 2021-2022, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/Platform.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/Bus/PCI/Definitions.h>
|
|
#include <Kernel/Devices/GPU/Console/Console.h>
|
|
#include <Kernel/Devices/GPU/DisplayConnector.h>
|
|
#include <Kernel/Devices/GPU/GPUDevice.h>
|
|
#include <Kernel/Devices/GPU/Generic/DisplayConnector.h>
|
|
#include <Kernel/Devices/GPU/VirtIO/GraphicsAdapter.h>
|
|
#include <Kernel/Library/NonnullLockRefPtr.h>
|
|
#include <Kernel/Memory/Region.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class GraphicsManagement {
|
|
|
|
public:
|
|
static GraphicsManagement& the();
|
|
static bool is_initialized();
|
|
bool initialize();
|
|
|
|
unsigned allocate_minor_device_number() { return m_current_minor_number++; }
|
|
GraphicsManagement();
|
|
|
|
void attach_new_display_connector(Badge<DisplayConnector>, DisplayConnector&);
|
|
void detach_display_connector(Badge<DisplayConnector>, DisplayConnector&);
|
|
|
|
LockRefPtr<Graphics::Console> console() const { return m_console; }
|
|
void set_console(Graphics::Console&);
|
|
|
|
void deactivate_graphical_mode();
|
|
void activate_graphical_mode();
|
|
|
|
private:
|
|
void enable_vga_text_mode_console_cursor();
|
|
|
|
ErrorOr<void> determine_and_initialize_graphics_device(PCI::DeviceIdentifier const&);
|
|
|
|
void initialize_preset_resolution_generic_display_connector();
|
|
|
|
Vector<NonnullLockRefPtr<GPUDevice>> m_graphics_devices;
|
|
LockRefPtr<Graphics::Console> m_console;
|
|
|
|
// Note: This is only used when booting with kernel commandline that includes "graphics_subsystem_mode=limited"
|
|
LockRefPtr<GenericDisplayConnector> m_preset_resolution_generic_display_connector;
|
|
|
|
LockRefPtr<DisplayConnector> m_platform_board_specific_display_connector;
|
|
|
|
unsigned m_current_minor_number { 0 };
|
|
|
|
SpinlockProtected<IntrusiveList<&DisplayConnector::m_list_node>, LockRank::None> m_display_connector_nodes {};
|
|
};
|
|
|
|
}
|