/* * Copyright (c) 2021-2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #if ARCH(I386) || ARCH(X86_64) # include #endif #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&); void set_vga_text_mode_cursor(size_t console_width, size_t x, size_t y); void disable_vga_text_mode_console_cursor(); void disable_vga_emulation_access_permanently(); 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(); bool determine_and_initialize_graphics_device(PCI::DeviceIdentifier const&); void initialize_preset_resolution_generic_display_connector(); NonnullLockRefPtrVector 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> m_display_connector_nodes { LockRank::None }; #if ARCH(I386) || ARCH(X86_64) OwnPtr m_vga_arbiter; #endif }; }