VirtualBox

Changeset 106571 in vbox


Ignore:
Timestamp:
Oct 21, 2024 3:40:30 PM (3 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10767: VM settings / Display page: Update VRAM editor with possibility to fetch minimum / maximum VRAM values on the basis of platform type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.cpp

    r106570 r106571  
    4040
    4141/* COM includes: */
     42#include "CPlatformProperties.h"
    4243#include "CSystemProperties.h"
    4344
     
    182183    if (m_pLabelMemoryMin)
    183184    {
     185        m_pLabelMemoryMin->setText(tr("%1 MB").arg(0));
    184186        m_pLabelMemoryMin->setToolTip(tr("Minimum possible video memory size."));
    185187    }
     
    314316        return;
    315317
     318    /* Acquire minimum and maximum visible VRAM size on the basis of platform data: */
     319    const KPlatformArchitecture enmArch = optionalFlags().contains("arch")
     320                                        ? optionalFlags().value("arch").value<KPlatformArchitecture>()
     321                                        : KPlatformArchitecture_x86;
     322    CPlatformProperties comPlatformProperties = gpGlobalSession->virtualBox().GetPlatformProperties(enmArch);
     323    bool f3DAccelerationEnabled = false;
     324#ifdef VBOX_WITH_3D_ACCELERATION
     325    f3DAccelerationEnabled = m_f3DAccelerationEnabled;
     326#endif
     327    ULONG uMinVRAM = 0, uMaxVRAM = 0;
     328    comPlatformProperties.GetSupportedVRAMRange(m_enmGraphicsControllerType, f3DAccelerationEnabled, uMinVRAM, uMaxVRAM);
     329
    316330    /* Init recommended VRAM according to guest OS type and screen count: */
    317331    int iNeedMBytes = UIGuestOSTypeHelpers::requiredVideoMemory(m_strGuestOSTypeId, m_cGuestScreenCount) / _1M;
     
    320334    int iMaxVRAMVisible = m_cGuestScreenCount * 32;
    321335    /* Adjust visible maximum VRAM to be no less than 128MB (if possible): */
    322     if (iMaxVRAMVisible < 128 && m_iMaxVRAM >= 128)
     336    if (iMaxVRAMVisible < 128 && uMaxVRAM >= 128)
    323337        iMaxVRAMVisible = 128;
    324338
     
    330344
    331345        /* Adjust visible maximum VRAM to be no less than 256MB (if possible): */
    332         if (iMaxVRAMVisible < 256 && m_iMaxVRAM >= 256)
     346        if (iMaxVRAMVisible < 256 && uMaxVRAM >= 256)
    333347            iMaxVRAMVisible = 256;
    334348    }
     
    336350
    337351    /* Adjust recommended VRAM to be no more than actual maximum VRAM: */
    338     iNeedMBytes = qMin(iNeedMBytes, m_iMaxVRAM);
     352    iNeedMBytes = qMin(iNeedMBytes, (int)uMaxVRAM);
    339353
    340354    /* Adjust visible maximum VRAM to be no less than initial VRAM: */
     
    343357    iMaxVRAMVisible = qMax(iMaxVRAMVisible, iNeedMBytes);
    344358    /* Adjust visible maximum VRAM to be no more than actual maximum VRAM: */
    345     iMaxVRAMVisible = qMin(iMaxVRAMVisible, m_iMaxVRAM);
     359    iMaxVRAMVisible = qMin(iMaxVRAMVisible, (int)uMaxVRAM);
    346360
    347361    if (m_pSpinBox)
     
    351365        m_pSlider->setMaximum(iMaxVRAMVisible);
    352366        m_pSlider->setPageStep(calculatePageStep(iMaxVRAMVisible));
    353         m_pSlider->setWarningHint(1, qMin(iNeedMBytes, iMaxVRAMVisible));
    354         m_pSlider->setOptimalHint(qMin(iNeedMBytes, iMaxVRAMVisible), iMaxVRAMVisible);
     367        m_pSlider->setErrorHint(0, uMinVRAM);
     368        m_pSlider->setWarningHint(uMinVRAM, iNeedMBytes);
     369        m_pSlider->setOptimalHint(iNeedMBytes, iMaxVRAMVisible);
    355370    }
    356371    if (m_pLabelMemoryMax)
Note: See TracChangeset for help on using the changeset viewer.

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