VirtualBox

Changeset 3345 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 2, 2007 10:15:13 AM (17 years ago)
Author:
vboxsync
Message:

Automatically enable HGCM host events, when the guest issues HGCM commands.

Location:
trunk/src/VBox/Devices/VMMDev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp

    r3319 r3345  
    209209}
    210210
    211 static void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState,
    212                                           uint32_t u32OrMask,
    213                                           uint32_t u32NotMask)
     211void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState,
     212                                   uint32_t u32OrMask,
     213                                   uint32_t u32NotMask)
    214214{
    215215    const bool fHadEvents =
     
    17741774
    17751775#ifdef VBOX_HGCM
     1776    pData->pHGCMCmdList = NULL;
    17761777    rc = RTCritSectInit(&pData->critsectHGCMCmdList);
    17771778    AssertRCReturn(rc, rc);
     1779    pData->u32HGCMRefs = 0;
    17781780#endif /* VBOX_HGCM */
    17791781
  • trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp

    r3166 r3345  
    2323
    2424#include <iprt/alloc.h>
     25#include <iprt/asm.h>
    2526#include <iprt/assert.h>
    2627#include <iprt/param.h>
     
    125126        pCmd->enmCmdType = enmCmdType;
    126127        pCmd->GCPtr = GCPtr;
     128       
     129        /* Automatically enable HGCM events, if there are HGCM commands. */
     130        if (   enmCmdType == VBOXHGCMCMDTYPE_CONNECT
     131            || enmCmdType == VBOXHGCMCMDTYPE_DISCONNECT
     132            || enmCmdType == VBOXHGCMCMDTYPE_CALL)
     133        {
     134            uint32_t u32 = ASMAtomicIncU32 (&pVMMDevState->u32HGCMRefs);
     135            Assert(u32 != 0);
     136            vmmdevCtlGuestFilterMask_EMT (pVMMDevState, VMMDEV_EVENT_HGCM, 0);
     137        }
    127138
    128139        vmmdevHGCMCmdListUnlock (pVMMDevState);
     
    158169        {
    159170            pVMMDevState->pHGCMCmdList = pCmd->pNext;
     171        }
     172
     173        /* Automatically disable HGCM events, if there are no more HGCM commands. */
     174        if (   pCmd->enmCmdType == VBOXHGCMCMDTYPE_CONNECT
     175            || pCmd->enmCmdType == VBOXHGCMCMDTYPE_DISCONNECT
     176            || pCmd->enmCmdType == VBOXHGCMCMDTYPE_CALL)
     177        {
     178            uint32_t u32 = ASMAtomicDecU32 (&pVMMDevState->u32HGCMRefs);
     179            Assert(u32 != 0xFFFFFFFF);
     180            if (u32 == 0)
     181            {
     182                vmmdevCtlGuestFilterMask_EMT (pVMMDevState, 0, VMMDEV_EVENT_HGCM);
     183            }
    160184        }
    161185
  • trunk/src/VBox/Devices/VMMDev/VMMDevState.h

    r3110 r3345  
    7676    /** Current host side event flags */
    7777    uint32_t u32HostEventFlags;
    78     /** Mask of events guest is interested in */
     78    /** Mask of events guest is interested in. Note that the HGCM events
     79     *  are enabled automatically by the VMMDev device when guest issues
     80     *  HGCM commands.
     81     */
    7982    uint32_t u32GuestFilterMask;
    8083    /** Delayed mask of guest events */
     
    145148    /** Critical section to protect the list. */
    146149    RTCRITSECT critsectHGCMCmdList;
     150    /** How many HGCM commands are pending. */
     151    volatile uint32_t u32HGCMRefs;
    147152#endif /* VBOX_HGCM */
    148153
     
    150155
    151156void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask);
     157void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState,
     158                                   uint32_t u32OrMask,
     159                                   uint32_t u32NotMask);
    152160
    153161#endif /* __VMMDevState_h__ */
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