diff options
author | Liav A <liavalb@gmail.com> | 2022-06-10 22:33:07 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-10 22:32:54 +0100 |
commit | 20c9e4c05c428f4a6ae6d955abb0429475446865 (patch) | |
tree | 9500b2afe7571dc2ba87bb0b0659b93bdec91a26 /Kernel/Graphics/Bochs | |
parent | 3d36b194d1732bc92df128559b5d577614674535 (diff) | |
download | serenity-20c9e4c05c428f4a6ae6d955abb0429475446865.zip |
Kernel/Graphics: Ensure VMWare and VirtualBox EDIDs have manufacturer ID
Diffstat (limited to 'Kernel/Graphics/Bochs')
-rw-r--r-- | Kernel/Graphics/Bochs/DisplayConnector.cpp | 7 | ||||
-rw-r--r-- | Kernel/Graphics/Bochs/DisplayConnector.h | 2 | ||||
-rw-r--r-- | Kernel/Graphics/Bochs/GraphicsAdapter.cpp | 6 |
3 files changed, 9 insertions, 6 deletions
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> BochsDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size) +NonnullRefPtr<BochsDisplayConnector> BochsDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware) { auto device_or_error = DeviceManagement::try_create_device<BochsDisplayConnector>(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<u8, 3> { '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<BochsDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size); + static NonnullRefPtr<BochsDisplayConnector> 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<void> 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<BochsDisplayMMIORegisters volatile>(PhysicalAddress(PCI::get_BAR2(pci_device_identifier.address()) & 0xfffffff0))); VERIFY(registers_mapping.region); |