VirtualBox

Changeset 106080 in vbox


Ignore:
Timestamp:
Sep 18, 2024 12:38:27 PM (4 months ago)
Author:
vboxsync
Message:

Main: Fixed enabling 3D when selecting supported graphics controllers. bugref:10749

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GraphicsAdapterImpl.h

    r106061 r106080  
    6262    HRESULT i_saveSettings(settings::GraphicsAdapter &data);
    6363
    64     void i_rollback();
    65     void i_commit();
    66     void i_copyFrom(GraphicsAdapter *aThat);
     64    void  i_rollback();
     65    void  i_commit();
     66    void  i_copyFrom(GraphicsAdapter *aThat);
     67    bool *i_getFeatureMemberBool(GraphicsFeature_T aFeature);
     68    void  i_updateFeatures();
    6769
    6870private:
  • trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp

    r106061 r106080  
    848848            {
    849849#ifdef VBOX_WITH_VMSVGA
     850                case GraphicsControllerType_VMSVGA:
     851                    RT_FALL_THROUGH();
    850852                case GraphicsControllerType_VBoxSVGA:
    851853                {
  • trunk/src/VBox/Main/src-server/GraphicsAdapterImpl.cpp

    r106061 r106080  
    211211    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    212212
    213     mParent->i_setModified(Machine::IsModified_GraphicsAdapter);
    214     mData.backup();
    215     mData->graphicsControllerType = aGraphicsControllerType;
     213    if (mData->graphicsControllerType != aGraphicsControllerType)
     214    {
     215        mParent->i_setModified(Machine::IsModified_GraphicsAdapter);
     216        mData.backup();
     217        mData->graphicsControllerType = aGraphicsControllerType;
     218
     219        i_updateFeatures();
     220    }
    216221
    217222    return S_OK;
     
    264269    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    265270
    266     /* Validate if the given feature is supported by this graphics controller on the given VM platform. */
    267     if (!PlatformProperties::s_isGraphicsControllerFeatureSupported(mParent->i_getPlatform()->i_getArchitecture(),
    268                                                                     mData->graphicsControllerType, aFeature))
     271    /* Validate if the given feature to be enabled is supported by this graphics controller on the given VM platform.
     272     * Disabling always is allowed for all graphics controllers. */
     273    if (   aEnabled
     274        && !PlatformProperties::s_isGraphicsControllerFeatureSupported(mParent->i_getPlatform()->i_getArchitecture(),
     275                                                                       mData->graphicsControllerType, aFeature))
    269276        return setError(VBOX_E_NOT_SUPPORTED, tr("The graphics controller does not support the given feature"));
    270277
    271     bool *pfSetting = NULL;
    272     switch (aFeature)
    273     {
    274         case GraphicsFeature_Acceleration2DVideo:
    275             pfSetting = &mData->fAccelerate2DVideo;
    276             break;
    277 
    278         case GraphicsFeature_Acceleration3D:
    279             pfSetting = &mData->fAccelerate3D;
    280             break;
    281 
    282         default:
    283             break;
    284     }
    285 
     278
     279    bool *pfSetting = i_getFeatureMemberBool(aFeature);
    286280    if (!pfSetting)
    287281        return setError(E_NOTIMPL, tr("The given feature is not implemented"));
     
    292286        mData.backup();
    293287
    294         *pfSetting = RT_BOOL(aEnabled);
     288        /* Note: We have to re-evaluate the feature member here, as mData.backup() above changed the pointers. */
     289        *i_getFeatureMemberBool(aFeature) = RT_BOOL(aEnabled);
    295290    }
    296291
     
    385380    mData.assignCopy(&data);
    386381
     382    i_updateFeatures();
     383
    387384    return S_OK;
    388385}
     
    474471    mData.assignCopy(aThat->mData);
    475472}
    476 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
     473
     474/**
     475 * Returns the pointer to a boolean feature member of a given graphics feature.
     476 *
     477 * @returns Pointer to a boolean feature member of a given graphics feature, or NULL if not found / implemented.
     478 * @param   aFeature            Graphics feature to return boolean feature member for.
     479 */
     480bool *GraphicsAdapter::i_getFeatureMemberBool(GraphicsFeature_T aFeature)
     481{
     482    switch (aFeature)
     483    {
     484        case GraphicsFeature_Acceleration2DVideo: return &mData->fAccelerate2DVideo;
     485        case GraphicsFeature_Acceleration3D:      return &mData->fAccelerate3D;
     486        default:
     487            break;
     488    }
     489
     490    return NULL;
     491}
     492
     493/**
     494 * Updates all enabled features for the currently set graphics controller type.
     495 *
     496 * This will disable enabled features if the currently set graphics controller type does not support it.
     497 */
     498void GraphicsAdapter::i_updateFeatures()
     499{
     500    struct FEATUREMEMBER2ENUM
     501    {
     502        bool             *pfFeatureMember;
     503        GraphicsFeature_T enmFeature;
     504    };
     505
     506    static FEATUREMEMBER2ENUM s_aFeatures[] =
     507    {
     508        { &mData->fAccelerate2DVideo, GraphicsFeature_Acceleration2DVideo },
     509        { &mData->fAccelerate3D,      GraphicsFeature_Acceleration3D },
     510    };
     511
     512    for (size_t i = 0; i < RT_ELEMENTS(s_aFeatures); i++)
     513    {
     514        if (*s_aFeatures[i].pfFeatureMember)
     515            *s_aFeatures[i].pfFeatureMember
     516                = PlatformProperties::s_isGraphicsControllerFeatureSupported(mParent->i_getPlatform()->i_getArchitecture(),
     517                                                                             mData->graphicsControllerType,
     518                                                                             s_aFeatures[i].enmFeature);
     519    }
     520}
     521
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