VirtualBox

Changeset 71146 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Feb 28, 2018 9:54:40 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121039
Message:

DevVGA, Additions: added VBE_DISPI_ID_CFG for querying the virtual graphics card features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r69309 r71146  
    5959
    6060/**
     61 * Query whether the virtual hardware supports VBE_DISPI_ID_CFG
     62 * and set the interface.
     63 *
     64 * @returns Whether the interface is supported.
     65 */
     66DECLHIDDEN(bool) VBoxVGACfgAvailable(void)
     67{
     68    VBVO_PORT_WRITE_U16(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
     69    VBVO_PORT_WRITE_U16(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_CFG);
     70    const uint16_t DispiId = VBVO_PORT_READ_U16(VBE_DISPI_IOPORT_DATA);
     71    return (DispiId == VBE_DISPI_ID_CFG);
     72}
     73
     74
     75/**
     76 * Query a configuration value from the virtual hardware which supports VBE_DISPI_ID_CFG.
     77 * I.e. use this function only if VBoxVGACfgAvailable returns true.
     78 *
     79 * @returns Whether the value is supported.
     80 * @param  u16Id     Identifier of the configuration value (VBE_DISPI_CFG_ID_*).
     81 * @param  pu32Value Where to store value from the host.
     82 */
     83DECLHIDDEN(bool) VBoxVGACfgQuery(uint16_t u16Id, uint32_t *pu32Value)
     84{
     85    VBVO_PORT_WRITE_U16(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_CFG);
     86    VBVO_PORT_WRITE_U16(VBE_DISPI_IOPORT_DATA, VBE_DISPI_CFG_MASK_SUPPORT | u16Id);
     87    const uint32_t u32 = VBVO_PORT_READ_U32(VBE_DISPI_IOPORT_DATA);
     88    if (u32)
     89    {
     90        VBVO_PORT_WRITE_U16(VBE_DISPI_IOPORT_DATA, u16Id);
     91        *pu32Value = VBVO_PORT_READ_U32(VBE_DISPI_IOPORT_DATA);
     92        return true;
     93    }
     94
     95    return false;
     96}
     97
     98
     99/**
    61100 * Returns the size of the video RAM in bytes.
    62101 *
     
    65104DECLHIDDEN(uint32_t) VBoxVideoGetVRAMSize(void)
    66105{
    67     /** @note A 32bit read on this port returns the VRAM size. */
     106    /** @note A 32bit read on this port returns the VRAM size if interface is older than VBE_DISPI_ID_CFG. */
    68107    return VBVO_PORT_READ_U32(VBE_DISPI_IOPORT_DATA);
    69108}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette