VirtualBox

Changeset 27777 in vbox


Ignore:
Timestamp:
Mar 29, 2010 11:16:43 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59423
Message:

2d: fix to command processing list

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r27760 r27777  
    208208    VBoxVHWACommandProcessEvent ()
    209209        : QEvent ((QEvent::Type) VBoxDefs::VHWACommandProcessType)
    210     {}
     210    {
     211#ifdef DEBUG_misha
     212        g_EventCounter.inc();
     213#endif
     214    }
     215#ifdef DEBUG_misha
     216    ~VBoxVHWACommandProcessEvent()
     217    {
     218        g_EventCounter.dec();
     219    }
     220
     221    static uint32_t cPending() { return g_EventCounter.refs(); }
     222private:
     223    static VBoxVHWARefCounter g_EventCounter;
     224#endif
    211225};
    212226
    213 
     227#ifdef DEBUG_misha
     228VBoxVHWARefCounter VBoxVHWACommandProcessEvent::g_EventCounter;
     229#endif
    214230
    215231VBoxVHWAHandleTable::VBoxVHWAHandleTable(uint32_t initialSize)
     
    46804696        }
    46814697        else
     4698        {
     4699            Assert(pCur->isNewEvent());
    46824700            bFirst = false;
     4701        }
    46834702    } while(1);
    46844703
     
    47214740void VBoxVHWACommandElementProcessor::postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData, uint32_t flags)
    47224741{
    4723     bool bNeedNewEvent = false;
    47244742    QObject *pNotifyObject = NULL;
    47254743    /* 1. lock*/
     
    47444762    if(mbNewEvent || (!mbProcessingList && m_CmdPipe.isEmpty()))
    47454763    {
    4746         pCmd->setNewEventFlag();
    4747         bNeedNewEvent = true;
     4764        pCmd->setNewEvent(true);
    47484765        mbNewEvent = false;
     4766        if (m_pNotifyObject)
     4767        {
     4768            m_NotifyObjectRefs.inc(); /* ensure the parent does not get destroyed while we are using it */
     4769            pNotifyObject = m_pNotifyObject;
     4770#ifdef DEBUG_misha
     4771            checkConsistence();
     4772#endif
     4773        }
     4774    }
     4775    else
     4776    {
     4777        pCmd->setNewEvent(false);
     4778#ifdef DEBUG_misha
     4779        if (m_pNotifyObject)
     4780            checkConsistence();
     4781#endif
    47494782    }
    47504783
    47514784    m_CmdPipe.put(pCmd);
     4785#ifdef DEBUG_misha
     4786    if (m_pNotifyObject)
     4787    {
     4788        checkConsistence(1);
     4789    }
     4790#endif
    47524791
    47534792    if((flags & VBOXVHWACMDPIPEC_COMPLETEEVENT) != 0)
    47544793        mbNewEvent = true;
    4755 
    4756     if (bNeedNewEvent)
    4757     {
    4758         if (m_pNotifyObject)
    4759         {
    4760             m_NotifyObjectRefs.inc(); /* ensure the parent does not get destroyed while we are using it */
    4761             pNotifyObject = m_pNotifyObject;
    4762         }
    4763     }
    47644794
    47654795    RTCritSectLeave(&mCritSect);
     
    47724802    }
    47734803}
     4804
     4805#ifdef DEBUG_misha
     4806void VBoxVHWACommandElementProcessor::checkConsistence(uint32_t cEvents2Submit, const VBoxVHWACommandElementPipe *pPipe)
     4807{
     4808    const VBoxVHWACommandElement *pLast;
     4809    const VBoxVHWACommandElement *pFirst = pPipe ? pPipe->contentsRo(&pLast) : m_CmdPipe.contentsRo(&pLast);
     4810    uint32_t cEvents = 0;
     4811
     4812    for (const VBoxVHWACommandElement * pCur = pFirst; pCur; pCur = pCur->mpNext)
     4813    {
     4814        if (pCur->isNewEvent())
     4815        {
     4816            ++cEvents;
     4817            Assert(cEvents <= VBoxVHWACommandProcessEvent::cPending() + cEvents2Submit);
     4818        }
     4819    }
     4820//    Assert(cEvents == VBoxVHWACommandProcessEvent::cPending());
     4821}
     4822#endif
    47744823
    47754824void VBoxVHWACommandElementProcessor::putBack(class VBoxVHWACommandElement * pFirst2Put, VBoxVHWACommandElement * pLast2Put,
     
    47824831    m_CmdPipe.prepend(pFirst2Put, pLast2Put);
    47834832    mbProcessingList = false;
     4833    Assert(pFirst2Put->isNewEvent());
     4834#ifdef DEBUG_misha
     4835    Assert(VBoxVHWACommandProcessEvent::cPending());
     4836    const VBoxVHWACommandElement *pLast;
     4837    const VBoxVHWACommandElement *pFirst = m_CmdPipe.contentsRo(&pLast);
     4838    Assert(pFirst);
     4839    Assert(pLast);
     4840    Assert(pFirst == pFirst2Put);
     4841    checkConsistence();
     4842#endif
    47844843    RTCritSectLeave(&mCritSect);
    47854844}
     
    48314890    }
    48324891
     4892#ifdef DEBUG_misha
     4893    checkConsistence(cEventsNeeded);
     4894#endif
     4895
    48334896    RTCritSectLeave(&mCritSect);
    48344897
     
    48554918        mFreeElements.pusha(pFirst2Free, pLast2Free);
    48564919    }
     4920
     4921#ifdef DEBUG_misha
     4922    checkConsistence();
     4923#endif
     4924
    48574925    pList = m_CmdPipe.detachList(ppLast);
     4926
    48584927    if (pList)
    48594928    {
     
    48954964    }
    48964965
     4966    Assert(!mbProcessingList);
     4967
    48974968    pipe.prependFrom(&m_CmdPipe);
    48984969
    48994970    if(!pipe.isEmpty())
    4900     {
    49014971        mbProcessingList = true;
    4902         *ppHead = pipe.detachList(ppTail);
    4903     }
    49044972
    49054973    RTCritSectLeave(&mCritSect);
     4974
     4975    *ppHead = pipe.detachList(ppTail);
    49064976}
    49074977
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r27760 r27777  
    12081208    }
    12091209
    1210     void setNewEventFlag() {bNewEvent = true;}
     1210    void setNewEvent(bool bNew) {bNewEvent = bNew;}
    12111211    bool isNewEvent() const { return bNewEvent; }
    12121212
     
    12941294            mpLast->mpNext = pFirst;
    12951295            mpLast = pLast;
     1296            pLast->mpNext = NULL;
    12961297        }
    12971298    }
     
    14131414    void reset(class VBoxVHWACommandElement ** ppHead, class VBoxVHWACommandElement ** ppTail);
    14141415    void setNotifyObject(QObject *pNotifyObject);
     1416#ifdef DEBUG_misha
     1417    void checkConsistence(uint32_t cEvents2Submit = 0, const VBoxVHWACommandElementPipe *pPipe = NULL);
     1418#endif
    14151419private:
    14161420    RTCRITSECT mCritSect;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette