Browse Source

Kernel/Graphics: Unblank the screen when initializing bochs display

Liav A 4 years ago
parent
commit
00e4cc23cb
2 changed files with 14 additions and 0 deletions
  1. 13 0
      Kernel/Graphics/BochsGraphicsAdapter.cpp
  2. 1 0
      Kernel/Graphics/BochsGraphicsAdapter.h

+ 13 - 0
Kernel/Graphics/BochsGraphicsAdapter.cpp

@@ -65,6 +65,11 @@ UNMAP_AFTER_INIT BochsGraphicsAdapter::BochsGraphicsAdapter(PCI::Address pci_add
     auto id = PCI::get_id(pci_address);
     if (id.vendor_id == 0x80ee && id.device_id == 0xbeef)
         m_io_required = true;
+
+    // FIXME: Although this helps with setting the screen to work on some cases,
+    // we need to check we actually can access the VGA MMIO remapped ioports before
+    // doing the unblanking.
+    unblank();
     set_safe_resolution();
 }
 
@@ -82,6 +87,14 @@ GraphicsDevice::Type BochsGraphicsAdapter::type() const
     return Type::Bochs;
 }
 
+void BochsGraphicsAdapter::unblank()
+{
+    auto registers = map_typed_writable<volatile BochsDisplayMMIORegisters>(m_mmio_registers);
+    full_memory_barrier();
+    registers->vga_ioports[0] = 0x20;
+    full_memory_barrier();
+}
+
 void BochsGraphicsAdapter::set_safe_resolution()
 {
     VERIFY(m_framebuffer_console);

+ 1 - 0
Kernel/Graphics/BochsGraphicsAdapter.h

@@ -46,6 +46,7 @@ private:
     explicit BochsGraphicsAdapter(PCI::Address);
 
     void set_safe_resolution();
+    void unblank();
 
     bool validate_setup_resolution(size_t width, size_t height);
     u32 find_framebuffer_address();