third_party/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp
/* Called always by one VRDP server thread. Can be thread-unsafe.
 */
Called always by one VRDP server thread. Can be thread-unsafe.
Called always by one VRDP server thread . Can be thread - unsafe .
void Display::i_VideoAccelVRDP(bool fEnable)
{
    LogRelFlowFunc(("fEnable = %d\n", fEnable));
    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
    int c = fEnable?
                ASMAtomicIncS32(&mcVideoAccelVRDPRefs):
                ASMAtomicDecS32(&mcVideoAccelVRDPRefs);
    Assert (c >= 0);
    RTCritSectEnter(&mVideoAccelLock);
    if (c == 0)
    {
        Assert(fEnable == false);
        mfVideoAccelVRDP = false;
        mfu32SupportedOrders = 0;
        i_vbvaSetMemoryFlags(pVideoAccel->pVbvaMemory, pVideoAccel->fVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders,
                             maFramebuffers, mcMonitors);
#ifdef VBOX_WITH_HGSMI
        ASMAtomicIncU32(&mu32UpdateVBVAFlags);
#endif 
        LogRel(("VBVA: VRDP acceleration has been disabled.\n"));
    }
    else if (   c == 1
             && !mfVideoAccelVRDP)
    {
        Assert(fEnable == true);
        mfVideoAccelVRDP = true;
        mfu32SupportedOrders = UINT32_MAX;
        i_vbvaSetMemoryFlags(pVideoAccel->pVbvaMemory, pVideoAccel->fVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders,
                             maFramebuffers, mcMonitors);
#ifdef VBOX_WITH_HGSMI
        ASMAtomicIncU32(&mu32UpdateVBVAFlags);
#endif 
        LogRel(("VBVA: VRDP acceleration has been requested.\n"));
    }
    else
    {
        Assert(mfVideoAccelVRDP == true);
    }
    RTCritSectLeave(&mVideoAccelLock);
}
void Display :: i_VideoAccelVRDP ( bool fEnable ) { LogRelFlowFunc ( ( " \n " , fEnable ) ) ; VIDEOACCEL * pVideoAccel = & mVideoAccelLegacy ; int c = fEnable ? ASMAtomicIncS32 ( & mcVideoAccelVRDPRefs ) : ASMAtomicDecS32 ( & mcVideoAccelVRDPRefs ) ; Assert ( c >= 0 ) ; RTCritSectEnter ( & mVideoAccelLock ) ; if ( c == 0 ) { Assert ( fEnable == false ) ; mfVideoAccelVRDP = false ; mfu32SupportedOrders = 0 ; i_vbvaSetMemoryFlags ( pVideoAccel -> pVbvaMemory , pVideoAccel -> fVideoAccelEnabled , mfVideoAccelVRDP , mfu32SupportedOrders , maFramebuffers , mcMonitors ) ; #ifdef VBOX_WITH_HGSMI ASMAtomicIncU32 ( & mu32UpdateVBVAFlags ) ; #endif LogRel ( ( " \n " ) ) ; } else if ( c == 1 && ! mfVideoAccelVRDP ) { Assert ( fEnable == true ) ; mfVideoAccelVRDP = true ; mfu32SupportedOrders = UINT32_MAX ; i_vbvaSetMemoryFlags ( pVideoAccel -> pVbvaMemory , pVideoAccel -> fVideoAccelEnabled , mfVideoAccelVRDP , mfu32SupportedOrders , maFramebuffers , mcMonitors ) ; #ifdef VBOX_WITH_HGSMI ASMAtomicIncU32 ( & mu32UpdateVBVAFlags ) ; #endif LogRel ( ( " \n " ) ) ; } else { Assert ( mfVideoAccelVRDP == true ) ; } RTCritSectLeave ( & mVideoAccelLock ) ; }
Called always by one VRDP server thread.
Called always by one VRDP server thread .
/* This can run concurrently with Display videoaccel state change. */ /* The last client has disconnected, and the accel can be
         * disabled.
         */ /* Here is VRDP-IN thread. Process the request in vbvaUpdateBegin under DevVGA lock on an EMT. */ /* VBOX_WITH_HGSMI */ /* The first client has connected. Enable the accel.
         */ /* Supporting all orders. */ /* Here is VRDP-IN thread. Process the request in vbvaUpdateBegin under DevVGA lock on an EMT. */ /* VBOX_WITH_HGSMI */ /* A client is connected or disconnected but there is no change in the
         * accel state. It remains enabled.
         */