Changeset 45779 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Apr 26, 2013 3:18:59 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r45778 r45779 73 73 static int VBoxGuestCommonGuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask, uint32_t fNotMask); 74 74 75 #define VBOXGUEST_ACQUIRE_STYLE_ CAPS (VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST)75 #define VBOXGUEST_ACQUIRE_STYLE_EVENTS (VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST) 76 76 77 77 DECLINLINE(uint32_t) VBoxGuestCommonGetHandledEventsLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 78 78 { 79 if( pDevExt->enmGuestCapsAcquireMode != VBOXGUUESTCAPS_MODE_ACQUIRE)79 if(!pDevExt->u32AcquireModeGuestCaps) 80 80 return VMMDEV_EVENT_VALID_EVENT_MASK; 81 81 82 uint32_t u32A quiredGuestCaps = pSession->u32AquiredGuestCaps;83 uint32_t u32CleanupEvents = VBOXGUEST_ACQUIRE_STYLE_ CAPS;84 if (u32A quiredGuestCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS)82 uint32_t u32AllowedGuestCaps = pSession->u32AquiredGuestCaps | (VMMDEV_EVENT_VALID_EVENT_MASK & ~pDevExt->u32AcquireModeGuestCaps); 83 uint32_t u32CleanupEvents = VBOXGUEST_ACQUIRE_STYLE_EVENTS; 84 if (u32AllowedGuestCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS) 85 85 u32CleanupEvents &= ~VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST; 86 if (u32A quiredGuestCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS)86 if (u32AllowedGuestCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS) 87 87 u32CleanupEvents &= ~VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST; 88 88 … … 98 98 } 99 99 100 DECLINLINE(bool) VBoxGuestCommonGuestCapsModeSet(PVBOXGUESTDEVEXT pDevExt, VBOXGUUESTCAPS_MODE enmMode) 101 { 102 VBOXGUUESTCAPS_MODE enmOldMode; 103 if (ASMAtomicCmpXchgExU32((volatile uint32_t*)&pDevExt->enmGuestCapsAcquireMode, enmMode, VBOXGUUESTCAPS_MODE_UNDEFINED, (uint32_t*)&enmOldMode)) 104 return true; 105 return enmOldMode == enmMode; 100 DECLINLINE(bool) VBoxGuestCommonGuestCapsModeSet(PVBOXGUESTDEVEXT pDevExt, uint32_t fCaps, bool fAcquire, uint32_t *pu32OtherVal) 101 { 102 uint32_t *pVal = fAcquire ? &pDevExt->u32AcquireModeGuestCaps : &pDevExt->u32SetModeGuestCaps; 103 const uint32_t fNotVal = !fAcquire ? pDevExt->u32AcquireModeGuestCaps : pDevExt->u32SetModeGuestCaps; 104 bool fResult = true; 105 RTSpinlockAcquire(pDevExt->EventSpinlock); 106 107 if (!(fNotVal & fCaps)) 108 *pVal |= fCaps; 109 else 110 { 111 AssertMsgFailed(("trying to change caps mode\n")); 112 fResult = false; 113 } 114 115 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock); 116 117 if (pu32OtherVal) 118 *pu32OtherVal = fNotVal; 119 return fResult; 106 120 } 107 121 … … 803 817 } 804 818 805 pDevExt->enmGuestCapsAcquireMode = VBOXGUUESTCAPS_MODE_UNDEFINED; 819 pDevExt->u32AcquireModeGuestCaps = 0; 820 pDevExt->u32SetModeGuestCaps = 0; 806 821 pDevExt->u32GuestCaps = 0; 807 822 … … 1585 1600 */ 1586 1601 case VMMDevReq_SetGuestCapabilities: 1587 #if 0 1588 /* @todo: currently windows clients use both Set and Acquire for different caps1589 * this should not lead to any problem, however, better switch to consistent behavior */1590 if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, VBOXGUUESTCAPS_MODE_SET))1602 { 1603 VMMDevReqGuestCapabilities2 *pCaps = (VMMDevReqGuestCapabilities2*)pReqHdr; 1604 uint32_t fAcquireCaps = 0; 1605 if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, pCaps->u32OrMask, false, &fAcquireCaps)) 1591 1606 { 1592 Assert (0);1593 LogRel(("calling caps set for invalid caps mode %d\n", pDevExt->enmGuestCapsAcquireMode));1607 AssertFailed(); 1608 LogRel(("calling caps set for acquired caps %d\n", pCaps->u32OrMask)); 1594 1609 enmRequired = kLevel_NoOne; 1595 1610 break; 1596 1611 } 1597 #endif 1612 /* hack to adjust the notcaps. 1613 * @todo: move to a better place 1614 * user-mode apps are allowed to pass any mask to the notmask, 1615 * the driver cleans up them accordingly */ 1616 pCaps->u32NotMask &= ~fAcquireCaps; 1598 1617 /* do not break, make it fall through to the below enmRequired setting */ 1618 } 1599 1619 /* 1600 1620 * Anyone. … … 2510 2530 ASMAtomicWriteU32(&pDevExt->f32PendingEvents, fEvents); 2511 2531 2512 RTSpinlockRelease (pDevExt->EventSpinlock);2532 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock); 2513 2533 2514 2534 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP … … 2519 2539 static int VBoxGuestCommonGuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask, uint32_t fNotMask) 2520 2540 { 2521 if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, VBOXGUUESTCAPS_MODE_ACQUIRE)) 2541 uint32_t fSetCaps = 0; 2542 if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, fOrMask, true, &fSetCaps)) 2522 2543 { 2523 2544 Assert(0); 2524 LogRel(("calling caps acquire for invalid caps mode %d\n", pDevExt->enmGuestCapsAcquireMode));2545 LogRel(("calling caps acquire for set caps %d\n", fOrMask)); 2525 2546 return VERR_INVALID_STATE; 2526 2547 } 2548 2549 /* user-mode apps are allowed to pass any mask to the notmask, 2550 * the driver cleans up them accordingly */ 2551 fNotMask &= ~fSetCaps; 2552 2527 2553 if (!VBoxGuestCommonGuestCapsValidateValues(fOrMask)) 2528 2554 return VERR_INVALID_PARAMETER; -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r45778 r45779 107 107 /** Pointer to a memory balloon. */ 108 108 typedef VBOXGUESTMEMBALLOON *PVBOXGUESTMEMBALLOON; 109 110 typedef enum VBOXGUUESTCAPS_MODE111 {112 VBOXGUUESTCAPS_MODE_UNDEFINED = 0,113 /* uncomment when/if guests have consistent Acquire/Set behavior,114 * i.e. only either of those should be used, while at leats on win they are used interchangeably */115 /*VBOXGUUESTCAPS_MODE_SET,*/116 VBOXGUUESTCAPS_MODE_ACQUIRE,117 VBOXGUUESTCAPS_MODE_Make32bit = 0x7fffffff,118 } VBOXGUUESTCAPS_MODE;119 109 120 110 /** … … 190 180 /** Callback and user data for a kernel mouse handler. */ 191 181 VBoxGuestMouseSetNotifyCallback MouseNotifyCallback; 192 /* true if the driver is in caps acquire mode, 193 * i.e. no seamless of resize events are reported unless the driver has acquired the corresponding guest caps */ 194 volatile VBOXGUUESTCAPS_MODE enmGuestCapsAcquireMode; 182 /* list of caps used in acquire mode */ 183 uint32_t u32AcquireModeGuestCaps; 184 /* list of caps used in set mode */ 185 uint32_t u32SetModeGuestCaps; 195 186 /* currently acquired (and reported) guest caps */ 196 187 uint32_t u32GuestCaps;
Note:
See TracChangeset
for help on using the changeset viewer.