/* * Copyright (c) 2021-2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include #include #include 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&); void detach_display_connector(Badge, DisplayConnector&); LockRefPtr 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 determine_and_initialize_graphics_device(PCI::DeviceIdentifier const&); void initialize_preset_resolution_generic_display_connector(); Vector> m_graphics_devices; LockRefPtr m_console; // Note: This is only used when booting with kernel commandline that includes "graphics_subsystem_mode=limited" LockRefPtr m_preset_resolution_generic_display_connector; LockRefPtr m_platform_board_specific_display_connector; unsigned m_current_minor_number { 0 }; SpinlockProtected, LockRank::None> m_display_connector_nodes {}; }; }