Changeset 105864 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 26, 2024 6:45:15 PM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 164584
- Location:
- trunk/src/VBox/Main
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r105576 r105864 5813 5813 <interface 5814 5814 name="IGraphicsAdapter" extends="$unknown" 5815 uuid=" f692806f-febe-4049-b476-1292a8e45b09"5815 uuid="13ee6eb4-06fe-406b-ad69-f6e08b0587a3" 5816 5816 wsmap="managed" 5817 5817 rest="managed" … … 5829 5829 <attribute name="VRAMSize" type="unsigned long"> 5830 5830 <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 make5836 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 make5842 use of the 2D video acceleration support available on the host.</desc>5843 5831 </attribute> 5844 5832 … … 5852 5840 </desc> 5853 5841 </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> 5854 5866 5855 5867 </interface> … … 6825 6837 <const name="QemuRamFB" value="4"> 6826 6838 <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> 6827 6855 </const> 6828 6856 </enum> … … 12881 12909 name="IPlatformProperties" 12882 12910 extends="$unknown" 12883 uuid=" a23502e4-cc54-490f-a344-c8ca8813f906"12911 uuid="5bae19d0-ca40-4ca2-a485-c8065190bbe5" 12884 12912 wsmap="managed" 12885 12913 rest="managed" … … 12960 12988 </attribute> 12961 12989 12962 <attribute name="supportedG raphicsControllerTypes" type="GraphicsControllerType" safearray="yes" readonly="yes">12990 <attribute name="supportedGfxControllerTypes" type="GraphicsControllerType" safearray="yes" readonly="yes"> 12963 12991 <desc> 12964 12992 Returns an array of officially supported values for enum <link to="GraphicsControllerType"/>, … … 13169 13197 </method> 13170 13198 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 13171 13213 <method name="getDeviceTypesForStorageBus"> 13172 13214 <desc>Returns list of all the supported device types … … 13265 13307 name="ISystemProperties" 13266 13308 extends="$unknown" 13267 uuid=" c61e666e-34ab-403a-8160-78bd4512ca86"13309 uuid="925084b0-625f-422f-a67d-0ede1880a56c" 13268 13310 wsmap="managed" 13269 13311 rest="managed" … … 13630 13672 <desc> 13631 13673 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"/>, 13632 13681 in the sense of what is e.g. worth offering in the VirtualBox GUI. 13633 13682 </desc> -
trunk/src/VBox/Main/include/GraphicsAdapterImpl.h
r98103 r105864 66 66 void i_copyFrom(GraphicsAdapter *aThat); 67 67 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 68 74 private: 69 75 … … 73 79 HRESULT getVRAMSize(ULONG *aVRAMSize); 74 80 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); 79 83 HRESULT getMonitorCount(ULONG *aMonitorCount); 80 84 HRESULT setMonitorCount(ULONG aMonitorCount); -
trunk/src/VBox/Main/include/PlatformPropertiesImpl.h
r104819 r105864 80 80 HRESULT getSupportedParavirtProviders(std::vector<ParavirtProvider_T> &aSupportedParavirtProviders) RT_OVERRIDE; 81 81 HRESULT getSupportedFirmwareTypes(std::vector<FirmwareType_T> &aSupportedFirmwareTypes) RT_OVERRIDE; 82 HRESULT getSupportedG raphicsControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes) RT_OVERRIDE;82 HRESULT getSupportedGfxControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes) RT_OVERRIDE; 83 83 HRESULT getSupportedGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aSupportedGuestOSTypes) RT_OVERRIDE; 84 84 HRESULT getSupportedNetAdpPromiscModePols(std::vector<NetworkAdapterPromiscModePolicy_T> &aSupportedNetworkAdapterPromiscModePolicies) RT_OVERRIDE; … … 111 111 HRESULT getSupportedVRAMRange(GraphicsControllerType_T aGraphicsControllerType, BOOL fAccelerate3DEnabled, 112 112 ULONG *aMinMB, ULONG *aMaxMB, ULONG *aStrideSizeMB) RT_OVERRIDE; 113 HRESULT getSupportedGfxFeaturesForType(GraphicsControllerType_T aGraphicsControllerType, 114 std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures); 113 115 HRESULT getDeviceTypesForStorageBus(StorageBus_T aBus, 114 116 std::vector<DeviceType_T> &aDeviceTypes) RT_OVERRIDE; -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r103977 r105864 131 131 HRESULT getSupportedImportOptions(std::vector<ImportOptions_T> &aSupportedImportOptions) RT_OVERRIDE; 132 132 HRESULT getSupportedExportOptions(std::vector<ExportOptions_T> &aSupportedExportOptions) RT_OVERRIDE; 133 HRESULT getSupportedGraphicsFeatures(std::vector<GraphicsFeature_T> &aSupportedGraphicsFeatures) RT_OVERRIDE; 133 134 HRESULT getSupportedRecordingFeatures(std::vector<RecordingFeature_T> &aSupportedRecordingFeatures) RT_OVERRIDE; 134 135 HRESULT getSupportedRecordingAudioCodecs(std::vector<RecordingAudioCodec_T> &aSupportedRecordingAudioCodecs) RT_OVERRIDE; -
trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp
r104865 r105864 28 28 #define LOG_GROUP LOG_GROUP_MAIN_PLATFORMPROPERTIES 29 29 #include "PlatformPropertiesImpl.h" 30 #include "GraphicsAdapterImpl.h" /* For static helper functions. */ 30 31 #include "VirtualBoxImpl.h" 31 32 #include "LoggingNew.h" … … 40 41 // generated header 41 42 #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 42 69 43 70 … … 676 703 } 677 704 678 HRESULT PlatformProperties::getSupportedG raphicsControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes)705 HRESULT PlatformProperties::getSupportedGfxControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes) 679 706 { 680 707 switch (mPlatformArchitecture) … … 918 945 } 919 946 947 HRESULT 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 920 957 HRESULT PlatformProperties::getSupportedAudioControllerTypes(std::vector<AudioControllerType_T> &aSupportedAudioControllerTypes) 921 958 { -
trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp
r105163 r105864 5075 5075 5076 5076 BOOL f3DEnabled; 5077 hrc = ptrGraphicsAdapter-> COMGETTER(Accelerate3DEnabled)(&f3DEnabled); H();5077 hrc = ptrGraphicsAdapter->IsFeatureEnabled(GraphicsFeature_Acceleration3D, &f3DEnabled); H(); 5078 5078 InsertConfigInteger(pCfg, "3DEnabled", f3DEnabled); 5079 5079 -
trunk/src/VBox/Main/src-server/GraphicsAdapterImpl.cpp
r104819 r105864 37 37 38 38 #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 39 62 40 63 … … 256 279 } 257 280 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 */ 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 347 HRESULT GraphicsAdapter::setFeature(GraphicsFeature_T aFeature, BOOL aEnabled) 268 348 { 269 349 /* the machine needs to be mutable */ … … 273 353 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 274 354 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 388 HRESULT GraphicsAdapter::isFeatureEnabled(GraphicsFeature_T aFeature, BOOL *aEnabled) 286 389 { 287 390 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 288 391 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; 308 414 309 415 return S_OK; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r105658 r105864 15232 15232 if (FAILED(hrc)) return hrc; 15233 15233 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 } 15236 15240 15237 15241 BOOL fAccelerate3DEnabled; … … 15239 15243 if (FAILED(hrc)) return hrc; 15240 15244 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 } 15243 15251 15244 15252 /* Apply network adapters defaults */ -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r105455 r105864 1176 1176 } 1177 1177 1178 HRESULT 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 1178 1194 HRESULT SystemProperties::getSupportedRecordingFeatures(std::vector<RecordingFeature_T> &aSupportedRecordingFeatures) 1179 1195 {
Note:
See TracChangeset
for help on using the changeset viewer.