Changeset 106080 in vbox
- Timestamp:
- Sep 18, 2024 12:38:27 PM (4 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GraphicsAdapterImpl.h
r106061 r106080 62 62 HRESULT i_saveSettings(settings::GraphicsAdapter &data); 63 63 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(); 67 69 68 70 private: -
trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp
r106061 r106080 848 848 { 849 849 #ifdef VBOX_WITH_VMSVGA 850 case GraphicsControllerType_VMSVGA: 851 RT_FALL_THROUGH(); 850 852 case GraphicsControllerType_VBoxSVGA: 851 853 { -
trunk/src/VBox/Main/src-server/GraphicsAdapterImpl.cpp
r106061 r106080 211 211 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 212 212 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 } 216 221 217 222 return S_OK; … … 264 269 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 265 270 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)) 269 276 return setError(VBOX_E_NOT_SUPPORTED, tr("The graphics controller does not support the given feature")); 270 277 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); 286 280 if (!pfSetting) 287 281 return setError(E_NOTIMPL, tr("The given feature is not implemented")); … … 292 286 mData.backup(); 293 287 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); 295 290 } 296 291 … … 385 380 mData.assignCopy(&data); 386 381 382 i_updateFeatures(); 383 387 384 return S_OK; 388 385 } … … 474 471 mData.assignCopy(aThat->mData); 475 472 } 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 */ 480 bool *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 */ 498 void 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.