VirtualBox

Changeset 105864 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 26, 2024 6:45:15 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). bugref:10749

Location:
trunk/src/VBox
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r105266 r105864  
    15351535
    15361536    SHOW_ULONG_PROP(pGraphicsAdapter, MonitorCount,             "monitorcount",             Info::tr("Monitor count:"), "");
    1537     SHOW_BOOLEAN_PROP(pGraphicsAdapter, Accelerate3DEnabled,    "accelerate3d",             Info::tr("3D Acceleration:"));
     1537    SHOW_BOOLEAN_METHOD(pGraphicsAdapter, IsFeatureEnabled(GraphicsFeature_Acceleration3D, &f), "accelerate3d", "3D Acceleration:");
    15381538#ifdef VBOX_WITH_VIDEOHWACCEL
    1539     SHOW_BOOLEAN_PROP(pGraphicsAdapter, Accelerate2DVideoEnabled, "accelerate2dvideo",      Info::tr("2D Video Acceleration:"));
     1539    SHOW_BOOLEAN_METHOD(pGraphicsAdapter, IsFeatureEnabled(GraphicsFeature_Acceleration2DVideo, &f), "accelerate2dvideo", "2D Video Acceleration:");
    15401540#endif
    15411541    SHOW_BOOLEAN_PROP(    machine,  TeleporterEnabled,          "teleporterenabled",        Info::tr("Teleporter Enabled:"));
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r105080 r105864  
    11061106            case MODIFYVM_ACCELERATE3D:
    11071107            {
    1108                 CHECK_ERROR(pGraphicsAdapter, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
     1108                CHECK_ERROR(pGraphicsAdapter, SetFeature(GraphicsFeature_Acceleration3D, ValueUnion.f));
    11091109                break;
    11101110            }
     
    11131113            case MODIFYVM_ACCELERATE2DVIDEO:
    11141114            {
    1115                 CHECK_ERROR(pGraphicsAdapter, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
     1115                CHECK_ERROR(pGraphicsAdapter, SetFeature(GraphicsFeature_Acceleration2DVideo, ValueUnion.f));
    11161116                break;
    11171117            }
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r102957 r105864  
    10151015        print("  HPET [HPETEnabled]: %s" % (asState(mach.platform.x86.HPETEnabled)))
    10161016
    1017     print("  Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.graphicsAdapter.accelerate3DEnabled))
    1018     print("  Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.graphicsAdapter.accelerate2DVideoEnabled))
     1017    print("  Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.graphicsAdapter.isFeatureEnabled(ctx['const'].GraphicsFeature_Acceleration3D)))
     1018    print("  Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.graphicsAdapter.isFeatureEnabled(ctx['const'].GraphicsFeature_Acceleration2DVideo)))
    10191019    print("  Use universal time [RTCUseUTC]: %s" % (asState(mach.platform.RTCUseUTC)))
    10201020    audioAdp = mach.audioSettings.adapter
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r105802 r105864  
    500500    }
    501501
    502     /* 3D acceleration: */
    503502    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration)
    504503    {
    505         if (comGraphics.GetAccelerate3DEnabled())
     504        /* 3D acceleration: */
     505        if (comGraphics.IsFeatureEnabled(KGraphicsFeature_Acceleration3D))
    506506            table << UITextTableLine(QApplication::translate("UIDetails", "3D Acceleration", "details (display)"),
    507507                                     QApplication::translate("UIDetails", "Enabled", "details (display/3D Acceleration)"));
     
    14521452
    14531453    /* 3D acceleration: */
    1454     fAcceleration3D = comGraphics.GetAccelerate3DEnabled();
     1454    fAcceleration3D = comGraphics.IsFeatureEnabled(KGraphicsFeature_Acceleration3D);
    14551455    if (fAcceleration3D)
    14561456        strInfo += e_strTableRow2
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r105817 r105864  
    16051605    else
    16061606    {
    1607         const BOOL fAccelerate3DEnabeld = comAdapter.GetAccelerate3DEnabled();
     1607        const BOOL fAccelerate3DEnabeld = comAdapter.IsFeatureEnabled(KGraphicsFeature_Acceleration3D);
    16081608        fSuccess = comAdapter.isOk();
    16091609        if (!fSuccess)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIGraphicsControllerEditor.cpp

    r104313 r105864  
    164164                                            : KPlatformArchitecture_x86;
    165165        CPlatformProperties comProperties = gpGlobalSession->virtualBox().GetPlatformProperties(enmArch);
    166         m_supportedValues = comProperties.GetSupportedGraphicsControllerTypes();
     166        m_supportedValues = comProperties.GetSupportedGfxControllerTypes();
    167167
    168168        /* Make sure requested value if sane is present as well: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r105266 r105864  
    397397        oldDisplayData.m_graphicsControllerType = comGraphics.GetGraphicsControllerType();
    398398#ifdef VBOX_WITH_3D_ACCELERATION
    399         oldDisplayData.m_f3dAccelerationEnabled = comGraphics.GetAccelerate3DEnabled();
     399        oldDisplayData.m_f3dAccelerationEnabled = comGraphics.IsFeatureEnabled(KGraphicsFeature_Acceleration3D);
    400400#endif
    401401    }
     
    11311131            if (fSuccess && isMachineOffline() && newDisplayData.m_f3dAccelerationEnabled != oldDisplayData.m_f3dAccelerationEnabled)
    11321132            {
    1133                 comGraphics.SetAccelerate3DEnabled(newDisplayData.m_f3dAccelerationEnabled);
     1133                comGraphics.SetFeature(KGraphicsFeature_Acceleration3D, newDisplayData.m_f3dAccelerationEnabled);
    11341134                fSuccess = comGraphics.isOk();
    11351135            }
    11361136#endif
    1137 
    11381137            /* Get machine ID for further activities: */
    11391138            QUuid uMachineId;
  • trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotDetailsWidget.cpp

    r105259 r105864  
    14881488
    14891489            /* Acceleration? */
    1490             const QString str3DAccelerationStatus = comGraphics.GetAccelerate3DEnabled()
    1491                                                   ? QApplication::translate("UIDetails", "Enabled", "details (display/3D Acceleration)")
    1492                                                   : QString();
    1493             const QString str3DAccelerationStatusOld = comGraphicsOld.GetAccelerate3DEnabled()
    1494                                                      ? QApplication::translate("UIDetails", "Enabled", "details (display/3D Acceleration)")
    1495                                                      : QString();
     1490            const QString str3DAccelerationStatus =   comGraphics.IsFeatureEnabled(KGraphicsFeature_Acceleration3D)
     1491                                                    ? QApplication::translate("UIDetails", "Enabled", "details (display/3D Acceleration)")
     1492                                                    : QString();
     1493            const QString str3DAccelerationStatusOld =   comGraphicsOld.IsFeatureEnabled(KGraphicsFeature_Acceleration3D)
     1494                                                       ? QApplication::translate("UIDetails", "Enabled", "details (display/3D Acceleration)")
     1495                                                       : QString();
    14961496            if (!str3DAccelerationStatus.isNull())
    14971497            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r105576 r105864  
    58135813  <interface
    58145814    name="IGraphicsAdapter" extends="$unknown"
    5815     uuid="f692806f-febe-4049-b476-1292a8e45b09"
     5815    uuid="13ee6eb4-06fe-406b-ad69-f6e08b0587a3"
    58165816    wsmap="managed"
    58175817    rest="managed"
     
    58295829    <attribute name="VRAMSize" type="unsigned long">
    58305830      <desc>Video memory size in megabytes.</desc>
    5831     </attribute>
    5832 
    5833     <attribute name="accelerate3DEnabled" type="boolean" default="false">
    5834       <desc>
    5835         This setting determines whether VirtualBox allows this machine to make
    5836         use of the 3D graphics support available on the host.</desc>
    5837     </attribute>
    5838 
    5839     <attribute name="accelerate2DVideoEnabled" type="boolean" default="false">
    5840       <desc>
    5841         This setting determines whether VirtualBox allows this machine to make
    5842         use of the 2D video acceleration support available on the host.</desc>
    58435831    </attribute>
    58445832
     
    58525840      </desc>
    58535841    </attribute>
     5842
     5843    <method name="setFeature">
     5844      <desc>Sets a graphics controller feature.</desc>
     5845      <param name="feature" type="GraphicsFeature" dir="in">
     5846        <desc>
     5847          Graphics controller feature to set.
     5848        </desc>
     5849      </param>
     5850      <param name="enabled" type="boolean" dir="in">
     5851        <desc>
     5852          Whether to enable or disable the feature.
     5853        </desc>
     5854      </param>
     5855    </method>
     5856
     5857    <method name="isFeatureEnabled" const="yes">
     5858      <desc>Returns whether a particular feature is enabled for this adapter or not.</desc>
     5859      <param name="feature" type="GraphicsFeature" dir="in">
     5860        <desc>Feature to check for.</desc>
     5861      </param>
     5862      <param name="enabled" type="boolean" dir="return">
     5863        <desc>@c true if the feature is enabled, @c false if not.</desc>
     5864      </param>
     5865    </method>
    58545866
    58555867  </interface>
     
    68256837    <const name="QemuRamFB" value="4">
    68266838      <desc>QEMU RAM based framebuffer based device.</desc>
     6839    </const>
     6840  </enum>
     6841
     6842  <enum
     6843    name="GraphicsFeature"
     6844    uuid="5cd900a5-ec77-4a08-8f8d-c0a36f462a7c"
     6845    >
     6846    <desc>Graphics features.</desc>
     6847    <const name="None"          value="0">
     6848      <desc>No feature specified, invalid.</desc>
     6849    </const>
     6850    <const name="Acceleration2DVideo" value="1">
     6851      <desc>2D video acceleration.</desc>
     6852    </const>
     6853    <const name="Acceleration3D" value="2">
     6854      <desc>3D acceleration.</desc>
    68276855    </const>
    68286856  </enum>
     
    1288112909    name="IPlatformProperties"
    1288212910    extends="$unknown"
    12883     uuid="a23502e4-cc54-490f-a344-c8ca8813f906"
     12911    uuid="5bae19d0-ca40-4ca2-a485-c8065190bbe5"
    1288412912    wsmap="managed"
    1288512913    rest="managed"
     
    1296012988    </attribute>
    1296112989
    12962     <attribute name="supportedGraphicsControllerTypes" type="GraphicsControllerType" safearray="yes" readonly="yes">
     12990    <attribute name="supportedGfxControllerTypes" type="GraphicsControllerType" safearray="yes" readonly="yes">
    1296312991      <desc>
    1296412992        Returns an array of officially supported values for enum <link to="GraphicsControllerType"/>,
     
    1316913197    </method>
    1317013198
     13199    <method name="getSupportedGfxFeaturesForType">
     13200      <desc>
     13201        Returns the supported features of a given graphics controller.
     13202      </desc>
     13203
     13204      <param name="graphicsControllerType" type="GraphicsControllerType" dir="in">
     13205        <desc>Graphics controller type to return features for.</desc>
     13206      </param>
     13207
     13208      <param name="supportedControllerFeatures" type="GraphicsFeature" safearray="yes" dir="return">
     13209        <desc>The graphics controller features which are valid.</desc>
     13210      </param>
     13211    </method>
     13212
    1317113213    <method name="getDeviceTypesForStorageBus">
    1317213214      <desc>Returns list of all the supported device types
     
    1326513307    name="ISystemProperties"
    1326613308    extends="$unknown"
    13267     uuid="c61e666e-34ab-403a-8160-78bd4512ca86"
     13309    uuid="925084b0-625f-422f-a67d-0ede1880a56c"
    1326813310    wsmap="managed"
    1326913311    rest="managed"
     
    1363013672      <desc>
    1363113673        Returns an array of officially supported values for enum <link to="ExportOptions"/>,
     13674        in the sense of what is e.g. worth offering in the VirtualBox GUI.
     13675      </desc>
     13676    </attribute>
     13677
     13678    <attribute name="supportedGraphicsFeatures" type="GraphicsFeature" safearray="yes" readonly="yes">
     13679      <desc>
     13680        Returns an array of officially supported values for enum <link to="GraphicsFeature"/>,
    1363213681        in the sense of what is e.g. worth offering in the VirtualBox GUI.
    1363313682      </desc>
  • trunk/src/VBox/Main/include/GraphicsAdapterImpl.h

    r98103 r105864  
    6666    void i_copyFrom(GraphicsAdapter *aThat);
    6767
     68public:
     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
    6874private:
    6975
     
    7379    HRESULT getVRAMSize(ULONG *aVRAMSize);
    7480    HRESULT setVRAMSize(ULONG aVRAMSize);
    75     HRESULT getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled);
    76     HRESULT setAccelerate3DEnabled(BOOL aAccelerate3DEnabled);
    77     HRESULT getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled);
    78     HRESULT setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled);
     81    HRESULT setFeature(GraphicsFeature_T aFeature, BOOL aEnabled);
     82    HRESULT isFeatureEnabled(GraphicsFeature_T aFeature, BOOL *aEnabled);
    7983    HRESULT getMonitorCount(ULONG *aMonitorCount);
    8084    HRESULT setMonitorCount(ULONG aMonitorCount);
  • trunk/src/VBox/Main/include/PlatformPropertiesImpl.h

    r104819 r105864  
    8080    HRESULT getSupportedParavirtProviders(std::vector<ParavirtProvider_T> &aSupportedParavirtProviders) RT_OVERRIDE;
    8181    HRESULT getSupportedFirmwareTypes(std::vector<FirmwareType_T> &aSupportedFirmwareTypes) RT_OVERRIDE;
    82     HRESULT getSupportedGraphicsControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes) RT_OVERRIDE;
     82    HRESULT getSupportedGfxControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes) RT_OVERRIDE;
    8383    HRESULT getSupportedGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aSupportedGuestOSTypes) RT_OVERRIDE;
    8484    HRESULT getSupportedNetAdpPromiscModePols(std::vector<NetworkAdapterPromiscModePolicy_T> &aSupportedNetworkAdapterPromiscModePolicies) RT_OVERRIDE;
     
    111111    HRESULT getSupportedVRAMRange(GraphicsControllerType_T aGraphicsControllerType, BOOL fAccelerate3DEnabled,
    112112                                  ULONG *aMinMB, ULONG *aMaxMB, ULONG *aStrideSizeMB) RT_OVERRIDE;
     113    HRESULT getSupportedGfxFeaturesForType(GraphicsControllerType_T aGraphicsControllerType,
     114                                           std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures);
    113115    HRESULT getDeviceTypesForStorageBus(StorageBus_T aBus,
    114116                                        std::vector<DeviceType_T> &aDeviceTypes) RT_OVERRIDE;
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r103977 r105864  
    131131    HRESULT getSupportedImportOptions(std::vector<ImportOptions_T> &aSupportedImportOptions) RT_OVERRIDE;
    132132    HRESULT getSupportedExportOptions(std::vector<ExportOptions_T> &aSupportedExportOptions) RT_OVERRIDE;
     133    HRESULT getSupportedGraphicsFeatures(std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures) RT_OVERRIDE;
    133134    HRESULT getSupportedRecordingFeatures(std::vector<RecordingFeature_T> &aSupportedRecordingFeatures) RT_OVERRIDE;
    134135    HRESULT getSupportedRecordingAudioCodecs(std::vector<RecordingAudioCodec_T> &aSupportedRecordingAudioCodecs) RT_OVERRIDE;
  • trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp

    r104865 r105864  
    2828#define LOG_GROUP LOG_GROUP_MAIN_PLATFORMPROPERTIES
    2929#include "PlatformPropertiesImpl.h"
     30#include "GraphicsAdapterImpl.h" /* For static helper functions. */
    3031#include "VirtualBoxImpl.h"
    3132#include "LoggingNew.h"
     
    4041// generated header
    4142#include "SchemaDefs.h"
     43
     44
     45// defines
     46/////////////////////////////////////////////////////////////////////////////
     47
     48/** @def MY_VECTOR_ASSIGN_ARRAY
     49 * Safe way to copy an array (static + const) into a vector w/ minimal typing.
     50 *
     51 * @param a_rVector     The destination vector reference.
     52 * @param a_aSrcArray   The source array to assign to the vector.
     53 */
     54#if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
     55/* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
     56   This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
     57   and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
     58   version by version till it is fixed. */
     59# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
     60        _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
     61        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
     62        _Pragma("GCC diagnostic pop"); \
     63    } while (0)
     64#else
     65# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
     66        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
     67    } while (0)
     68#endif
    4269
    4370
     
    676703}
    677704
    678 HRESULT PlatformProperties::getSupportedGraphicsControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes)
     705HRESULT PlatformProperties::getSupportedGfxControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes)
    679706{
    680707    switch (mPlatformArchitecture)
     
    918945}
    919946
     947HRESULT PlatformProperties::getSupportedGfxFeaturesForType(GraphicsControllerType_T aGraphicsControllerType,
     948                                                           std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures)
     949{
     950    int vrc = GraphicsAdapter::s_getSupportedFeatures(aGraphicsControllerType, aSupportedGraphicsFeatures);
     951    if (RT_FAILURE(vrc))
     952        return setError(E_INVALIDARG, tr("The graphics controller type (%d) is invalid"), aGraphicsControllerType);
     953
     954    return S_OK;
     955}
     956
    920957HRESULT PlatformProperties::getSupportedAudioControllerTypes(std::vector<AudioControllerType_T> &aSupportedAudioControllerTypes)
    921958{
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp

    r105163 r105864  
    50755075
    50765076        BOOL f3DEnabled;
    5077         hrc = ptrGraphicsAdapter->COMGETTER(Accelerate3DEnabled)(&f3DEnabled);              H();
     5077        hrc = ptrGraphicsAdapter->IsFeatureEnabled(GraphicsFeature_Acceleration3D, &f3DEnabled);              H();
    50785078        InsertConfigInteger(pCfg,  "3DEnabled",            f3DEnabled);
    50795079
  • trunk/src/VBox/Main/src-server/GraphicsAdapterImpl.cpp

    r104819 r105864  
    3737
    3838#include <iprt/cpp/utils.h>
     39
     40
     41/** @def MY_VECTOR_ASSIGN_ARRAY
     42 * Safe way to copy an array (static + const) into a vector w/ minimal typing.
     43 *
     44 * @param a_rVector     The destination vector reference.
     45 * @param a_aSrcArray   The source array to assign to the vector.
     46 */
     47#if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
     48/* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
     49   This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
     50   and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
     51   version by version till it is fixed. */
     52# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
     53        _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
     54        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
     55        _Pragma("GCC diagnostic pop"); \
     56    } while (0)
     57#else
     58# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
     59        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
     60    } while (0)
     61#endif
    3962
    4063
     
    256279}
    257280
    258 HRESULT GraphicsAdapter::getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled)
    259 {
    260     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    261 
    262     *aAccelerate3DEnabled = mData->fAccelerate3D;
    263 
    264     return S_OK;
    265 }
    266 
    267 HRESULT GraphicsAdapter::setAccelerate3DEnabled(BOOL aAccelerate3DEnabled)
     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 */
     289int 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 */
     337bool 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
     347HRESULT GraphicsAdapter::setFeature(GraphicsFeature_T aFeature, BOOL aEnabled)
    268348{
    269349    /* the machine needs to be mutable */
     
    273353    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    274354
    275     /** @todo check validity! */
    276 
    277     mParent->i_setModified(Machine::IsModified_GraphicsAdapter);
    278     mData.backup();
    279     mData->fAccelerate3D = !!aAccelerate3DEnabled;
    280 
    281     return S_OK;
    282 }
    283 
    284 
    285 HRESULT GraphicsAdapter::getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled)
     355    /* Validate if the given feature is supported by this graphics controller. */
     356    if (!GraphicsAdapter::s_isFeatureSupported(mData->graphicsControllerType, aFeature))
     357        return setError(VBOX_E_NOT_SUPPORTED, tr("The graphics controller does not support the given feature"));
     358
     359    bool *pfSetting = NULL;
     360    switch (aFeature)
     361    {
     362        case GraphicsFeature_Acceleration2DVideo:
     363            pfSetting = &mData->fAccelerate2DVideo;
     364            break;
     365
     366        case GraphicsFeature_Acceleration3D:
     367            pfSetting = &mData->fAccelerate3D;
     368            break;
     369
     370        default:
     371            break;
     372    }
     373
     374    if (!pfSetting)
     375        return setError(E_NOTIMPL, tr("The given feature is not implemented"));
     376
     377    if (*pfSetting != RT_BOOL(aEnabled))
     378    {
     379        mParent->i_setModified(Machine::IsModified_GraphicsAdapter);
     380        mData.backup();
     381
     382        *pfSetting = RT_BOOL(aEnabled);
     383    }
     384
     385    return S_OK;
     386}
     387
     388HRESULT GraphicsAdapter::isFeatureEnabled(GraphicsFeature_T aFeature, BOOL *aEnabled)
    286389{
    287390    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    288391
    289     /* bugref:9691 The legacy VHWA acceleration has been disabled completely. */
    290     *aAccelerate2DVideoEnabled = FALSE;
    291 
    292     return S_OK;
    293 }
    294 
    295 HRESULT GraphicsAdapter::setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled)
    296 {
    297     /* the machine needs to be mutable */
    298     AutoMutableStateDependency adep(mParent);
    299     if (FAILED(adep.hrc())) return adep.hrc();
    300 
    301     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    302 
    303     /** @todo check validity! */
    304 
    305     mParent->i_setModified(Machine::IsModified_GraphicsAdapter);
    306     mData.backup();
    307     mData->fAccelerate2DVideo = !!aAccelerate2DVideoEnabled;
     392    bool *pfSetting = NULL;
     393
     394    switch (aFeature)
     395    {
     396#ifndef VBOX_WITH_VIRT_ARMV8 /* On macOS (ARM) we don't support any 2D/3D acceleration for now. */
     397        case GraphicsFeature_Acceleration2DVideo:
     398            pfSetting = &mData->fAccelerate2DVideo;
     399            *pfSetting = false; /* @bugref{9691} -- The legacy VHWA acceleration has been disabled completely. */
     400            break;
     401
     402        case GraphicsFeature_Acceleration3D:
     403            pfSetting = &mData->fAccelerate3D;
     404            break;
     405#endif
     406        default:
     407            break;
     408    }
     409
     410    if (!pfSetting)
     411        return VBOX_E_NOT_SUPPORTED;
     412
     413    *aEnabled = *pfSetting;
    308414
    309415    return S_OK;
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r105658 r105864  
    1523215232    if (FAILED(hrc)) return hrc;
    1523315233
    15234     hrc = mGraphicsAdapter->COMSETTER(Accelerate2DVideoEnabled)(fAccelerate2DVideoEnabled);
    15235     if (FAILED(hrc)) return hrc;
     15234    hrc = mGraphicsAdapter->SetFeature(GraphicsFeature_Acceleration2DVideo, fAccelerate2DVideoEnabled);
     15235    if (FAILED(hrc))
     15236    {
     15237        if (hrc != VBOX_E_NOT_SUPPORTED)
     15238            return hrc;
     15239    }
    1523615240
    1523715241    BOOL fAccelerate3DEnabled;
     
    1523915243    if (FAILED(hrc)) return hrc;
    1524015244
    15241     hrc = mGraphicsAdapter->COMSETTER(Accelerate3DEnabled)(fAccelerate3DEnabled);
    15242     if (FAILED(hrc)) return hrc;
     15245    hrc = mGraphicsAdapter->SetFeature(GraphicsFeature_Acceleration2DVideo, fAccelerate3DEnabled);
     15246    if (FAILED(hrc))
     15247    {
     15248        if (hrc != VBOX_E_NOT_SUPPORTED)
     15249            return hrc;
     15250    }
    1524315251
    1524415252    /* Apply network adapters defaults */
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r105455 r105864  
    11761176}
    11771177
     1178HRESULT SystemProperties::getSupportedGraphicsFeatures(std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures)
     1179{
     1180    static const GraphicsFeature_T s_aGraphicsFeatures[] =
     1181    {
     1182#ifdef VBOX_WITH_VIDEOHWACCEL
     1183        GraphicsFeature_Acceleration2DVideo,
     1184#endif
     1185#ifdef VBOX_WITH_3D_ACCELERATION
     1186        GraphicsFeature_Acceleration3D
     1187#endif
     1188    };
     1189    MY_VECTOR_ASSIGN_ARRAY(aSupportedGraphicsFeatures, s_aGraphicsFeatures);
     1190
     1191    return S_OK;
     1192}
     1193
    11781194HRESULT SystemProperties::getSupportedRecordingFeatures(std::vector<RecordingFeature_T> &aSupportedRecordingFeatures)
    11791195{
  • trunk/src/VBox/ValidationKit/testdriver/vbox.py

    r105435 r105864  
    23532353                    reporter.log("  HPET:               %s" % (oVM.hpetEnabled,));
    23542354        if self.fpApiVer >= 6.1 and hasattr(oVM, 'graphicsAdapter'):
    2355             reporter.log("  3D acceleration:    %s" % (oVM.graphicsAdapter.accelerate3DEnabled,));
    2356             reporter.log("  2D acceleration:    %s" % (oVM.graphicsAdapter.accelerate2DVideoEnabled,));
     2355            if self.fpApiVer >= 7.1 and hasattr(oVM.graphicsAdapter, 'isFeatureEnabled'):
     2356                fAccelerate3DEnabled = \
     2357                    oVM.graphicsAdapter.isFeatureEnabled(vboxcon.GraphicsFeature_Acceleration3D);
     2358                fAccelerate2DVideoEnabled = \
     2359                    oVM.graphicsAdapter.isFeatureEnabled(vboxcon.GraphicsFeature_Acceleration2DVideo);
     2360            else:
     2361                fAccelerate3DEnabled      = oVM.graphicsAdapter.accelerate3DEnabled;
     2362                fAccelerate2DVideoEnabled = oVM.graphicsAdapter.accelerate2DVideoEnabled;
    23572363        else:
    2358             reporter.log("  3D acceleration:    %s" % (oVM.accelerate3DEnabled,));
    2359             reporter.log("  2D acceleration:    %s" % (oVM.accelerate2DVideoEnabled,));
     2364            fAccelerate3DEnabled      = oVM.accelerate3DEnabled;
     2365            fAccelerate2DVideoEnabled = oVM.accelerate2DVideoEnabled;
     2366        reporter.log("  3D acceleration:    %s" % (fAccelerate3DEnabled,));
     2367        reporter.log("  2D acceleration:    %s" % (fAccelerate2DVideoEnabled,));
    23602368        reporter.log("  TeleporterEnabled:  %s" % (oVM.teleporterEnabled,));
    23612369        reporter.log("  TeleporterPort:     %s" % (oVM.teleporterPort,));
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r103702 r105864  
    19151915        try:
    19161916            if self.fpApiVer >= 6.1 and hasattr(self.o.machine, 'graphicsAdapter'):
    1917                 self.o.machine.graphicsAdapter.accelerate3DEnabled = fEnabled;
     1917                if self.fpApiVer >= 7.1 and hasattr(self.o.machine.graphicsAdapter, 'isFeatureEnabled'):
     1918                    self.o.machine.graphicsAdapter.setFeatureEnabled(vboxcon.GraphicsFeature_Acceleration3D, fEnabled);
     1919                else:
     1920                    self.o.machine.graphicsAdapter.accelerate3DEnabled = fEnabled;
    19181921            else:
    19191922                self.o.machine.accelerate3DEnabled = fEnabled;
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