Changeset 30953 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Timestamp:
- Jul 21, 2010 12:02:06 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r30942 r30953 306 306 FAST_MUTEX ContextMutex; 307 307 volatile uint32_t cContexts3D; 308 volatile uint32_t cDMACmdsOutstanding; 308 309 309 310 VBOXSHGSMILIST CtlList; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
r30865 r30953 374 374 } 375 375 376 DECLINLINE(bool) vboxWddmRectIsEmpty(RECT * pRect) 377 { 378 return pRect->left == pRect->right-1 && pRect->top == pRect->bottom-1; 379 } 380 381 DECLINLINE(bool) vboxWddmRectIsIntersect(RECT * pRect1, RECT * pRect2) 382 { 383 return !((pRect1->left < pRect2->left && pRect1->right < pRect2->left) 384 || (pRect2->left < pRect1->left && pRect2->right < pRect1->left) 385 || (pRect1->top < pRect2->top && pRect1->bottom < pRect2->top) 386 || (pRect2->top < pRect1->top && pRect2->bottom < pRect1->top)); 387 } 388 389 DECLINLINE(bool) vboxWddmRectIsInclude(RECT * pRect1, RECT * pRect2) 390 { 391 return ((pRect1->left <= pRect2->left && pRect1->right >= pRect2->right) 392 && (pRect1->top <= pRect2->top && pRect1->bottom >= pRect2->bottom)); 393 } 394 395 DECLINLINE(void) vboxWddmRectUnited(RECT * pDst, const RECT * pRect1, const RECT * pRect2) 396 { 397 pDst->left = RT_MIN(pRect1->left, pRect2->left); 398 pDst->top = RT_MIN(pRect1->top, pRect2->top); 399 pDst->right = RT_MAX(pRect1->right, pRect2->right); 400 pDst->bottom = RT_MAX(pRect1->bottom, pRect2->bottom); 401 } 402 403 DECLINLINE(void) vboxWddmRectTranslate(RECT * pRect, int x, int y) 404 { 405 pRect->left += x; 406 pRect->top += y; 407 pRect->right += x; 408 pRect->bottom += y; 409 } 410 376 411 DECLINLINE(void) vboxWddmDirtyRegionAddRect(PVBOXWDDM_DIRTYREGION pInfo, const RECT *pRect) 377 412 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.cpp
r29798 r30953 103 103 { 104 104 memset(pVbva, 0, sizeof(VBOXVBVAINFO)); 105 106 KeInitializeSpinLock(&pVbva->Lock); 107 105 108 int rc = VBoxMapAdapterMemory (pDevExt, 106 109 (void**)&pVbva->pVBVA, -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.h
r29798 r30953 21 21 VBVARECORD *pRecord; 22 22 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId; 23 KSPIN_LOCK Lock; 23 24 } VBOXVBVAINFO; 24 25 … … 33 34 34 35 #define VBOXVBVA_OP(_op, _pdext, _pvbva, _arg) \ 35 if (vboxVbvaBufferBeginUpdate(_pdext, _pvbva)) \ 36 { \ 37 vboxVbva##_op(_pdext, _pvbva, _arg); \ 38 vboxVbvaBufferEndUpdate(_pdext, _pvbva); \ 39 } 36 do { \ 37 if (vboxVbvaBufferBeginUpdate(_pdext, _pvbva)) \ 38 { \ 39 vboxVbva##_op(_pdext, _pvbva, _arg); \ 40 vboxVbvaBufferEndUpdate(_pdext, _pvbva); \ 41 } \ 42 } while (0) 43 44 #define VBOXVBVA_OP_WITHLOCK_ATDPC(_op, _pdext, _pvbva, _arg) \ 45 do { \ 46 KeAcquireSpinLockAtDpcLevel(&(_pvbva)->Lock); \ 47 VBOXVBVA_OP(_op, _pdext, _pvbva, _arg); \ 48 KeReleaseSpinLockFromDpcLevel(&(_pvbva)->Lock);\ 49 } while (0) 50 51 #define VBOXVBVA_OP_WITHLOCK(_op, _pdext, _pvbva, _arg) \ 52 do { \ 53 KIRQL OldIrql; \ 54 KeAcquireSpinLock(&(_pvbva)->Lock, &OldIrql); \ 55 VBOXVBVA_OP(_op, _pdext, _pvbva, _arg); \ 56 KeReleaseSpinLock(&(_pvbva)->Lock, OldIrql); \ 57 } while (0) 58 40 59 41 60 #endif /* #ifndef ___VBoxVideoVbva_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r30942 r30953 19 19 #include "../VBoxVideo.h" 20 20 21 #include <iprt/asm.h> 21 22 22 23 NTSTATUS vboxVdmaPipeConstruct(PVBOXVDMAPIPE pPipe) … … 508 509 if (pAlloc->offVram != VBOXVIDEOOFFSET_VOID) 509 510 { 511 RECT UnionRect = {0}; 510 512 uint8_t *pvMem = pDevExt->pvVisibleVram + pAlloc->offVram; 511 513 UINT bpp = pAlloc->SurfDesc.bpp; … … 534 536 } 535 537 } 538 vboxWddmRectUnited(&UnionRect, &UnionRect, pRect); 536 539 } 537 540 Status = STATUS_SUCCESS; … … 544 547 break; 545 548 } 546 } 547 } 549 550 if (Status == STATUS_SUCCESS) 551 { 552 if (pCF->VidPnSourceId != D3DDDI_ID_UNINITIALIZED 553 && pAlloc->bAssigned 554 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 555 && pAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE 556 #else 557 && pAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 558 #endif 559 ) 560 { 561 if (!vboxWddmRectIsEmpty(&UnionRect)) 562 { 563 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pCF->VidPnSourceId]; 564 VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, &pSource->Vbva, &UnionRect); 565 } 566 } 567 } 568 } 569 } 570 571 572 uint32_t cNew = ASMAtomicDecU32(&pDevExt->cDMACmdsOutstanding); 573 Assert(cNew < UINT32_MAX/2); 548 574 549 575 NTSTATUS cmplStatus = vboxWddmDmaCmdNotifyCompletion(pDevExt, pContext, pCF->SubmissionFenceId); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
r30942 r30953 88 88 struct VBOXWDDM_ALLOCATION *pAllocation; 89 89 UINT SubmissionFenceId; 90 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 90 91 UINT Color; 91 92 VBOXWDDM_RECTS_INFO Rects; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r30942 r30953 223 223 224 224 return true; 225 }226 227 bool vboxWddmRectIsEmpty(RECTL * pRect)228 {229 return pRect->left == pRect->right-1 && pRect->top == pRect->bottom-1;230 }231 232 bool vboxWddmRectIntersect(RECTL * pRect1, RECTL * pRect2)233 {234 return !((pRect1->left < pRect2->left && pRect1->right < pRect2->left)235 || (pRect2->left < pRect1->left && pRect2->right < pRect1->left)236 || (pRect1->top < pRect2->top && pRect1->bottom < pRect2->top)237 || (pRect2->top < pRect1->top && pRect2->bottom < pRect1->top));238 }239 240 bool vboxWddmRectInclude(RECTL * pRect1, RECTL * pRect2)241 {242 return ((pRect1->left <= pRect2->left && pRect1->right >= pRect2->right)243 && (pRect1->top <= pRect2->top && pRect1->bottom >= pRect2->bottom));244 }245 246 void vboxWddmRectUnited(RECT * pDst, const RECT * pRect1, const RECT * pRect2)247 {248 pDst->left = RT_MIN(pRect1->left, pRect2->left);249 pDst->top = RT_MIN(pRect1->top, pRect2->top);250 pDst->right = RT_MAX(pRect1->right, pRect2->right);251 pDst->bottom = RT_MAX(pRect1->bottom, pRect2->bottom);252 }253 254 void vboxWddmRectTranslate(RECTL * pRect, int x, int y)255 {256 pRect->left += x;257 pRect->top += y;258 pRect->right += x;259 pRect->bottom += y;260 225 } 261 226 #endif … … 2115 2080 vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pPrivateData->SrcAllocInfo.segmentIdAlloc, pPrivateData->SrcAllocInfo.offAlloc); 2116 2081 PVBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW pRFS = (PVBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW)pPrivateData; 2117 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &pRFS->rect); 2082 uint32_t cDMACmdsOutstanding = ASMAtomicReadU32(&pDevExt->cDMACmdsOutstanding); 2083 if (!cDMACmdsOutstanding) 2084 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &pRFS->rect); 2085 else 2086 { 2087 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); 2088 VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, &pSource->Vbva, &pRFS->rect); 2089 } 2118 2090 /* get DPC data at IRQL */ 2119 2091 … … 2160 2132 rect = pBlt->DstRects.ContextRect; 2161 2133 2162 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 2134 uint32_t cDMACmdsOutstanding = ASMAtomicReadU32(&pDevExt->cDMACmdsOutstanding); 2135 if (!cDMACmdsOutstanding) 2136 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 2137 else 2138 { 2139 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); 2140 VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 2141 } 2163 2142 vboxWddmSubmitBltCmd(pDevExt, pContext, pBlt); 2164 2143 break; … … 2241 2220 PVBOXWDDM_ALLOCATION pDstAlloc = pPrivateData->DstAllocInfo.pAlloc; 2242 2221 Assert(pDstAlloc); 2222 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 2243 2223 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 2244 2224 && pDstAlloc->bAssigned) 2245 2225 { 2226 VidPnSourceId = pPrivateData->DstAllocInfo.srcId; 2227 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 2246 2228 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->DstAllocInfo.srcId]; 2247 2229 Assert(pSource->pPrimaryAllocation == pDstAlloc); … … 2250 2232 if (pSource->pShadowAllocation) 2251 2233 pDstAlloc = pSource->pShadowAllocation; 2234 #endif 2235 } 2236 else 2237 { 2238 VidPnSourceId = D3DDDI_ID_UNINITIALIZED; 2252 2239 } 2253 2240 pCFCmd->pContext = pContext; 2254 2241 pCFCmd->pAllocation = pDstAlloc; 2255 2242 pCFCmd->SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 2243 pCFCmd->VidPnSourceId = VidPnSourceId; 2256 2244 pCFCmd->Color = pCF->Color; 2257 2245 memcpy(&pCFCmd->Rects, &pCF->Rects, RT_OFFSETOF(VBOXWDDM_RECTS_INFO, aRects[pCF->Rects.cRects])); 2246 ASMAtomicIncU32(&pDevExt->cDMACmdsOutstanding); 2258 2247 submStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pCFCmd->Hdr); 2259 2248 Assert(submStatus == STATUS_SUCCESS); 2260 2249 if (submStatus != STATUS_SUCCESS) 2250 { 2251 uint32_t cNew = ASMAtomicDecU32(&pDevExt->cDMACmdsOutstanding); 2252 Assert(cNew < UINT32_MAX/2); 2261 2253 vboxVdmaGgCmdDestroy(&pCFCmd->Hdr); 2254 } 2262 2255 } 2263 2256 … … 2291 2284 pDr->Location.phBuf = pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset; 2292 2285 2293 vboxVdmaCBufDrSubmit 2286 vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr); 2294 2287 break; 2295 2288 } … … 4167 4160 { 4168 4161 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 4169 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_ BLT;4162 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL; 4170 4163 4171 4164 vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst);
Note:
See TracChangeset
for help on using the changeset viewer.