Changeset 34129 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Nov 16, 2010 10:31:39 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r33714 r34129 2739 2739 2740 2740 #ifdef VBOX_WITH_WDDM 2741 if(pCmd->u.in.x UpdatedSrcMemRect.right)2741 if(pCmd->u.in.xFlags & VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_SRCMEMRECT) 2742 2742 { 2743 2743 QRect r = VBOXVHWA_CONSTRUCT_QRECT_FROM_RECTL_WH(&pCmd->u.in.xUpdatedSrcMemRect); 2744 2744 pSrcSurf->updatedMem(&r); 2745 2745 } 2746 if(pCmd->u.in.x UpdatedDstMemRect.right)2746 if(pCmd->u.in.xFlags & VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT) 2747 2747 { 2748 2748 QRect r = VBOXVHWA_CONSTRUCT_QRECT_FROM_RECTL_WH(&pCmd->u.in.xUpdatedDstMemRect); … … 4262 4262 return VINF_SUCCESS; 4263 4263 } 4264 case VBOXVHWACMD_TYPE_HH_ENABLE: 4265 pCmd->Flags &= ~VBOXVHWACMD_FLAG_HG_ASYNCH; 4266 pCmd->rc = VINF_SUCCESS; 4267 return VINF_SUCCESS; 4268 case VBOXVHWACMD_TYPE_HH_DISABLE: 4269 pCmd->Flags &= ~VBOXVHWACMD_FLAG_HG_ASYNCH; 4270 pCmd->rc = VINF_SUCCESS; 4271 return VINF_SUCCESS; 4264 4272 default: 4265 4273 break; … … 4721 4729 int VBoxQGLOverlay::vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version) 4722 4730 { 4723 return VBoxVHWAImage::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version); 4731 int rc = VBoxVHWAImage::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version); 4732 AssertRC(rc); 4733 if (RT_SUCCESS(rc)) 4734 { 4735 rc = mCmdPipe.loadExec(pSSM, u32Version, mOverlayImage.vramBase()); 4736 AssertRC(rc); 4737 } 4738 return rc; 4724 4739 } 4725 4740 4726 4741 void VBoxQGLOverlay::vhwaSaveExec(struct SSMHANDLE * pSSM) 4727 4742 { 4743 mCmdPipe.lock(); 4728 4744 mOverlayImage.vhwaSaveExec(pSSM); 4745 mCmdPipe.saveExec(pSSM, mOverlayImage.vramBase()); 4746 mCmdPipe.unlock(); 4729 4747 } 4730 4748 … … 5104 5122 } 5105 5123 5124 #define VBOXVHWACOMMANDELEMENTLISTBEGIN_MAGIC 0x89abcdef 5125 #define VBOXVHWACOMMANDELEMENTLISTEND_MAGIC 0xfedcba98 5126 5127 int VBoxVHWACommandElementProcessor::loadExec (struct SSMHANDLE * pSSM, uint32_t u32Version, void *pvVRAM) 5128 { 5129 uint32_t u32; 5130 bool b; 5131 int rc; 5132 rc = SSMR3GetU32(pSSM, &u32); 5133 if (RT_SUCCESS(rc)) 5134 { 5135 Assert(u32 == VBOXVHWACOMMANDELEMENTLISTBEGIN_MAGIC); 5136 if (u32 == VBOXVHWACOMMANDELEMENTLISTBEGIN_MAGIC) 5137 { 5138 rc = SSMR3GetU32(pSSM, &u32); 5139 rc = SSMR3GetBool(pSSM, &b); AssertRC(rc); 5140 // m_NotifyObjectRefs = VBoxVHWARefCounter(u32); 5141 bool bContinue = true; 5142 do 5143 { 5144 rc = SSMR3GetU32(pSSM, &u32); AssertRC(rc); 5145 if (RT_SUCCESS(rc)) 5146 { 5147 bool bNewEvent; 5148 switch (u32) 5149 { 5150 case VBOXVHWA_PIPECMD_PAINT: 5151 { 5152 int x,y,w,h; 5153 rc = SSMR3GetS32(pSSM, &x); AssertRC(rc); 5154 rc = SSMR3GetS32(pSSM, &y); AssertRC(rc); 5155 rc = SSMR3GetS32(pSSM, &w); AssertRC(rc); 5156 rc = SSMR3GetS32(pSSM, &h); AssertRC(rc); 5157 5158 rc = SSMR3GetBool(pSSM, &bNewEvent); AssertRC(rc); 5159 5160 if (RT_SUCCESS(rc)) 5161 { 5162 postCmd(VBOXVHWA_PIPECMD_PAINT, &QRect(x,y,w,h), 0); 5163 } 5164 break; 5165 } 5166 case VBOXVHWA_PIPECMD_VHWA: 5167 { 5168 uint32_t offCmd; 5169 rc = SSMR3GetU32(pSSM, &offCmd); AssertRC(rc); 5170 5171 rc = SSMR3GetBool(pSSM, &bNewEvent); AssertRC(rc); 5172 5173 if (RT_SUCCESS(rc)) 5174 { 5175 postCmd(VBOXVHWA_PIPECMD_VHWA, (VBOXVHWACMD*)(((uint8_t*)pvVRAM) + offCmd), 0); 5176 } 5177 break; 5178 } 5179 case VBOXVHWACOMMANDELEMENTLISTEND_MAGIC: 5180 { 5181 bContinue = false; 5182 break; 5183 } 5184 default: 5185 Assert(0); 5186 break; 5187 } 5188 5189 } 5190 5191 } while(bContinue && RT_SUCCESS(rc)); 5192 } 5193 else 5194 { 5195 rc = VERR_INVALID_MAGIC; 5196 } 5197 } 5198 else if (rc == VERR_SSM_LOADED_TOO_MUCH) 5199 { 5200 /* this would mean we do not have a cmd pipe data saved. 5201 * skip the failure. 5202 * not sure if that's a good idea actually, 5203 * but this allows keeping the state version unchanged */ 5204 rc = VINF_SUCCESS; 5205 } 5206 5207 return rc; 5208 } 5209 5210 void VBoxVHWACommandElementProcessor::saveExec (struct SSMHANDLE * pSSM, void *pvVRAM) 5211 { 5212 int rc; 5213 5214 rc = SSMR3PutU32(pSSM, VBOXVHWACOMMANDELEMENTLISTBEGIN_MAGIC); AssertRC(rc); 5215 rc = SSMR3PutU32(pSSM, m_NotifyObjectRefs.refs()); AssertRC(rc); 5216 rc = SSMR3PutBool(pSSM, mbNewEvent); AssertRC(rc); 5217 5218 const VBoxVHWACommandElement * pCur = m_CmdPipe.contentsRo(NULL); 5219 for (;pCur; pCur = pCur->mpNext) 5220 { 5221 rc = SSMR3PutU32(pSSM, pCur->type()); AssertRC(rc); 5222 5223 switch (pCur->type()) 5224 { 5225 case VBOXVHWA_PIPECMD_PAINT: 5226 rc = SSMR3PutS32(pSSM, pCur->rect().x()); AssertRC(rc); 5227 rc = SSMR3PutS32(pSSM, pCur->rect().y()); AssertRC(rc); 5228 rc = SSMR3PutS32(pSSM, pCur->rect().width()); AssertRC(rc); 5229 rc = SSMR3PutS32(pSSM, pCur->rect().height()); AssertRC(rc); 5230 rc = SSMR3PutBool(pSSM, pCur->isNewEvent()); AssertRC(rc); 5231 break; 5232 case VBOXVHWA_PIPECMD_VHWA: 5233 { 5234 rc = SSMR3PutU32(pSSM, (uint32_t)((uintptr_t)((uint8_t*)pCur->vhwaCmd() - (uint8_t*)pvVRAM))); AssertRC(rc); 5235 rc = SSMR3PutBool(pSSM, pCur->isNewEvent()); AssertRC(rc); 5236 break; 5237 } 5238 default: 5239 Assert(0); 5240 break; 5241 } 5242 } 5243 5244 rc = SSMR3PutU32(pSSM, VBOXVHWACOMMANDELEMENTLISTEND_MAGIC); AssertRC(rc); 5245 } 5246 5247 void VBoxVHWACommandElementProcessor::lock() 5248 { 5249 RTCritSectEnter(&mCritSect); 5250 5251 if(mbProcessingList) 5252 { 5253 for(;;) 5254 { 5255 RTCritSectLeave(&mCritSect); 5256 RTThreadSleep(2000); /* 2 ms */ 5257 RTCritSectEnter(&mCritSect); 5258 /* it is assumed no one sends any new commands while reset is in progress */ 5259 if(!mbProcessingList) 5260 { 5261 break; 5262 } 5263 } 5264 } 5265 5266 Assert(!mbProcessingList); 5267 } 5268 5269 void VBoxVHWACommandElementProcessor::unlock() 5270 { 5271 RTCritSectLeave(&mCritSect); 5272 } 5273 5106 5274 VBoxVHWATextureImage::VBoxVHWATextureImage(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, VBOXVHWAIMG_TYPE flags) : 5107 5275 mVisibleDisplay(0), -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
r33540 r34129 1318 1318 } 1319 1319 1320 1321 1320 1322 const VBoxVHWACommandElement * contentsRo (const VBoxVHWACommandElement **ppLast) const 1321 1323 { … … 1326 1328 1327 1329 bool isEmpty() const { return !mpLast; } 1330 1328 1331 private: 1329 1332 VBoxVHWACommandElement *mpFirst; … … 1368 1371 public: 1369 1372 VBoxVHWARefCounter() : m_cRefs(0) {} 1373 VBoxVHWARefCounter(uint32_t cRefs) : m_cRefs(cRefs) {} 1370 1374 void inc() { ASMAtomicIncU32(&m_cRefs); } 1371 1375 uint32_t dec() … … 1418 1422 void reset(class VBoxVHWACommandElement ** ppHead, class VBoxVHWACommandElement ** ppTail); 1419 1423 void setNotifyObject(QObject *pNotifyObject); 1424 int loadExec (struct SSMHANDLE * pSSM, uint32_t u32Version, void *pvVRAM); 1425 void saveExec (struct SSMHANDLE * pSSM, void *pvVRAM); 1426 void lock(); 1427 void unlock(); 1420 1428 #ifdef DEBUG_misha 1421 1429 void checkConsistence(uint32_t cEvents2Submit = 0, const VBoxVHWACommandElementPipe *pPipe = NULL);
Note:
See TracChangeset
for help on using the changeset viewer.