VirtualBox

Changeset 81964 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Nov 18, 2019 8:42:02 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134761
Message:

Main/GraphicsAdapter: Split off a few attributes from Machine interface, which affects quite a few other interfaces.
Frontends/VirtualBox+VBoxManage+VBoxSDL+VBoxShell: Adapt accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r81882 r81964  
    27692769 * Constructor. Needs to set sane defaults which stand the test of time.
    27702770 */
     2771GraphicsAdapter::GraphicsAdapter() :
     2772    graphicsControllerType(GraphicsControllerType_VBoxVGA),
     2773    ulVRAMSizeMB(8),
     2774    cMonitors(1),
     2775    fAccelerate3D(false),
     2776    fAccelerate2DVideo(false)
     2777{
     2778}
     2779
     2780/**
     2781 * Check if all settings have default values.
     2782 */
     2783bool GraphicsAdapter::areDefaultSettings() const
     2784{
     2785    return graphicsControllerType == GraphicsControllerType_VBoxVGA
     2786        && ulVRAMSizeMB == 8
     2787        && cMonitors <= 1
     2788        && !fAccelerate3D
     2789        && !fAccelerate2DVideo;
     2790}
     2791
     2792/**
     2793 * Comparison operator. This gets called from MachineConfigFile::operator==,
     2794 * which in turn gets called from Machine::saveSettings to figure out whether
     2795 * machine settings have really changed and thus need to be written out to disk.
     2796 */
     2797bool GraphicsAdapter::operator==(const GraphicsAdapter &g) const
     2798{
     2799    return (this == &g)
     2800        || (   graphicsControllerType         == g.graphicsControllerType
     2801            && ulVRAMSizeMB                   == g.ulVRAMSizeMB
     2802            && cMonitors                      == g.cMonitors
     2803            && fAccelerate3D                  == g.fAccelerate3D
     2804            && fAccelerate2DVideo             == g.fAccelerate2DVideo);
     2805}
     2806
     2807/**
     2808 * Constructor. Needs to set sane defaults which stand the test of time.
     2809 */
    27712810USBController::USBController() :
    27722811    enmType(USBControllerType_Null)
     
    33053344    strCpuProfile("host"),
    33063345    ulMemorySizeMB((uint32_t)-1),
    3307     graphicsControllerType(GraphicsControllerType_VBoxVGA),
    3308     ulVRAMSizeMB(8),
    3309     cMonitors(1),
    3310     fAccelerate3D(false),
    3311     fAccelerate2DVideo(false),
    33123346    firmwareType(FirmwareType_BIOS),
    33133347    pointingHIDType(PointingHIDType_PS2Mouse),
     
    33753409           && (it1 != mapBootOrder.end() && it1->second == DeviceType_DVD)
    33763410           && (it2 != mapBootOrder.end() && it2->second == DeviceType_HardDisk);
    3377 }
    3378 
    3379 /**
    3380  * Check if all Display settings have default values.
    3381  */
    3382 bool Hardware::areDisplayDefaultSettings() const
    3383 {
    3384     return graphicsControllerType == GraphicsControllerType_VBoxVGA
    3385         && ulVRAMSizeMB == 8
    3386         && cMonitors <= 1
    3387         && !fAccelerate3D
    3388         && !fAccelerate2DVideo;
    33893411}
    33903412
     
    34453467            && ulMemorySizeMB                 == h.ulMemorySizeMB
    34463468            && mapBootOrder                   == h.mapBootOrder
    3447             && graphicsControllerType         == h.graphicsControllerType
    3448             && ulVRAMSizeMB                   == h.ulVRAMSizeMB
    3449             && cMonitors                      == h.cMonitors
    3450             && fAccelerate3D                  == h.fAccelerate3D
    3451             && fAccelerate2DVideo             == h.fAccelerate2DVideo
    34523469            && firmwareType                   == h.firmwareType
    34533470            && pointingHIDType                == h.pointingHIDType
     
    34593476            && vrdeSettings                   == h.vrdeSettings
    34603477            && biosSettings                   == h.biosSettings
     3478            && graphicsAdapter                == h.graphicsAdapter
    34613479            && usbSettings                    == h.usbSettings
    34623480            && llNetworkAdapters              == h.llNetworkAdapters
     
    46454663            Utf8Str strGraphicsControllerType;
    46464664            if (!pelmHwChild->getAttributeValue("controller", strGraphicsControllerType))
    4647                 hw.graphicsControllerType = GraphicsControllerType_VBoxVGA;
     4665                hw.graphicsAdapter.graphicsControllerType = GraphicsControllerType_VBoxVGA;
    46484666            else
    46494667            {
     
    46604678                else
    46614679                    throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in Display/@controller attribute"), strGraphicsControllerType.c_str());
    4662                 hw.graphicsControllerType = type;
    4663             }
    4664             pelmHwChild->getAttributeValue("VRAMSize", hw.ulVRAMSizeMB);
    4665             if (!pelmHwChild->getAttributeValue("monitorCount", hw.cMonitors))
    4666                 pelmHwChild->getAttributeValue("MonitorCount", hw.cMonitors);       // pre-v1.5 variant
    4667             if (!pelmHwChild->getAttributeValue("accelerate3D", hw.fAccelerate3D))
    4668                 pelmHwChild->getAttributeValue("Accelerate3D", hw.fAccelerate3D);   // pre-v1.5 variant
    4669             pelmHwChild->getAttributeValue("accelerate2DVideo", hw.fAccelerate2DVideo);
     4680                hw.graphicsAdapter.graphicsControllerType = type;
     4681            }
     4682            pelmHwChild->getAttributeValue("VRAMSize", hw.graphicsAdapter.ulVRAMSizeMB);
     4683            if (!pelmHwChild->getAttributeValue("monitorCount", hw.graphicsAdapter.cMonitors))
     4684                pelmHwChild->getAttributeValue("MonitorCount", hw.graphicsAdapter.cMonitors);       // pre-v1.5 variant
     4685            if (!pelmHwChild->getAttributeValue("accelerate3D", hw.graphicsAdapter.fAccelerate3D))
     4686                pelmHwChild->getAttributeValue("Accelerate3D", hw.graphicsAdapter.fAccelerate3D);   // pre-v1.5 variant
     4687            pelmHwChild->getAttributeValue("accelerate2DVideo", hw.graphicsAdapter.fAccelerate2DVideo);
    46704688        }
    46714689        else if (pelmHwChild->nameEquals("VideoCapture"))
     
    46924710            pelmHwChild->getAttributeValue("fps",       screen0Settings.Video.ulFPS);
    46934711
    4694             for (unsigned i = 0; i < hw.cMonitors; i++) /* Don't add more settings than we have monitors configured. */
     4712            for (unsigned i = 0; i < hw.graphicsAdapter.cMonitors; i++) /* Don't add more settings than we have monitors configured. */
    46954713            {
    46964714                /* Add screen i to config in any case. */
     
    60806098    }
    60816099
    6082     if (!hw.areDisplayDefaultSettings())
     6100    if (!hw.graphicsAdapter.areDefaultSettings())
    60836101    {
    60846102        xml::ElementNode *pelmDisplay = pelmHardware->createChild("Display");
    6085         if (hw.graphicsControllerType != GraphicsControllerType_VBoxVGA)
     6103        if (hw.graphicsAdapter.graphicsControllerType != GraphicsControllerType_VBoxVGA)
    60866104        {
    60876105            const char *pcszGraphics;
    6088             switch (hw.graphicsControllerType)
     6106            switch (hw.graphicsAdapter.graphicsControllerType)
    60896107            {
    60906108                case GraphicsControllerType_VBoxVGA:            pcszGraphics = "VBoxVGA"; break;
     
    60956113            pelmDisplay->setAttribute("controller", pcszGraphics);
    60966114        }
    6097         if (hw.ulVRAMSizeMB != 8)
    6098             pelmDisplay->setAttribute("VRAMSize", hw.ulVRAMSizeMB);
    6099         if (hw.cMonitors > 1)
    6100             pelmDisplay->setAttribute("monitorCount", hw.cMonitors);
    6101         if (hw.fAccelerate3D)
    6102             pelmDisplay->setAttribute("accelerate3D", hw.fAccelerate3D);
     6115        if (hw.graphicsAdapter.ulVRAMSizeMB != 8)
     6116            pelmDisplay->setAttribute("VRAMSize", hw.graphicsAdapter.ulVRAMSizeMB);
     6117        if (hw.graphicsAdapter.cMonitors > 1)
     6118            pelmDisplay->setAttribute("monitorCount", hw.graphicsAdapter.cMonitors);
     6119        if (hw.graphicsAdapter.fAccelerate3D)
     6120            pelmDisplay->setAttribute("accelerate3D", hw.graphicsAdapter.fAccelerate3D);
    61036121
    61046122        if (m->sv >= SettingsVersion_v1_8)
    61056123        {
    6106             if (hw.fAccelerate2DVideo)
    6107                 pelmDisplay->setAttribute("accelerate2DVideo", hw.fAccelerate2DVideo);
     6124            if (hw.graphicsAdapter.fAccelerate2DVideo)
     6125                pelmDisplay->setAttribute("accelerate2DVideo", hw.graphicsAdapter.fAccelerate2DVideo);
    61086126        }
    61096127    }
     
    77867804        // setting, explicit long mode setting, (video) capturing and NAT networking.
    77877805        if (   !hardwareMachine.strDefaultFrontend.isEmpty()
    7788             || hardwareMachine.graphicsControllerType != GraphicsControllerType_VBoxVGA
     7806            || hardwareMachine.graphicsAdapter.graphicsControllerType != GraphicsControllerType_VBoxVGA
    77897807            || hardwareMachine.enmLongMode != Hardware::LongMode_Legacy
    77907808            || machineUserData.ovIcon.size() > 0
     
    81718189    // "accelerate 2d video" requires settings version 1.8
    81728190    if (    (m->sv < SettingsVersion_v1_8)
    8173          && (hardwareMachine.fAccelerate2DVideo)
     8191         && (hardwareMachine.graphicsAdapter.fAccelerate2DVideo)
    81748192       )
    81758193        m->sv = SettingsVersion_v1_8;
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