VirtualBox

Changeset 46433 in vbox


Ignore:
Timestamp:
Jun 7, 2013 11:28:10 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86275
Message:

VirtualBox/VBoxGlobal: Put off calling VBoxOglIs3DAccelerationSupported (and thereby spawning a child process) till when the information is actually requested for the first time. Saved time and extra log file when starting VMs without 3D enabled.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r46430 r46433  
    271271    , mWarpPct(100)
    272272    , mVerString("1.0")
    273     , m3DAvailable(false)
     273    , m3DAvailable(-1)
    274274    , mSettingsPwSet(false)
    275275{
     
    408408    return m_pVirtualMachine->activeWindow();
    409409}
     410
     411
     412/**
     413 * Inner worker that for lazily querying for 3D support.
     414 *
     415 * Rational is that when starting a text mode guest (like DOS) that does not
     416 * have 3D enabled, don't wast the developer's or user's time on launching the
     417 * test application when starting the VM or editing it's settings.
     418 *
     419 * @returns true / false.
     420 * @note If we ever end up checking this concurrently on multiple threads, use a
     421 *       RTONCE construct to serialize the efforts.
     422 */
     423bool VBoxGlobal::is3DAvailableWorker() const
     424{
     425    bool fSupported = VBoxOglIs3DAccelerationSupported();
     426    unconst(this)->m3DAvailable = fSupported;
     427    return fSupported;
     428}
     429
    410430
    411431#ifdef VBOX_GUI_WITH_PIDFILE
     
    12101230        }
    12111231
    1212         QString acc3d = is3DAvailable() && aMachine.GetAccelerate3DEnabled()
     1232        QString acc3d = aMachine.GetAccelerate3DEnabled() && is3DAvailable()
    12131233            ? tr ("Enabled", "details report (3D Acceleration)")
    12141234            : tr ("Disabled", "details report (3D Acceleration)");
     
    40274047    }
    40284048    mHost = virtualBox().GetHost();
    4029 #ifdef VBOX_WITH_CROGL
    4030     m3DAvailable = VBoxOglIs3DAccelerationSupported();
    4031 #else
    4032     m3DAvailable = false;
    4033 #endif
    40344049
    40354050    /* create default non-null global settings */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r46430 r46433  
    9696    QWidget* activeMachineWindow();
    9797
    98     bool is3DAvailable() const { return m3DAvailable; }
     98    bool is3DAvailableWorker() const;
     99    bool is3DAvailable() const { if (m3DAvailable < 0) return is3DAvailableWorker(); return m3DAvailable != 0; }
    99100
    100101#ifdef VBOX_GUI_WITH_PIDFILE
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