VirtualBox

Changeset 105865 in vbox


Ignore:
Timestamp:
Aug 26, 2024 8:37:09 PM (3 months ago)
Author:
vboxsync
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

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r105864 r105865  
    30083008          <para><link linkend="IGraphicsAdapter__setFeature">IGraphicsAdapter::setFeature</link></para>
    30093009          <para>The new IGraphicsAdapter::setFeature enables or disables a graphics feature
    3010           for a specific adapter.
     3010          for a specific adapter.</para>
    30113011        </listitem>
    30123012      </itemizedlist>
  • trunk/src/VBox/Main/include/GraphicsAdapterImpl.h

    r105864 r105865  
    6666    void i_copyFrom(GraphicsAdapter *aThat);
    6767
    68 public:
    69 
    70     // static helper functions
    71     static int  s_getSupportedFeatures(GraphicsControllerType_T enmController, std::vector<GraphicsFeature_T> &vecSupportedGraphicsFeatures);
    72     static bool s_isFeatureSupported(GraphicsControllerType_T enmController, GraphicsFeature_T enmFeature);
    73 
    7468private:
    7569
  • trunk/src/VBox/Main/include/PlatformPropertiesImpl.h

    r105864 r105865  
    6868    static ULONG s_getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType);
    6969    static HRESULT s_getSupportedVRAMRange(GraphicsControllerType_T aGraphicsControllerType, BOOL fAccelerate3DEnabled, ULONG *aMinMB, ULONG *aMaxMB, ULONG *aStrideSizeMB);
     70    static int  s_getSupportedGraphicsControllerFeatures(GraphicsControllerType_T enmController, std::vector<GraphicsFeature_T> &vecSupportedGraphicsFeatures);
     71    static bool s_isGraphicsControllerFeatureSupported(GraphicsControllerType_T enmController, GraphicsFeature_T enmFeature);
    7072
    7173private:
  • trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp

    r105864 r105865  
    3333#include "Global.h"
    3434
     35#include <algorithm>
     36
    3537#include <iprt/asm.h>
    3638#include <iprt/cpp/utils.h>
     
    851853
    852854/**
     855 * Static helper function to return all supported features for a given graphics controller.
     856 *
     857 * @returns VBox status code.
     858 * @param   enmController                          Graphics controller to return supported features for.
     859 * @param   vecSupportedGraphicsControllerFeatures Returned features on success.
     860 */
     861/* static */
     862int PlatformProperties::s_getSupportedGraphicsControllerFeatures(GraphicsControllerType_T enmController,
     863                                                                 std::vector<GraphicsFeature_T> &vecSupportedGraphicsFeatures)
     864{
     865    switch (enmController)
     866    {
     867#ifdef VBOX_WITH_VMSVGA
     868        case GraphicsControllerType_VBoxSVGA:
     869        {
     870            static const GraphicsFeature_T s_aGraphicsFeatures[] =
     871            {
     872# ifdef VBOX_WITH_VIDEOHWACCEL
     873                GraphicsFeature_Acceleration2DVideo,
     874# endif
     875# ifdef VBOX_WITH_3D_ACCELERATION
     876                GraphicsFeature_Acceleration3D
     877# endif
     878            };
     879            MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
     880            break;
     881        }
     882#endif
     883        case GraphicsControllerType_VBoxVGA:
     884            RT_FALL_THROUGH();
     885        case GraphicsControllerType_QemuRamFB:
     886        {
     887            static const GraphicsFeature_T s_aGraphicsFeatures[] =
     888            {
     889                GraphicsFeature_None
     890            };
     891            MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
     892            break;
     893        }
     894
     895        default:
     896            return VERR_INVALID_PARAMETER;
     897    }
     898
     899    return VINF_SUCCESS;
     900}
     901
     902/**
     903 * Static helper function to return whether a given graphics feature for a graphics controller is enabled or not.
     904 *
     905 * @returns \c true if the given feature is supported, or \c false if not.
     906 * @param   enmController           Graphics controlller to query a feature for.
     907 * @param   enmFeature              Feature to query.
     908 */
     909/* static */
     910bool PlatformProperties::s_isGraphicsControllerFeatureSupported(GraphicsControllerType_T enmController, GraphicsFeature_T enmFeature)
     911{
     912    std::vector<GraphicsFeature_T> vecSupportedGraphicsFeatures;
     913    int vrc = PlatformProperties::s_getSupportedGraphicsControllerFeatures(enmController, vecSupportedGraphicsFeatures);
     914    if (RT_SUCCESS(vrc))
     915        return std::find(vecSupportedGraphicsFeatures.begin(),
     916                         vecSupportedGraphicsFeatures.end(), enmFeature) != vecSupportedGraphicsFeatures.end();
     917    return false;
     918}
     919
     920/**
    853921 * Returns the [minimum, maximum] VRAM range and stride size for a given graphics controller.
    854922 *
     
    9481016                                                           std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures)
    9491017{
    950     int vrc = GraphicsAdapter::s_getSupportedFeatures(aGraphicsControllerType, aSupportedGraphicsFeatures);
     1018    int vrc = PlatformProperties::s_getSupportedGraphicsControllerFeatures(aGraphicsControllerType, aSupportedGraphicsFeatures);
    9511019    if (RT_FAILURE(vrc))
    9521020        return setError(E_INVALIDARG, tr("The graphics controller type (%d) is invalid"), aGraphicsControllerType);
  • 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.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette