VirtualBox

Changeset 46434 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jun 7, 2013 11:29:31 AM (12 years ago)
Author:
vboxsync
Message:

Main/Host: Put off calling VBoxOglIs3DAccelerationSupported till the information is actually requied. Saves spawning an extra child process every time Host() is instantiated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r46340 r46434  
    210210    /** @}  */
    211211
    212     /* 3D hardware acceleration supported? */
    213     BOOL                    f3DAccelerationSupported;
     212    /** 3D hardware acceleration supported? Tristate, -1 meaning not probed. */
     213    int                     f3DAccelerationSupported;
    214214
    215215    HostPowerService        *pHostPowerService;
     
    379379    }
    380380
    381     /* Test for 3D hardware acceleration support */
     381#ifdef VBOX_WITH_CROGL
     382    /* Test for 3D hardware acceleration support later when (if ever) need. */
     383    m->f3DAccelerationSupported = -1;
     384#else
    382385    m->f3DAccelerationSupported = false;
    383 
    384 #ifdef VBOX_WITH_CROGL
    385     m->f3DAccelerationSupported = VBoxOglIs3DAccelerationSupported();
    386 #endif /* VBOX_WITH_CROGL */
     386#endif
    387387
    388388#if defined (RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
     
    11451145    CheckComArgOutPointerValid(aSupported);
    11461146    AutoCaller autoCaller(this);
    1147     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1148 
    1149     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1150 
    1151     *aSupported = m->f3DAccelerationSupported;
     1147    HRESULT hrc = autoCaller.rc();
     1148    if (SUCCEEDED(hrc))
     1149    {
     1150        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1151        if (m->f3DAccelerationSupported != -1)
     1152            *aSupported = m->f3DAccelerationSupported;
     1153        else
     1154        {
     1155            alock.release();
     1156#ifdef VBOX_WITH_CROGL
     1157            bool fSupported = VBoxOglIs3DAccelerationSupported();
     1158#else
     1159            bool fSupported = false; /* shoudn't get here, but just in case. */
     1160#endif
     1161            AutoWriteLock alock2(this COMMA_LOCKVAL_SRC_POS);
     1162            m->f3DAccelerationSupported = fSupported;
     1163            alock2.release();
     1164
     1165            *aSupported = fSupported;
     1166        }
     1167    }
    11521168
    11531169#ifdef DEBUG_misha
     
    11551171#endif
    11561172
    1157     return S_OK;
     1173    return hrc;
    11581174}
    11591175
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