VirtualBox

Changeset 80042 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 29, 2019 11:40:41 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132478
Message:

FE/Qt: bugref:7720: VM settings / Display page: Lots of cleanup related to 2D Video and 3D acceleration, also to graphics controller type.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r79365 r80042  
    4545        : m_iCurrentVRAM(0)
    4646        , m_cGuestScreenCount(0)
     47        , m_graphicsControllerType(KGraphicsControllerType_Null)
     48#ifdef VBOX_WITH_CRHGSMI
    4749        , m_f3dAccelerationEnabled(false)
     50#endif
    4851#ifdef VBOX_WITH_VIDEOHWACCEL
    49         , m_f2dAccelerationEnabled(false)
    50 #endif /* VBOX_WITH_VIDEOHWACCEL */
    51         , m_graphicsControllerType(KGraphicsControllerType_Null)
     52        , m_f2dVideoAccelerationEnabled(false)
     53#endif
    5254        , m_fRemoteDisplayServerSupported(false)
    5355        , m_fRemoteDisplayServerEnabled(false)
     
    7375               && (m_cGuestScreenCount == other.m_cGuestScreenCount)
    7476               && (m_scaleFactors == other.m_scaleFactors)
     77               && (m_graphicsControllerType == other.m_graphicsControllerType)
     78#ifdef VBOX_WITH_CRHGSMI
    7579               && (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled)
     80#endif
    7681#ifdef VBOX_WITH_VIDEOHWACCEL
    77                && (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled)
    78 #endif /* VBOX_WITH_VIDEOHWACCEL */
    79                && (m_graphicsControllerType == other.m_graphicsControllerType)
     82               && (m_f2dVideoAccelerationEnabled == other.m_f2dVideoAccelerationEnabled)
     83#endif
    8084               && (m_fRemoteDisplayServerSupported == other.m_fRemoteDisplayServerSupported)
    8185               && (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled)
     
    237241    /** Holds the guest screen scale-factor. */
    238242    QList<double>            m_scaleFactors;
     243    /** Holds the graphics controller type. */
     244    KGraphicsControllerType  m_graphicsControllerType;
     245#ifdef VBOX_WITH_CRHGSMI
    239246    /** Holds whether the 3D acceleration is enabled. */
    240247    bool                     m_f3dAccelerationEnabled;
     248#endif
    241249#ifdef VBOX_WITH_VIDEOHWACCEL
    242250    /** Holds whether the 2D video acceleration is enabled. */
    243     bool                     m_f2dAccelerationEnabled;
    244 #endif /* VBOX_WITH_VIDEOHWACCEL */
    245     /** Holds the graphics controller type. */
    246     KGraphicsControllerType  m_graphicsControllerType;
     251    bool                     m_f2dVideoAccelerationEnabled;
     252#endif
    247253    /** Holds whether the remote display server is supported. */
    248254    bool                     m_fRemoteDisplayServerSupported;
     
    280286
    281287UIMachineSettingsDisplay::UIMachineSettingsDisplay()
    282     : m_iMinVRAM(0)
     288    : m_comGuestOSType(CGuestOSType())
     289    , m_iMinVRAM(0)
    283290    , m_iMaxVRAM(0)
    284291    , m_iMaxVRAMVisible(0)
    285292    , m_iInitialVRAM(0)
     293#ifdef VBOX_WITH_CRHGSMI
     294    , m_fWddmModeSupported(false)
     295#endif
    286296#ifdef VBOX_WITH_VIDEOHWACCEL
    287297    , m_f2DVideoAccelerationSupported(false)
    288 #endif /* VBOX_WITH_VIDEOHWACCEL */
    289 #ifdef VBOX_WITH_CRHGSMI
    290     , m_fWddmModeSupported(false)
    291 #endif /* VBOX_WITH_CRHGSMI */
     298#endif
    292299    , m_pCache(0)
    293300{
     
    304311void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType comGuestOSType)
    305312{
    306     /* Check if guest os type changed: */
     313    /* Check if guest OS type changed: */
    307314    if (m_comGuestOSType == comGuestOSType)
    308315        return;
    309316
    310     /* Remember new guest os type: */
     317    /* Remember new guest OS type: */
    311318    m_comGuestOSType = comGuestOSType;
    312319
     320#ifdef VBOX_WITH_CRHGSMI
     321    /* Check if WDDM mode supported by the guest OS type: */
     322    const QString strGuestOSTypeId = m_comGuestOSType.isNotNull() ? m_comGuestOSType.GetId() : QString();
     323    m_fWddmModeSupported = UICommon::isWddmCompatibleOsType(strGuestOSTypeId);
     324#endif
    313325#ifdef VBOX_WITH_VIDEOHWACCEL
    314326    /* Check if 2D video acceleration supported by the guest OS type: */
     
    316328    m_f2DVideoAccelerationSupported = strGuestOSTypeFamily == "Windows";
    317329#endif
    318 #ifdef VBOX_WITH_CRHGSMI
    319     /* Check if WDDM mode supported by the guest OS type: */
    320     const QString strGuestOSTypeId = m_comGuestOSType.isNotNull() ? m_comGuestOSType.GetId() : QString();
    321     m_fWddmModeSupported = UICommon::isWddmCompatibleOsType(strGuestOSTypeId);
    322 #endif
    323330
    324331    /* Recheck video RAM requirement: */
     
    356363    oldDisplayData.m_cGuestScreenCount = m_machine.GetMonitorCount();
    357364    oldDisplayData.m_scaleFactors = gEDataManager->scaleFactors(m_machine.GetId());
     365    oldDisplayData.m_graphicsControllerType = m_machine.GetGraphicsControllerType();
     366#ifdef VBOX_WITH_CRHGSMI
    358367    oldDisplayData.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled();
     368#endif
    359369#ifdef VBOX_WITH_VIDEOHWACCEL
    360     oldDisplayData.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled();
    361 #endif
    362     oldDisplayData.m_graphicsControllerType = m_machine.GetGraphicsControllerType();
     370    oldDisplayData.m_f2dVideoAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled();
     371#endif
    363372    /* Check whether remote display server is valid: */
    364373    const CVRDEServer &vrdeServer = m_machine.GetVRDEServer();
     
    420429    m_pScaleFactorEditor->setScaleFactors(oldDisplayData.m_scaleFactors);
    421430    m_pScaleFactorEditor->setMonitorCount(oldDisplayData.m_cGuestScreenCount);
     431    m_pComboGraphicsControllerType->setCurrentIndex(m_pComboGraphicsControllerType->findText(gpConverter->toString(oldDisplayData.m_graphicsControllerType)));
     432#ifdef VBOX_WITH_CRHGSMI
    422433    m_pCheckbox3D->setChecked(oldDisplayData.m_f3dAccelerationEnabled);
     434#endif
    423435#ifdef VBOX_WITH_VIDEOHWACCEL
    424     m_pCheckbox2DVideo->setChecked(oldDisplayData.m_f2dAccelerationEnabled);
    425 #endif
    426     m_pComboGraphicsControllerType->setCurrentIndex(m_pComboGraphicsControllerType->findText(gpConverter->toString(oldDisplayData.m_graphicsControllerType)));
    427     // Should be the last one for this tab:
     436    m_pCheckbox2DVideo->setChecked(oldDisplayData.m_f2dVideoAccelerationEnabled);
     437#endif
     438    // Should be the last one for this tab, since it depends on some of others:
    428439    m_pEditorVideoMemorySize->setValue(oldDisplayData.m_iCurrentVRAM);
    429440
     
    479490    newDisplayData.m_cGuestScreenCount = m_pEditorVideoScreenCount->value();
    480491    newDisplayData.m_scaleFactors = m_pScaleFactorEditor->scaleFactors();
     492    newDisplayData.m_graphicsControllerType = gpConverter->fromString<KGraphicsControllerType>(m_pComboGraphicsControllerType->currentText());
     493#ifdef VBOX_WITH_CRHGSMI
    481494    newDisplayData.m_f3dAccelerationEnabled = m_pCheckbox3D->isChecked();
     495#endif
    482496#ifdef VBOX_WITH_VIDEOHWACCEL
    483     newDisplayData.m_f2dAccelerationEnabled = m_pCheckbox2DVideo->isChecked();
    484 #endif
    485     newDisplayData.m_graphicsControllerType = gpConverter->fromString<KGraphicsControllerType>(m_pComboGraphicsControllerType->currentText());
     497    newDisplayData.m_f2dVideoAccelerationEnabled = m_pCheckbox2DVideo->isChecked();
     498#endif
    486499    /* If remote display server is supported: */
    487500    newDisplayData.m_fRemoteDisplayServerSupported = m_pCache->base().m_fRemoteDisplayServerSupported;
     
    565578        message.first = UICommon::removeAccelMark(m_pTabWidget->tabText(0));
    566579
    567         /* 3D acceleration test: */
    568         if (m_pCheckbox3D->isChecked() && !uiCommon().is3DAvailable())
    569         {
    570             message.second << tr("The virtual machine is set up to use hardware graphics acceleration. "
    571                                  "However the host system does not currently provide this, "
    572                                  "so you will not be able to start the machine.");
    573         }
    574 
    575580        /* Video RAM amount test: */
    576581        if (shouldWeWarnAboutLowVRAM() && !m_comGuestOSType.isNull())
     
    585590                                     .arg(uiCommon().formatSize(uNeedBytes, 0, FormatSize_RoundUp));
    586591            }
    587 #ifdef VBOX_WITH_VIDEOHWACCEL
    588             /* 2D acceleration video RAM amount test: */
    589             else if (m_pCheckbox2DVideo->isChecked() && m_f2DVideoAccelerationSupported)
    590             {
    591                 uNeedBytes += VBox2DHelpers::required2DOffscreenVideoMemory();
    592                 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes)
    593                 {
    594                     message.second << tr("The virtual machine is currently assigned less than <b>%1</b> of video memory "
    595                                          "which is the minimum amount required for High Definition Video to be played efficiently.")
    596                                          .arg(uiCommon().formatSize(uNeedBytes, 0, FormatSize_RoundUp));
    597                 }
    598             }
    599 #endif /* VBOX_WITH_VIDEOHWACCEL */
    600592#ifdef VBOX_WITH_CRHGSMI
    601593            /* 3D acceleration video RAM amount test: */
     
    612604            }
    613605#endif /* VBOX_WITH_CRHGSMI */
    614         }
     606#ifdef VBOX_WITH_VIDEOHWACCEL
     607            /* 2D acceleration video RAM amount test: */
     608            else if (m_pCheckbox2DVideo->isChecked() && m_f2DVideoAccelerationSupported)
     609            {
     610                uNeedBytes += VBox2DHelpers::required2DOffscreenVideoMemory();
     611                if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes)
     612                {
     613                    message.second << tr("The virtual machine is currently assigned less than <b>%1</b> of video memory "
     614                                         "which is the minimum amount required for High Definition Video to be played efficiently.")
     615                                         .arg(uiCommon().formatSize(uNeedBytes, 0, FormatSize_RoundUp));
     616                }
     617            }
     618#endif /* VBOX_WITH_VIDEOHWACCEL */
     619        }
     620
     621#ifdef VBOX_WITH_CRHGSMI
     622        /* 3D acceleration test: */
     623        if (m_pCheckbox3D->isChecked() && !uiCommon().is3DAvailable())
     624        {
     625            message.second << tr("The virtual machine is set up to use hardware graphics acceleration. "
     626                                 "However the host system does not currently provide this, "
     627                                 "so you will not be able to start the machine.");
     628        }
     629#endif /* VBOX_WITH_CRHGSMI */
    615630
    616631#ifdef VBOX_WITH_VIDEOHWACCEL
     
    678693    setTabOrder(m_pEditorVideoMemorySize, m_pSliderVideoScreenCount);
    679694    setTabOrder(m_pSliderVideoScreenCount, m_pEditorVideoScreenCount);
    680 #ifdef VBOX_WITH_VIDEOHWACCEL
    681     setTabOrder(m_pCheckbox3D, m_pCheckbox2DVideo);
    682     setTabOrder(m_pCheckbox2DVideo, m_pComboGraphicsControllerType);
    683 #else /* VBOX_WITH_VIDEOHWACCEL */
    684     setTabOrder(m_pCheckbox3D, m_pComboGraphicsControllerType);
    685 #endif /* !VBOX_WITH_VIDEOHWACCEL */
    686     setTabOrder(m_pComboGraphicsControllerType, m_pCheckboxRemoteDisplay);
     695    setTabOrder(m_pEditorVideoScreenCount, m_pScaleFactorEditor);
     696    setTabOrder(m_pScaleFactorEditor, m_pComboGraphicsControllerType);
    687697
    688698    /* Remote Display tab-order: */
     
    764774    m_pScaleFactorEditor->setEnabled(isMachineInValidMode());
    765775    m_pLabelVideoOptions->setEnabled(isMachineOffline());
     776#ifdef VBOX_WITH_CRHGSMI
    766777    m_pCheckbox3D->setEnabled(isMachineOffline());
     778#else
     779    m_pCheckbox3D->hide();
     780#endif
    767781#ifdef VBOX_WITH_VIDEOHWACCEL
    768782    m_pCheckbox2DVideo->setEnabled(isMachineOffline() && VBox2DHelpers::isAcceleration2DVideoAvailable());
    769 #else /* !VBOX_WITH_VIDEOHWACCEL */
     783#else
    770784    m_pCheckbox2DVideo->hide();
    771 #endif /* !VBOX_WITH_VIDEOHWACCEL */
     785#endif
    772786    m_pComboGraphicsControllerType->setEnabled(isMachineOffline());
    773787
     
    12081222    connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountSliderChange()));
    12091223    connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountEditorChange()));
    1210 
    1211     connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     1224#ifdef VBOX_WITH_CRHGSMI
     1225    connect(m_pCheckbox3D, &QCheckBox::stateChanged,
     1226            this, &UIMachineSettingsDisplay::revalidate);
     1227#endif
    12121228#ifdef VBOX_WITH_VIDEOHWACCEL
    1213     connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     1229    connect(m_pCheckbox2DVideo, &QCheckBox::stateChanged,
     1230            this, &UIMachineSettingsDisplay::revalidate);
    12141231#endif
    12151232
     
    14201437            fSuccess = m_machine.isOk();
    14211438        }
     1439        /* Save the Graphics Controller Type: */
     1440        if (fSuccess && isMachineOffline() && newDisplayData.m_graphicsControllerType != oldDisplayData.m_graphicsControllerType)
     1441        {
     1442            m_machine.SetGraphicsControllerType(newDisplayData.m_graphicsControllerType);
     1443            fSuccess = m_machine.isOk();
     1444        }
     1445#ifdef VBOX_WITH_CRHGSMI
    14221446        /* Save whether 3D acceleration is enabled: */
    14231447        if (fSuccess && isMachineOffline() && newDisplayData.m_f3dAccelerationEnabled != oldDisplayData.m_f3dAccelerationEnabled)
     
    14261450            fSuccess = m_machine.isOk();
    14271451        }
     1452#endif
    14281453#ifdef VBOX_WITH_VIDEOHWACCEL
    14291454        /* Save whether 2D video acceleration is enabled: */
    1430         if (fSuccess && isMachineOffline() && newDisplayData.m_f2dAccelerationEnabled != oldDisplayData.m_f2dAccelerationEnabled)
    1431         {
    1432             m_machine.SetAccelerate2DVideoEnabled(newDisplayData.m_f2dAccelerationEnabled);
     1455        if (fSuccess && isMachineOffline() && newDisplayData.m_f2dVideoAccelerationEnabled != oldDisplayData.m_f2dVideoAccelerationEnabled)
     1456        {
     1457            m_machine.SetAccelerate2DVideoEnabled(newDisplayData.m_f2dVideoAccelerationEnabled);
    14331458            fSuccess = m_machine.isOk();
    14341459        }
    14351460#endif
    1436         /* Save the Graphics Controller Type: */
    1437         if (fSuccess && isMachineOffline() && newDisplayData.m_graphicsControllerType != oldDisplayData.m_graphicsControllerType)
    1438         {
    1439             m_machine.SetGraphicsControllerType(newDisplayData.m_graphicsControllerType);
    1440             fSuccess = m_machine.isOk();
    1441         }
    14421461
    14431462        /* Get machine ID for further activities: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r76581 r80042  
    172172    /** Holds the initial VRAM value when the dialog is opened. */
    173173    int           m_iInitialVRAM;
     174#ifdef VBOX_WITH_CRHGSMI
     175    /** Holds whether the guest OS supports WDDM. */
     176    bool          m_fWddmModeSupported;
     177#endif
    174178#ifdef VBOX_WITH_VIDEOHWACCEL
    175179    /** Holds whether the guest OS supports 2D Video Acceleration. */
    176180    bool          m_f2DVideoAccelerationSupported;
    177 #endif
    178 #ifdef VBOX_WITH_CRHGSMI
    179     /** Holds whether the guest OS supports WDDM. */
    180     bool          m_fWddmModeSupported;
    181181#endif
    182182
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