VirtualBox

Changeset 105865 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Aug 26, 2024 8:37:09 PM (7 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164585
Message:

Main: Added API for querying graphics features (2D Video / 3D Acceleration) of a specific graphics controller for a given platform and revamped the graphics controller attributes for 2D / 3D setters/getters to also use the new graphics features enumeration. Also, the system properties also now contain a dedicated API to query for graphics features (very basic for now, needs to be stuffed out). See SDK changelog for details. Added validation code when setting a specific graphics feature (which we never did before) [build fix]. bugref:10749

File:
1 edited

Legend:

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

    r105864 r105865  
    279279}
    280280
    281 /**
    282  * Static helper function to return all supported features for a given graphics controller.
    283  *
    284  * @returns VBox status code.
    285  * @param   enmController                          Graphics controller to return supported features for.
    286  * @param   vecSupportedGraphicsControllerFeatures Returned features on success.
    287  */
    288 /* static */
    289 int GraphicsAdapter::s_getSupportedFeatures(GraphicsControllerType_T enmController,
    290                                             std::vector<GraphicsFeature_T> &vecSupportedGraphicsFeatures)
    291 {
    292     switch (enmController)
    293     {
    294 #ifdef VBOX_WITH_VMSVGA
    295         case GraphicsControllerType_VBoxSVGA:
    296         {
    297             static const GraphicsFeature_T s_aGraphicsFeatures[] =
    298             {
    299 # ifdef VBOX_WITH_VIDEOHWACCEL
    300                 GraphicsFeature_Acceleration2DVideo,
    301 # endif
    302 # ifdef VBOX_WITH_3D_ACCELERATION
    303                 GraphicsFeature_Acceleration3D
    304 # endif
    305             };
    306             MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
    307             break;
    308         }
    309 #endif
    310         case GraphicsControllerType_VBoxVGA:
    311             RT_FALL_THROUGH();
    312         case GraphicsControllerType_QemuRamFB:
    313         {
    314             static const GraphicsFeature_T s_aGraphicsFeatures[] =
    315             {
    316                 GraphicsFeature_None
    317             };
    318             MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
    319             break;
    320         }
    321 
    322         default:
    323             return VERR_INVALID_PARAMETER;
    324     }
    325 
    326     return VINF_SUCCESS;
    327 }
    328 
    329 /**
    330  * Static helper function to return whether a given graphics feature for a graphics controller is enabled or not.
    331  *
    332  * @returns \c true if the given feature is supported, or \c false if not.
    333  * @param   enmController           Graphics controlller to query a feature for.
    334  * @param   enmFeature              Feature to query.
    335  */
    336 /* static */
    337 bool GraphicsAdapter::s_isFeatureSupported(GraphicsControllerType_T enmController, GraphicsFeature_T enmFeature)
    338 {
    339     std::vector<GraphicsFeature_T> vecSupportedGraphicsFeatures;
    340     int vrc = GraphicsAdapter::s_getSupportedFeatures(enmController, vecSupportedGraphicsFeatures);
    341     if (RT_SUCCESS(vrc))
    342         return std::find(vecSupportedGraphicsFeatures.begin(),
    343                          vecSupportedGraphicsFeatures.end(), enmFeature) != vecSupportedGraphicsFeatures.end();
    344     return false;
    345 }
    346 
    347281HRESULT GraphicsAdapter::setFeature(GraphicsFeature_T aFeature, BOOL aEnabled)
    348282{
     
    354288
    355289    /* Validate if the given feature is supported by this graphics controller. */
    356     if (!GraphicsAdapter::s_isFeatureSupported(mData->graphicsControllerType, aFeature))
     290    if (!PlatformProperties::s_isGraphicsControllerFeatureSupported(mData->graphicsControllerType, aFeature))
    357291        return setError(VBOX_E_NOT_SUPPORTED, tr("The graphics controller does not support the given feature"));
    358292
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