Changeset 27411 in vbox for trunk/src/VBox
- Timestamp:
- Mar 16, 2010 3:09:54 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r27215 r27411 3743 3743 */ 3744 3744 /* static */ 3745 quint64 VBoxGlobal::requiredVideoMemory (CMachine *aMachine )3745 quint64 VBoxGlobal::requiredVideoMemory (CMachine *aMachine /* = 0 */, int cMonitors /* = 1 */) 3746 3746 { 3747 3747 QSize desktopRes = QApplication::desktop()->screenGeometry().size(); 3748 /* Calculate summary required memory amount in bits */ 3749 quint64 needBits = (desktopRes.width() /* display width */ * 3750 desktopRes.height() /* display height */ * 3751 32 /* we will take the maximum possible bpp for now */ + 3752 8 * _1M /* current cache per screen - may be changed in future */) * 3753 (!aMachine || aMachine->isNull() ? 1 : aMachine->GetMonitorCount()) + 3754 8 * 4096 /* adapter info */; 3748 QDesktopWidget *pDW = QApplication::desktop(); 3749 /* We create a list of the size of all available host monitors. This list 3750 * is sorted by value and by starting with the biggest one, we calculate 3751 * the memory requirements for every guest screen. This is of course not 3752 * correct, but as we can't predict on which host screens the user will 3753 * open the guest windows, this is the best assumption we can do, cause it 3754 * is the worst case. */ 3755 QVector<int> screenSize(qMax(cMonitors, pDW->numScreens()), 0); 3756 for (int i = 0; i < pDW->numScreens(); ++i) 3757 { 3758 QRect r = pDW->screenGeometry(i); 3759 screenSize[i] = r.width() * r.height(); 3760 } 3761 /* Now sort the vector */ 3762 qSort(screenSize.begin(), screenSize.end(), qGreater<int>()); 3763 /* For the case that there are more guest screens configured then host 3764 * screens available, replace all zeros with the greatest value in the 3765 * vector. */ 3766 for (int i = 0; i < screenSize.size(); ++i) 3767 if (screenSize.at(i) == 0) 3768 screenSize.replace(i, screenSize.at(0)); 3769 3770 quint64 needBits = 0; 3771 for (int i = 0; i < cMonitors; ++i) 3772 { 3773 /* Calculate summary required memory amount in bits */ 3774 needBits += (screenSize.at(i) * /* with x height */ 3775 32 + /* we will take the maximum possible bpp for now */ 3776 8 * _1M) + /* current cache per screen - may be changed in future */ 3777 8 * 4096; /* adapter info */ 3778 } 3755 3779 /* Translate value into megabytes with rounding to highest side */ 3756 3780 quint64 needMBytes = needBits % (8 * _1M) ? needBits / (8 * _1M) + 1 : -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r27096 r27411 783 783 VBoxDefs::FormatSize aMode = VBoxDefs::FormatSize_Round); 784 784 785 static quint64 requiredVideoMemory (CMachine *aMachine = 0 );785 static quint64 requiredVideoMemory (CMachine *aMachine = 0, int cMonitors = 1); 786 786 787 787 static QString locationForHTML (const QString &aFileName); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.cpp
r27406 r27411 206 206 { 207 207 /* Video RAM amount test */ 208 quint64 needBytes = VBoxGlobal::requiredVideoMemory (&mMachine );208 quint64 needBytes = VBoxGlobal::requiredVideoMemory (&mMachine, mSlMonitors->value()); 209 209 if ((quint64) mSlMemory->value() * _1M < needBytes) 210 210 {
Note:
See TracChangeset
for help on using the changeset viewer.