Changeset 24162 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 29, 2009 3:25:14 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54101
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
r23766 r24162 919 919 void completeCurrentEvent(); 920 920 class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free); 921 921 void reset(class VBoxVHWACommandElement ** ppHead, class VBoxVHWACommandElement ** ppTail); 922 922 private: 923 923 RTCRITSECT mCritSect; … … 926 926 class VBoxConsoleView *mView; 927 927 bool mbNewEvent; 928 bool mbProcessingList; 928 929 VBoxVHWACommandElementStack mFreeElements; 929 930 VBoxVHWACommandElement mElementsBuffer[2048]; … … 1247 1248 1248 1249 int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd); 1250 1251 int reset(); 1249 1252 1250 1253 VBoxGLWidget *mpOverlayWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r24044 r24162 4724 4724 } 4725 4725 4726 int VBoxQGLOverlay::reset() 4727 { 4728 VBoxVHWACommandElement * pHead, * pTail; 4729 mCmdPipe.reset(&pHead, &pTail); 4730 if(pHead) 4731 { 4732 CDisplay display = mView->console().GetDisplay(); 4733 Assert (!display.isNull()); 4734 4735 /* complete aborted commands */ 4736 for(VBoxVHWACommandElement * pCur = pHead; pCur; pCur = pCur->mpNext) 4737 { 4738 switch(pCur->type()) 4739 { 4740 #ifdef VBOX_WITH_VIDEOHWACCEL 4741 case VBOXVHWA_PIPECMD_VHWA: 4742 { 4743 struct _VBOXVHWACMD * pCmd = pCur->vhwaCmd(); 4744 pCmd->rc = VERR_INVALID_STATE; 4745 display.CompleteVHWACommand((BYTE*)pCmd); 4746 } 4747 break; 4748 case VBOXVHWA_PIPECMD_OP: 4749 /* should not happen, don't handle this for now */ 4750 Assert(0); 4751 break; 4752 case VBOXVHWA_PIPECMD_FUNC: 4753 /* should not happen, don't handle this for now */ 4754 Assert(0); 4755 break; 4756 #endif 4757 } 4758 } 4759 4760 VBoxVHWACommandElement *pTest = mCmdPipe.detachCmdList(pHead, pTail); 4761 Assert(!pTest); 4762 NOREF(pTest); 4763 } 4764 return VINF_SUCCESS; 4765 } 4766 4726 4767 int VBoxQGLOverlay::onVHWACommand(struct _VBOXVHWACMD * pCmd) 4727 4768 { … … 4734 4775 flags |= VBOXVHWACMDPIPEC_COMPLETEEVENT; 4735 4776 break; 4777 case VBOXVHWACMD_TYPE_HH_RESET: 4778 { 4779 /* we do not post a reset command to the gui thread since this may lead to a deadlock 4780 * when reset is initiated by the gui thread*/ 4781 pCmd->Flags &= ~VBOXVHWACMD_FLAG_HG_ASYNCH; 4782 pCmd->rc = reset(); 4783 return VINF_SUCCESS; 4784 } 4736 4785 default: 4737 4786 break; … … 5301 5350 5302 5351 5303 VBoxVHWACommandElementProcessor::VBoxVHWACommandElementProcessor(VBoxConsoleView *aView) 5352 VBoxVHWACommandElementProcessor::VBoxVHWACommandElementProcessor(VBoxConsoleView *aView) : 5353 mpFirstEvent (NULL), 5354 mpLastEvent (NULL), 5355 mbNewEvent (false), 5356 mbProcessingList (false) 5304 5357 { 5305 5358 int rc = RTCritSectInit(&mCritSect); 5306 5359 AssertRC(rc); 5307 5360 5308 mpFirstEvent = NULL;5309 mpLastEvent = NULL;5310 mbNewEvent = false;5311 5361 mView = aView; 5362 5312 5363 for(int i = RT_ELEMENTS(mElementsBuffer) - 1; i >= 0; i--) 5313 5364 { … … 5408 5459 { 5409 5460 pList = mpFirstEvent->pipe().detachList(); 5410 if(!pList) 5461 if(pList) 5462 { 5463 /* assume the caller atimically calls detachCmdList to free the elements obtained now those and reset the state */ 5464 mbProcessingList = true; 5465 RTCritSectLeave(&mCritSect); 5466 return pList; 5467 } 5468 else 5411 5469 { 5412 5470 VBoxVHWACommandProcessEvent *pNext = mpFirstEvent->mpNext; … … 5422 5480 } 5423 5481 } 5482 5483 /* assume the caller atimically calls detachCmdList to free the elements obtained now those and reset the state */ 5484 mbProcessingList = false; 5424 5485 RTCritSectLeave(&mCritSect); 5425 5426 return pList; 5427 } 5428 5486 return NULL; 5487 } 5488 5489 /* it is currently assumed no one sends any new commands while reset is in progress */ 5490 void VBoxVHWACommandElementProcessor::reset(VBoxVHWACommandElement ** ppHead, VBoxVHWACommandElement ** ppTail) 5491 { 5492 VBoxVHWACommandElement * pHead = NULL; 5493 VBoxVHWACommandElement * pTail = NULL; 5494 VBoxVHWACommandProcessEvent * pFirst; 5495 VBoxVHWACommandProcessEvent * pLast; 5496 RTCritSectEnter(&mCritSect); 5497 pFirst = mpFirstEvent; 5498 pLast = mpLastEvent; 5499 mpFirstEvent = NULL; 5500 mpLastEvent = NULL; 5501 5502 if(mbProcessingList) 5503 { 5504 for(;;) 5505 { 5506 RTCritSectLeave(&mCritSect); 5507 RTThreadSleep(2000); /* 2 ms */ 5508 RTCritSectEnter(&mCritSect); 5509 /* it is assumed no one sends any new commands while reset is in progress */ 5510 Assert(!mpFirstEvent); 5511 Assert(!mpLastEvent); 5512 if(!mbProcessingList) 5513 { 5514 break; 5515 } 5516 } 5517 } 5518 5519 if(pFirst) 5520 { 5521 Assert(pLast); 5522 pHead = pFirst->pipe().detachList(); 5523 VBoxVHWACommandElement * pCurHead; 5524 for(VBoxVHWACommandProcessEvent * pCur = pFirst; pCur ; pCur = pCur->mpNext) 5525 { 5526 pCurHead = pCur->pipe().detachList(); 5527 if(!pCurHead) 5528 continue; 5529 if(!pHead) 5530 pHead = pCurHead; 5531 if(pTail) 5532 pTail->mpNext = pCurHead; 5533 5534 for(VBoxVHWACommandElement * pCurEl = pCurHead; pCurEl; pCurEl = pCurEl->mpNext) 5535 { 5536 pTail = pCurEl; 5537 } 5538 } 5539 5540 if(!pTail) 5541 pTail = pHead; 5542 } 5543 5544 if(pHead) 5545 mbProcessingList = true; 5546 5547 RTCritSectLeave(&mCritSect); 5548 5549 *ppHead = pHead; 5550 *ppTail = pTail; 5551 } 5429 5552 5430 5553 void VBoxVHWACommandsQueue::enqueue(PFNVBOXQGLFUNC pfn, void* pContext1, void* pContext2)
Note:
See TracChangeset
for help on using the changeset viewer.