diff options
Diffstat (limited to 'Kernel/Graphics')
-rw-r--r-- | Kernel/Graphics/Bochs/Definitions.h | 2 | ||||
-rw-r--r-- | Kernel/Graphics/GraphicsManagement.cpp | 22 | ||||
-rw-r--r-- | Kernel/Graphics/GraphicsManagement.h | 2 |
3 files changed, 26 insertions, 0 deletions
diff --git a/Kernel/Graphics/Bochs/Definitions.h b/Kernel/Graphics/Bochs/Definitions.h index 12ba53650a..1891b9f756 100644 --- a/Kernel/Graphics/Bochs/Definitions.h +++ b/Kernel/Graphics/Bochs/Definitions.h @@ -34,6 +34,7 @@ enum class BochsDISPIRegisters { VIRT_HEIGHT = 0x7, X_OFFSET = 0x8, Y_OFFSET = 0x9, + VIDEO_RAM_64K_CHUNKS_COUNT = 0xA, }; struct [[gnu::packed]] DISPIInterface { @@ -47,6 +48,7 @@ struct [[gnu::packed]] DISPIInterface { u16 virt_height; u16 x_offset; u16 y_offset; + u16 vram_64k_chunks_count; }; struct [[gnu::packed]] ExtensionRegisters { diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp index ef1f9ac195..6659b02b6f 100644 --- a/Kernel/Graphics/GraphicsManagement.cpp +++ b/Kernel/Graphics/GraphicsManagement.cpp @@ -7,6 +7,9 @@ #include <AK/Singleton.h> #include <Kernel/Arch/Delay.h> #include <Kernel/Arch/x86/IO.h> +#if ARCH(I386) || ARCH(X86_64) +# include <Kernel/Arch/x86/Hypervisor/BochsDisplayConnector.h> +#endif #include <Kernel/Bus/PCI/API.h> #include <Kernel/Bus/PCI/IDs.h> #include <Kernel/CommandLine.h> @@ -206,6 +209,25 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize() return true; } + // Note: Don't try to initialize an ISA Bochs VGA adapter if PCI hardware is + // present but the user decided to disable its usage nevertheless. + // Otherwise we risk using the Bochs VBE driver on a wrong physical address + // for the framebuffer. + if (PCI::Access::is_hardware_disabled() && !(graphics_subsystem_mode == CommandLine::GraphicsSubsystemMode::Limited && !multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB)) { +#if ARCH(I386) || ARCH(X86_64) + auto vga_isa_bochs_display_connector = BochsDisplayConnector::try_create_for_vga_isa_connector(); + if (vga_isa_bochs_display_connector) { + dmesgln("Graphics: Using a Bochs ISA VGA compatible adapter"); + MUST(vga_isa_bochs_display_connector->set_safe_mode_setting()); + m_platform_board_specific_display_connector = vga_isa_bochs_display_connector; + dmesgln("Graphics: Invoking manual blanking with VGA ISA ports"); + SpinlockLocker locker(m_main_vga_lock); + IO::out8(0x3c0, 0x20); + return true; + } +#endif + } + if (graphics_subsystem_mode == CommandLine::GraphicsSubsystemMode::Limited && !multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB) { initialize_preset_resolution_generic_display_connector(); return true; diff --git a/Kernel/Graphics/GraphicsManagement.h b/Kernel/Graphics/GraphicsManagement.h index 28ffd32737..842c837d75 100644 --- a/Kernel/Graphics/GraphicsManagement.h +++ b/Kernel/Graphics/GraphicsManagement.h @@ -56,6 +56,8 @@ private: // 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>> m_display_connector_nodes { LockRank::None }; |