From 20c9e4c05c428f4a6ae6d955abb0429475446865 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 10 Jun 2022 22:33:07 +0300 Subject: Kernel/Graphics: Ensure VMWare and VirtualBox EDIDs have manufacturer ID --- Kernel/Graphics/Bochs/DisplayConnector.cpp | 7 +++++-- Kernel/Graphics/Bochs/DisplayConnector.h | 2 +- Kernel/Graphics/Bochs/GraphicsAdapter.cpp | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Kernel/Graphics/Bochs') diff --git a/Kernel/Graphics/Bochs/DisplayConnector.cpp b/Kernel/Graphics/Bochs/DisplayConnector.cpp index 5e9c74711c..b51bb2b329 100644 --- a/Kernel/Graphics/Bochs/DisplayConnector.cpp +++ b/Kernel/Graphics/Bochs/DisplayConnector.cpp @@ -14,13 +14,16 @@ namespace Kernel { -NonnullRefPtr BochsDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size) +NonnullRefPtr BochsDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware) { auto device_or_error = DeviceManagement::try_create_device(framebuffer_address, framebuffer_resource_size); VERIFY(!device_or_error.is_error()); auto connector = device_or_error.release_value(); MUST(connector->create_attached_framebuffer_console()); - MUST(connector->initialize_edid_for_generic_monitor()); + if (virtual_box_hardware) + MUST(connector->initialize_edid_for_generic_monitor(Array { 'V', 'B', 'X' })); + else + MUST(connector->initialize_edid_for_generic_monitor({})); return connector; } diff --git a/Kernel/Graphics/Bochs/DisplayConnector.h b/Kernel/Graphics/Bochs/DisplayConnector.h index 445e5dcc7c..a8d4277e0d 100644 --- a/Kernel/Graphics/Bochs/DisplayConnector.h +++ b/Kernel/Graphics/Bochs/DisplayConnector.h @@ -24,7 +24,7 @@ class BochsDisplayConnector public: TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID); - static NonnullRefPtr must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size); + static NonnullRefPtr must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware); virtual IndexID index_id() const; diff --git a/Kernel/Graphics/Bochs/GraphicsAdapter.cpp b/Kernel/Graphics/Bochs/GraphicsAdapter.cpp index 82e63686ee..8ba489a918 100644 --- a/Kernel/Graphics/Bochs/GraphicsAdapter.cpp +++ b/Kernel/Graphics/Bochs/GraphicsAdapter.cpp @@ -43,10 +43,10 @@ UNMAP_AFTER_INIT ErrorOr BochsGraphicsAdapter::initialize_adapter(PCI::Dev // Note: If we use VirtualBox graphics adapter (which is based on Bochs one), we need to use IO ports // Note: Bochs (the real bochs graphics adapter in the Bochs emulator) uses revision ID of 0x0 // and doesn't support memory-mapped IO registers. + bool virtual_box_hardware = (pci_device_identifier.hardware_id().vendor_id == 0x80ee && pci_device_identifier.hardware_id().device_id == 0xbeef); auto bar0_space_size = PCI::get_BAR_space_size(pci_device_identifier.address(), 0); - if (pci_device_identifier.revision_id().value() == 0x0 - || (pci_device_identifier.hardware_id().vendor_id == 0x80ee && pci_device_identifier.hardware_id().device_id == 0xbeef)) { - m_display_connector = BochsDisplayConnector::must_create(PhysicalAddress(PCI::get_BAR0(pci_device_identifier.address()) & 0xfffffff0), bar0_space_size); + if (pci_device_identifier.revision_id().value() == 0x0 || virtual_box_hardware) { + m_display_connector = BochsDisplayConnector::must_create(PhysicalAddress(PCI::get_BAR0(pci_device_identifier.address()) & 0xfffffff0), bar0_space_size, virtual_box_hardware); } else { auto registers_mapping = TRY(Memory::map_typed_writable(PhysicalAddress(PCI::get_BAR2(pci_device_identifier.address()) & 0xfffffff0))); VERIFY(registers_mapping.region); -- cgit v1.2.3