Changeset 30532 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jun 30, 2010 3:55:53 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispCm.cpp
r30483 r30532 160 160 } 161 161 162 static HRESULT vboxDispCmSessionCmdQueryData(PVBOXDISPCM_SESSION pSession, PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD pCmd, uint32_t cbCmd) 163 { 164 165 HRESULT hr = S_OK; 166 D3DDDICB_ESCAPE DdiEscape; 167 DdiEscape.Flags.Value = 0; 168 DdiEscape.pPrivateDriverData = pCmd; 169 DdiEscape.PrivateDriverDataSize = cbCmd; 170 171 pCmd->EscapeHdr.escapeCode = VBOXESC_GETVBOXVIDEOCMCMD; 172 /* lock to ensure the context is not distructed */ 173 EnterCriticalSection(&pSession->CritSect); 174 /* use any context for identifying the kernel CmSession. We're using the first one */ 175 PVBOXWDDMDISP_CONTEXT pContext = RTListNodeGetFirst(&pSession->CtxList, VBOXWDDMDISP_CONTEXT, ListNode); 176 if (pContext) 177 { 178 PVBOXWDDMDISP_DEVICE pDevice = pContext->pDevice; 179 DdiEscape.hDevice = pDevice->hDevice; 180 DdiEscape.hContext = pContext->ContextInfo.hContext; 181 Assert (DdiEscape.hContext); 182 Assert (DdiEscape.hDevice); 183 hr = pDevice->RtCallbacks.pfnEscapeCb(pDevice->pAdapter->hAdapter, &DdiEscape); 184 LeaveCriticalSection(&pSession->CritSect); 185 Assert(hr == S_OK); 186 if (hr == S_OK) 187 { 188 if (!pCmd->Hdr.cbCmdsReturned && !pCmd->Hdr.cbRemainingFirstCmd) 189 hr = S_FALSE; 190 } 191 } 192 else 193 { 194 LeaveCriticalSection(&pSession->CritSect); 195 hr = S_FALSE; 196 } 197 198 return hr; 199 } 200 162 201 HRESULT vboxDispCmSessionCmdGet(PVBOXDISPCM_SESSION pSession, PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD pCmd, uint32_t cbCmd, DWORD dwMilliseconds) 163 202 { … … 168 207 do 169 208 { 209 HRESULT hr = vboxDispCmSessionCmdQueryData(pSession, pCmd, cbCmd); 210 Assert(hr == S_OK || hr == S_FALSE); 211 if (hr == S_OK || hr != S_FALSE) 212 return hr; 213 170 214 DWORD dwResult = WaitForSingleObject(pSession->hEvent, dwMilliseconds); 171 215 switch(dwResult) … … 173 217 case WAIT_OBJECT_0: 174 218 { 175 HRESULT hr = S_OK; 176 D3DDDICB_ESCAPE DdiEscape; 177 DdiEscape.Flags.Value = 0; 178 DdiEscape.pPrivateDriverData = pCmd; 179 DdiEscape.PrivateDriverDataSize = cbCmd; 180 181 pCmd->EscapeHdr.escapeCode = VBOXESC_GETVBOXVIDEOCMCMD; 182 /* lock to ensure the context is not distructed */ 183 EnterCriticalSection(&pSession->CritSect); 184 /* use any context for identifying the kernel CmSession. We're using the first one */ 185 PVBOXWDDMDISP_CONTEXT pContext = RTListNodeGetFirst(&pSession->CtxList, VBOXWDDMDISP_CONTEXT, ListNode); 186 if (pContext) 187 { 188 PVBOXWDDMDISP_DEVICE pDevice = pContext->pDevice; 189 DdiEscape.hDevice = pDevice->hDevice; 190 DdiEscape.hContext = pContext->ContextInfo.hContext; 191 Assert (DdiEscape.hContext); 192 Assert (DdiEscape.hDevice); 193 hr = pDevice->RtCallbacks.pfnEscapeCb(pDevice->pAdapter->hAdapter, &DdiEscape); 194 LeaveCriticalSection(&pSession->CritSect); 195 Assert(hr == S_OK); 196 if (hr == S_OK) 197 { 198 if (!pCmd->Hdr.cbCmdsReturned && !pCmd->Hdr.cbRemainingFirstCmd) 199 break; /* <- break to enter a new wait cycle */ 200 } 201 } 202 else 203 { 204 LeaveCriticalSection(&pSession->CritSect); 205 pCmd->Hdr.cbCmdsReturned = 0; 206 pCmd->Hdr.cbRemainingCmds = 0; 207 pCmd->Hdr.cbRemainingFirstCmd = 0; 208 } 209 210 return hr; 219 break; /* <- query commands */ 211 220 } 212 221 case WAIT_TIMEOUT: 213 222 { 214 pCmd->Hdr.cbCmdsReturned = 0;215 pCmd->Hdr.cbRemainingCmds = 0;216 pCmd->Hdr.cbRemainingFirstCmd = 0;217 223 return WAIT_TIMEOUT; 218 224 } … … 222 228 } 223 229 } while (1); 230 231 /* should never be here */ 232 AssertBreakpoint(); 233 return E_FAIL; 224 234 } 225 235 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.cpp
r30505 r30532 96 96 { 97 97 hr = vboxDispCmCmdGet(g_VBoxDispMp.pEscapeCmd, g_VBoxDispMp.cbEscapeCmd, dwMilliseconds); 98 Assert(hr == S_OK );98 Assert(hr == S_OK || (dwMilliseconds != INFINITE && hr == WAIT_TIMEOUT)); 99 99 if (hr == S_OK) 100 100 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r30515 r30532 309 309 PVBOXWDDM_CONTEXT pContext = pRectsInfo->pContext; 310 310 PDEVICE_EXTENSION pDevExt = pContext->pDevice->pAdapter; 311 RECT * pContextRect = &pRectsInfo->ContextsRects.ContextRect;312 311 PVBOXWDDM_RECTS_INFO pRects = &pRectsInfo->ContextsRects.UpdateRects; 313 312 NTSTATUS Status = STATUS_SUCCESS; … … 342 341 Assert(pCmd->fFlags.Value == 0); 343 342 pCmd->fFlags.bAddHiddenRects = 1; 344 if (pC ontext->pLastReportedRects)343 if (pCurContext->pLastReportedRects) 345 344 { 346 if (pC ontext->pLastReportedRects->fFlags.bSetVisibleRects)345 if (pCurContext->pLastReportedRects->fFlags.bSetVisibleRects) 347 346 { 348 347 RECT *paPrevRects; 349 348 uint32_t cPrevRects; 350 if (pC ontext->pLastReportedRects->fFlags.bSetViewRect)349 if (pCurContext->pLastReportedRects->fFlags.bSetViewRect) 351 350 { 352 paPrevRects = &pC ontext->pLastReportedRects->RectsInfo.aRects[1];353 cPrevRects = pC ontext->pLastReportedRects->RectsInfo.cRects - 1;351 paPrevRects = &pCurContext->pLastReportedRects->RectsInfo.aRects[1]; 352 cPrevRects = pCurContext->pLastReportedRects->RectsInfo.cRects - 1; 354 353 } 355 354 else 356 355 { 357 paPrevRects = &pC ontext->pLastReportedRects->RectsInfo.aRects[0];358 cPrevRects = pC ontext->pLastReportedRects->RectsInfo.cRects;356 paPrevRects = &pCurContext->pLastReportedRects->RectsInfo.aRects[0]; 357 cPrevRects = pCurContext->pLastReportedRects->RectsInfo.cRects; 359 358 } 360 359 … … 366 365 else 367 366 { 368 Assert(pC ontext->pLastReportedRects->fFlags.bAddHiddenRects);369 if (!vboxVdmaDirtyRectsIsCover(pC ontext->pLastReportedRects->RectsInfo.aRects,370 pC ontext->pLastReportedRects->RectsInfo.cRects,367 Assert(pCurContext->pLastReportedRects->fFlags.bAddHiddenRects); 368 if (!vboxVdmaDirtyRectsIsCover(pCurContext->pLastReportedRects->RectsInfo.aRects, 369 pCurContext->pLastReportedRects->RectsInfo.cRects, 371 370 pCmd->RectsInfo.aRects, pCmd->RectsInfo.cRects)) 372 371 { … … 380 379 if (bSend) 381 380 { 382 if (pC ontext->pLastReportedRects)383 vboxVideoCmCmdRelease(pC ontext->pLastReportedRects);381 if (pCurContext->pLastReportedRects) 382 vboxVideoCmCmdRelease(pCurContext->pLastReportedRects); 384 383 vboxVideoCmCmdRetain(pCmd); 385 pC ontext->pLastReportedRects = pCmd;384 pCurContext->pLastReportedRects = pCmd; 386 385 vboxVideoCmCmdSubmit(pCmd, VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS(pCmd->RectsInfo.cRects)); 387 386 pCmd = NULL; … … 391 390 else 392 391 { 392 RECT * pContextRect = &pRectsInfo->ContextsRects.ContextRect; 393 393 bool bRectShanged = (pContext->ViewRect.left != pContextRect->left 394 394 || pContext->ViewRect.top != pContextRect->top … … 396 396 || pContext->ViewRect.bottom != pContextRect->bottom); 397 397 PVBOXVIDEOCM_CMD_RECTS pDrCmd; 398 399 bool bSend = false; 398 400 399 401 if (bRectShanged) … … 407 409 break; 408 410 } 411 pDrCmd->fFlags.Value = 0; 409 412 pDrCmd->RectsInfo.cRects = pRects->cRects + 1; 413 pDrCmd->fFlags.bSetViewRect = 1; 414 pDrCmd->RectsInfo.aRects[0] = *pContextRect; 415 pContext->ViewRect = *pContextRect; 416 memcpy(&pDrCmd->RectsInfo.aRects[1], pRects->aRects, sizeof (RECT) * pRects->cRects); 417 bSend = true; 410 418 } 411 419 else … … 426 434 } 427 435 } 436 pDrCmd->fFlags.Value = 0; 428 437 pDrCmd->RectsInfo.cRects = pRects->cRects; 429 } 430 431 Assert(pDrCmd->fFlags.Value == 0); 432 RECT *pDirtyRect; 433 bool bSend = false; 434 if (bRectShanged) 435 { 436 pDrCmd->fFlags.bSetViewRect = 1; 437 pDrCmd->RectsInfo.aRects[0] = *pContextRect; 438 pDirtyRect = &pDrCmd->RectsInfo.aRects[1]; 439 pContext->ViewRect = *pContextRect; 440 bSend = true; 441 } 442 else 443 { 444 pDirtyRect = pDrCmd->RectsInfo.aRects; 438 memcpy(&pDrCmd->RectsInfo.aRects[0], pRects->aRects, sizeof (RECT) * pRects->cRects); 445 439 446 440 if (pContext->pLastReportedRects) … … 460 454 cRects = pContext->pLastReportedRects->RectsInfo.cRects; 461 455 } 462 bSend = (pDrCmd->RectsInfo.cRects == cRects)463 && !memcmp(paRects, pDrCmd->RectsInfo.aRects, cRects * sizeof (RECT));456 bSend = (pDrCmd->RectsInfo.cRects != cRects) 457 || memcmp(paRects, pDrCmd->RectsInfo.aRects, cRects * sizeof (RECT)); 464 458 } 465 459 else … … 481 475 482 476 pDrCmd->fFlags.bSetVisibleRects = 1; 483 memcpy (pDirtyRect, pRects->aRects, sizeof (RECT) * pRects->cRects);484 477 485 478 vboxVideoCmCmdRetain(pDrCmd);
Note:
See TracChangeset
for help on using the changeset viewer.