User:Kazinsal/VirtualBox Video Adapter

From OSDev Wiki
Jump to navigation Jump to search

This page is under construction!

This page is a work in progress and may thus be incomplete. Its content may be changed in the near future.

This page has notes attached to it: User:Kazinsal/VirtualBox Video Adapter/Notes

VirtualBox emulates a generic VESA compatible video device (internally referred to as VBoxVideo) for video output, with a large superset of features built upon the Bochs Graphics Adapter and its VESA BIOS Extensions. For simple functionality, such as setting a video mode, the same sequence of commands can be used for VirtualBox's video adapter as is used for Bochs. VirtualBox supports up to and including 0xB0C4 level BGA VBE features for backwards compatibility with generic BGA drivers.

Overview

As an extension of the Bochs Graphics Adapter, VBoxVideo uses a pair of I/O ports -- an index and a data port -- for most of its configuration and programming. These ports are at the same I/O addresses as in Bochs, VBE_DISPI_IOPORT_INDEX and VBE_DISPI_IOPORT_DATA, and serve the same purposes. In some cases, VBoxVideo extends the length of the registers to 32 bits; this is most notably used in the configuration of certain host-guest interactions.

The device supports irregular size displays, allowing you to set whatever resolution you want, up to 16384x16384x32, limited only by the amount of VRAM allocated to the virtual machine.

VBoxVideo is also a PCI device, with vendor 0x80EE (used for all VirtualBox PCI devices) and device 0xBEEF (sometimes 0x7145 in really old versions of VirtualBox).

New #defines

There are three new levels of BGA versions reported by VirtualBox when reading VBE_DISPI_INDEX_ID:

  • VBE_DISPI_ID_VBOX_VIDEO (0xBE00): Indicates that the graphics device supports VirtualBox Video Acceleration (VBVA).
  • VBE_DISPI_ID_HGSMI (0xBE01): Indicates that the graphics device supports the VirtualBox Host-Guest Shared Memory Interface.
  • VBE_DISPI_ID_ANYX (0xBE02): Indicates that the graphics device supports any display width.

There are two new DISPI registers:

  • VBE_DISPI_INDEX_VBOX_VIDEO (0x0A): Used to read configuration information from and write commands to the host (sometimes).
  • VBE_DISPI_INDEX_FB_BASE_HI (0x0B): Contains the high 16 bits of the linear framebuffer address (low 16 bits are zero).

References