Changeset 32496 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Timestamp:
- Sep 14, 2010 10:14:46 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk
r32241 r32496 103 103 wddm/VBoxVideoShgsmi.cpp \ 104 104 wddm/VBoxVideoCm.cpp \ 105 wddm/VBoxVideoMisc.cpp \ 105 106 wddm/VBoxVideoWddm.rc 106 107 ifdef VBOXWDDM_WITH_VBVA -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r31873 r32496 118 118 #include <VBox/VBoxVideo.h> 119 119 #include "wddm/VBoxVideoIf.h" 120 #include "wddm/VBoxVideoMisc.h" 120 121 #include "wddm/VBoxVideoShgsmi.h" 121 122 #include "wddm/VBoxVideoCm.h" … … 308 309 309 310 VBOXVIDEOCM_MGR CmMgr; 310 LIST_ENTRY ContextList3D;311 LIST_ENTRY SwapchainList3D; 311 312 /* mutex for context list operations */ 312 313 FAST_MUTEX ContextMutex; 314 KSPIN_LOCK SynchLock; 313 315 volatile uint32_t cContexts3D; 314 316 volatile uint32_t cDMACmdsOutstanding; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoCm.cpp
r30925 r32496 156 156 PVBOXVIDEOCM_CMD_DR pHdr = VBOXVIDEOCM_HEAD(pvCmd); 157 157 vboxVideoCmCmdPostByHdr(pHdr->pContext->pSession, pHdr, cbSize); 158 } 159 160 NTSTATUS vboxVideoCmCmdVisit(PVBOXVIDEOCM_CTX pContext, BOOL bEntireSession, PFNVBOXVIDEOCMCMDVISITOR pfnVisitor, PVOID pvVisitor) 161 { 162 PVBOXVIDEOCM_SESSION pSession = pContext->pSession; 163 PLIST_ENTRY pCurEntry = NULL; 164 PVBOXVIDEOCM_CMD_DR pHdr; 165 166 ExAcquireFastMutex(&pSession->Mutex); 167 168 pCurEntry = pSession->CommandsList.Blink; 169 do 170 { 171 if (pCurEntry != &pSession->CommandsList) 172 { 173 pHdr = VBOXCMENTRY_2_CMD(pCurEntry); 174 pCurEntry = pHdr->QueueList.Blink; 175 if (bEntireSession || pHdr->pContext == pContext) 176 { 177 void * pvBody = VBOXVIDEOCM_BODY(pHdr, void); 178 UINT fRet = pfnVisitor(pHdr->pContext, pvBody, pHdr->CmdHdr.cbCmd, pvVisitor); 179 if (fRet & VBOXVIDEOCMCMDVISITOR_RETURN_RMCMD) 180 { 181 RemoveEntryList(&pHdr->QueueList); 182 } 183 if (!(fRet & VBOXVIDEOCMCMDVISITOR_RETURN_CONTINUE)) 184 break; 185 } 186 } 187 else 188 { 189 break; 190 } 191 } while (1); 192 193 194 ExReleaseFastMutex(&pSession->Mutex); 195 196 return STATUS_SUCCESS; 158 197 } 159 198 … … 447 486 return STATUS_SUCCESS; 448 487 } 488 489 VOID vboxVideoCmLock(PVBOXVIDEOCM_CTX pContext) 490 { 491 ExAcquireFastMutex(&pContext->pSession->Mutex); 492 } 493 494 VOID vboxVideoCmUnlock(PVBOXVIDEOCM_CTX pContext) 495 { 496 ExReleaseFastMutex(&pContext->pSession->Mutex); 497 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoCm.h
r30462 r32496 41 41 void vboxVideoCmCmdSubmit(void *pvCmd, uint32_t cbSize); 42 42 43 #define VBOXVIDEOCMCMDVISITOR_RETURN_CONTINUE 0x00000001 44 #define VBOXVIDEOCMCMDVISITOR_RETURN_RMCMD 0x00000002 45 typedef DECLCALLBACK(UINT) FNVBOXVIDEOCMCMDVISITOR(PVBOXVIDEOCM_CTX pContext, PVOID pvCmd, uint32_t cbCmd, PVOID pvVisitor); 46 typedef FNVBOXVIDEOCMCMDVISITOR *PFNVBOXVIDEOCMCMDVISITOR; 47 NTSTATUS vboxVideoCmCmdVisit(PVBOXVIDEOCM_CTX pContext, BOOL bEntireSession, PFNVBOXVIDEOCMCMDVISITOR pfnVisitor, PVOID pvVisitor); 48 43 49 NTSTATUS vboxVideoCmEscape(PVBOXVIDEOCM_CTX pContext, PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD pCmd, uint32_t cbCmd); 50 VOID vboxVideoCmLock(PVBOXVIDEOCM_CTX pContext); 51 VOID vboxVideoCmUnlock(PVBOXVIDEOCM_CTX pContext); 44 52 45 53 #endif /* #ifndef ___VBoxVideoCm_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
r32425 r32496 168 168 } VBOXWDDM_CREATECONTEXT_INFO, *PVBOXWDDM_CREATECONTEXT_INFO; 169 169 170 typedef void *VBOXDISP_UMHANDLE; 171 typedef uint32_t VBOXDISP_KMHANDLE; 170 172 171 173 typedef struct VBOXWDDM_RECTS_FLAFS … … 214 216 typedef struct VBOXVIDEOCM_CMD_RECTS_INTERNAL 215 217 { 216 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 217 UINT u32Reserved; 218 union 219 { 220 VBOXDISP_UMHANDLE hSwapchainUm; 221 uint64_t u64Alignment; 222 }; 218 223 VBOXVIDEOCM_CMD_RECTS Cmd; 219 224 } VBOXVIDEOCM_CMD_RECTS_INTERNAL, *PVBOXVIDEOCM_CMD_RECTS_INTERNAL; … … 265 270 } VBOXDISPIFESCAPE_SCREENLAYOUT, *PVBOXDISPIFESCAPE_SCREENLAYOUT; 266 271 272 typedef struct VBOXSWAPCHAININFO 273 { 274 VBOXDISP_KMHANDLE hSwapchainKm; /* in, NULL if new is being created */ 275 VBOXDISP_UMHANDLE hSwapchainUm; /* in, UMD private data */ 276 RECT Rect; 277 UINT u32Reserved; 278 UINT cAllocs; 279 D3DKMT_HANDLE ahAllocs[1]; 280 }VBOXSWAPCHAININFO, *PVBOXSWAPCHAININFO; 267 281 typedef struct VBOXDISPIFESCAPE_SWAPCHAININFO 268 282 { 269 283 VBOXDISPIFESCAPE EscapeHdr; 284 VBOXSWAPCHAININFO SwapchainInfo; 270 285 } VBOXDISPIFESCAPE_SWAPCHAININFO, *PVBOXDISPIFESCAPE_SWAPCHAININFO; 271 286 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r32241 r32496 307 307 { 308 308 PVBOXWDDM_CONTEXT pContext = pRectsInfo->pContext; 309 PVBOXWDDM_SWAPCHAIN pSwapchain = pRectsInfo->pSwapchain; 309 310 PDEVICE_EXTENSION pDevExt = pContext->pDevice->pAdapter; 310 311 PVBOXWDDM_RECTS_INFO pRects = &pRectsInfo->ContextsRects.UpdateRects; … … 314 315 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 315 316 ExAcquireFastMutex(&pDevExt->ContextMutex); 316 for (PLIST_ENTRY pCur = pDevExt-> ContextList3D.Flink; pCur != &pDevExt->ContextList3D; pCur = pCur->Flink)317 { 318 if (pCur != &p Context->ListEntry)319 { 320 PVBOXWDDM_ CONTEXT pCurContext = VBOXWDDMENTRY_2_CONTEXT(pCur);317 for (PLIST_ENTRY pCur = pDevExt->SwapchainList3D.Flink; pCur != &pDevExt->SwapchainList3D; pCur = pCur->Flink) 318 { 319 if (pCur != &pSwapchain->DevExtListEntry) 320 { 321 PVBOXWDDM_SWAPCHAIN pCurSwapchain = VBOXWDDMENTRY_2_SWAPCHAIN(pCur); 321 322 if (!pCmdInternal) 322 323 { 323 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pCur Context->CmContext, cbCmdInternal);324 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pCurSwapchain->pContext->CmContext, cbCmdInternal); 324 325 Assert(pCmdInternal); 325 326 if (!pCmdInternal) … … 331 332 else 332 333 { 333 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pCur Context->CmContext);334 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pCurSwapchain->pContext->CmContext); 334 335 } 335 336 336 vboxVdmaDirtyRectsCalcIntersection(&pCur Context->ViewRect, pRects, &pCmdInternal->Cmd.RectsInfo);337 vboxVdmaDirtyRectsCalcIntersection(&pCurSwapchain->ViewRect, pRects, &pCmdInternal->Cmd.RectsInfo); 337 338 if (pCmdInternal->Cmd.RectsInfo.cRects) 338 339 { … … 340 341 pCmdInternal->Cmd.fFlags.Value = 0; 341 342 pCmdInternal->Cmd.fFlags.bAddHiddenRects = 1; 342 if (pCur Context->pLastReportedRects)343 { 344 if (pCur Context->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)343 if (pCurSwapchain->pLastReportedRects) 344 { 345 if (pCurSwapchain->pLastReportedRects->Cmd.fFlags.bSetVisibleRects) 345 346 { 346 347 RECT *paPrevRects; 347 348 uint32_t cPrevRects; 348 if (pCur Context->pLastReportedRects->Cmd.fFlags.bSetViewRect)349 if (pCurSwapchain->pLastReportedRects->Cmd.fFlags.bSetViewRect) 349 350 { 350 paPrevRects = &pCur Context->pLastReportedRects->Cmd.RectsInfo.aRects[1];351 cPrevRects = pCur Context->pLastReportedRects->Cmd.RectsInfo.cRects - 1;351 paPrevRects = &pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[1]; 352 cPrevRects = pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects - 1; 352 353 } 353 354 else 354 355 { 355 paPrevRects = &pCur Context->pLastReportedRects->Cmd.RectsInfo.aRects[0];356 cPrevRects = pCur Context->pLastReportedRects->Cmd.RectsInfo.cRects;356 paPrevRects = &pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[0]; 357 cPrevRects = pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects; 357 358 } 358 359 … … 365 366 else 366 367 { 367 Assert(pCur Context->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);368 if (!vboxVdmaDirtyRectsIsCover(pCur Context->pLastReportedRects->Cmd.RectsInfo.aRects,369 pCur Context->pLastReportedRects->Cmd.RectsInfo.cRects,368 Assert(pCurSwapchain->pLastReportedRects->Cmd.fFlags.bAddHiddenRects); 369 if (!vboxVdmaDirtyRectsIsCover(pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects, 370 pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects, 370 371 pCmdInternal->Cmd.RectsInfo.aRects, pCmdInternal->Cmd.RectsInfo.cRects)) 371 372 { … … 379 380 if (bSend) 380 381 { 381 if (pCur Context->pLastReportedRects)382 vboxVideoCmCmdRelease(pCur Context->pLastReportedRects);383 384 pCmdInternal-> VidPnSourceId = pRectsInfo->VidPnSourceId;382 if (pCurSwapchain->pLastReportedRects) 383 vboxVideoCmCmdRelease(pCurSwapchain->pLastReportedRects); 384 385 pCmdInternal->hSwapchainUm = pCurSwapchain->hSwapchainUm; 385 386 386 387 vboxVideoCmCmdRetain(pCmdInternal); 387 pCur Context->pLastReportedRects = pCmdInternal;388 pCurSwapchain->pLastReportedRects = pCmdInternal; 388 389 vboxVideoCmCmdSubmit(pCmdInternal, VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(pCmdInternal->Cmd.RectsInfo.cRects)); 389 390 pCmdInternal = NULL; … … 394 395 { 395 396 RECT * pContextRect = &pRectsInfo->ContextsRects.ContextRect; 396 bool bRectShanged = (p Context->ViewRect.left != pContextRect->left397 || p Context->ViewRect.top != pContextRect->top398 || p Context->ViewRect.right != pContextRect->right399 || p Context->ViewRect.bottom != pContextRect->bottom);397 bool bRectShanged = (pSwapchain->ViewRect.left != pContextRect->left 398 || pSwapchain->ViewRect.top != pContextRect->top 399 || pSwapchain->ViewRect.right != pContextRect->right 400 || pSwapchain->ViewRect.bottom != pContextRect->bottom); 400 401 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pDrCmdInternal; 401 402 … … 416 417 pDrCmdInternal->Cmd.fFlags.bSetViewRect = 1; 417 418 pDrCmdInternal->Cmd.RectsInfo.aRects[0] = *pContextRect; 418 p Context->ViewRect = *pContextRect;419 pSwapchain->ViewRect = *pContextRect; 419 420 memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[1], pRects->aRects, sizeof (RECT) * pRects->cRects); 420 421 bSend = true; … … 441 442 memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[0], pRects->aRects, sizeof (RECT) * pRects->cRects); 442 443 443 if (p Context->pLastReportedRects)444 { 445 if (p Context->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)444 if (pSwapchain->pLastReportedRects) 445 { 446 if (pSwapchain->pLastReportedRects->Cmd.fFlags.bSetVisibleRects) 446 447 { 447 448 RECT *paRects; 448 449 uint32_t cRects; 449 if (p Context->pLastReportedRects->Cmd.fFlags.bSetViewRect)450 if (pSwapchain->pLastReportedRects->Cmd.fFlags.bSetViewRect) 450 451 { 451 paRects = &p Context->pLastReportedRects->Cmd.RectsInfo.aRects[1];452 cRects = p Context->pLastReportedRects->Cmd.RectsInfo.cRects - 1;452 paRects = &pSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[1]; 453 cRects = pSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects - 1; 453 454 } 454 455 else 455 456 { 456 paRects = &p Context->pLastReportedRects->Cmd.RectsInfo.aRects[0];457 cRects = p Context->pLastReportedRects->Cmd.RectsInfo.cRects;457 paRects = &pSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[0]; 458 cRects = pSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects; 458 459 } 459 460 bSend = (pDrCmdInternal->Cmd.RectsInfo.cRects != cRects) … … 462 463 else 463 464 { 464 Assert(p Context->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);465 Assert(pSwapchain->pLastReportedRects->Cmd.fFlags.bAddHiddenRects); 465 466 bSend = true; 466 467 } … … 474 475 if (bSend) 475 476 { 476 if (p Context->pLastReportedRects)477 vboxVideoCmCmdRelease(p Context->pLastReportedRects);477 if (pSwapchain->pLastReportedRects) 478 vboxVideoCmCmdRelease(pSwapchain->pLastReportedRects); 478 479 479 480 pDrCmdInternal->Cmd.fFlags.bSetVisibleRects = 1; 480 pDrCmdInternal-> VidPnSourceId = pRectsInfo->VidPnSourceId;481 pDrCmdInternal->hSwapchainUm = pSwapchain->hSwapchainUm; 481 482 482 483 vboxVideoCmCmdRetain(pDrCmdInternal); 483 p Context->pLastReportedRects = pDrCmdInternal;484 pSwapchain->pLastReportedRects = pDrCmdInternal; 484 485 vboxVideoCmCmdSubmit(pDrCmdInternal, VBOXVIDEOCM_SUBMITSIZE_DEFAULT); 485 486 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
r32241 r32496 79 79 VBOXVDMAPIPE_CMD_DR Hdr; 80 80 struct VBOXWDDM_CONTEXT *pContext; 81 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;81 struct VBOXWDDM_SWAPCHAIN *pSwapchain; 82 82 VBOXVDMAPIPE_RECTS ContextsRects; 83 83 } VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r32325 r32496 635 635 #endif 636 636 vboxVideoCmInit(&pContext->CmMgr); 637 InitializeListHead(&pContext-> ContextList3D);637 InitializeListHead(&pContext->SwapchainList3D); 638 638 pContext->cContexts3D = 0; 639 639 ExInitializeFastMutex(&pContext->ContextMutex); 640 KeInitializeSpinLock(&pContext->SynchLock); 640 641 } 641 642 else … … 1472 1473 } 1473 1474 1475 PVBOXWDDM_SWAPCHAIN pSwapchain = vboxWddmSwapchainRetainByAlloc(pDevExt, pAllocation); 1476 if (pSwapchain) 1477 { 1478 vboxWddmSwapchainAllocRemove(pDevExt, pSwapchain, pAllocation); 1479 vboxWddmSwapchainRelease(pSwapchain); 1480 } 1481 1474 1482 vboxWddmAllocationDeleteFromResource(pAllocation->pResource, pAllocation); 1475 1483 … … 2093 2101 } 2094 2102 2095 static void vboxWddmSubmitBltCmd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_DMA_PRESENT_BLT pBlt) 2096 { 2103 static void vboxWddmSubmitBltCmd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAlloc, PVBOXWDDM_DMA_PRESENT_BLT pBlt) 2104 { 2105 PVBOXWDDM_SWAPCHAIN pSwapchain; 2106 if (pAlloc) 2107 { 2108 pSwapchain = vboxWddmSwapchainRetainByAlloc(pDevExt, pAlloc); 2109 if (!pSwapchain) 2110 return; 2111 } 2112 else 2113 { 2114 pSwapchain = NULL; 2115 } 2116 2097 2117 PVBOXVDMAPIPE_CMD_RECTSINFO pRectsCmd = (PVBOXVDMAPIPE_CMD_RECTSINFO)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_RECTSINFO, ContextsRects.UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2098 2118 Assert(pRectsCmd); … … 2102 2122 VBOXWDDM_CONTEXT *pContext = pBlt->Hdr.pContext; 2103 2123 pRectsCmd->pContext = pContext; 2104 pRectsCmd-> VidPnSourceId = pBlt->Hdr.SrcAllocInfo.srcId;2124 pRectsCmd->pSwapchain = pSwapchain; 2105 2125 memcpy(&pRectsCmd->ContextsRects, &pBlt->DstRects, RT_OFFSETOF(VBOXVDMAPIPE_RECTS, UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2106 2126 vboxWddmRectTranslate(&pRectsCmd->ContextsRects.ContextRect, pSource->VScreenPos.x, pSource->VScreenPos.y); … … 2216 2236 VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, pSource, &rect); 2217 2237 } 2218 vboxWddmSubmitBltCmd(pDevExt, pBlt);2238 vboxWddmSubmitBltCmd(pDevExt, NULL, pBlt); 2219 2239 break; 2220 2240 } … … 2225 2245 if (pSrcAlloc->fRcFlags.RenderTarget) 2226 2246 { 2227 vboxWddmSubmitBltCmd(pDevExt, p Blt);2247 vboxWddmSubmitBltCmd(pDevExt, pSrcAlloc, pBlt); 2228 2248 } 2229 2249 break; … … 2263 2283 VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR *pPrivateData = (VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR*)pPrivateDataBase; 2264 2284 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pSubmitCommand->hContext; 2265 PVBOXVDMAPIPE_CMD_RECTSINFO pRectsCmd = (PVBOXVDMAPIPE_CMD_RECTSINFO)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_RECTSINFO, ContextsRects.UpdateRects.aRects[1])); 2266 Assert(pRectsCmd); 2267 if (pRectsCmd) 2268 { 2269 PVBOXWDDM_ALLOCATION pAlloc = pPrivateData->SrcAllocInfo.pAlloc; 2270 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->SrcAllocInfo.srcId]; 2271 pRectsCmd->pContext = pContext; 2272 pRectsCmd->VidPnSourceId = pPrivateData->SrcAllocInfo.srcId; 2273 RECT r; 2274 r.left = pSource->VScreenPos.x; 2275 r.top = pSource->VScreenPos.y; 2276 r.right = pAlloc->SurfDesc.width + pSource->VScreenPos.x; 2277 r.bottom = pAlloc->SurfDesc.height + pSource->VScreenPos.y; 2278 pRectsCmd->ContextsRects.ContextRect = r; 2279 pRectsCmd->ContextsRects.UpdateRects.cRects = 1; 2280 pRectsCmd->ContextsRects.UpdateRects.aRects[0] = r; 2281 NTSTATUS tmpStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pRectsCmd->Hdr); 2282 Assert(tmpStatus == STATUS_SUCCESS); 2283 if (tmpStatus != STATUS_SUCCESS) 2284 vboxVdmaGgCmdDestroy(&pRectsCmd->Hdr); 2285 } 2286 2285 PVBOXWDDM_ALLOCATION pAlloc = pPrivateData->SrcAllocInfo.pAlloc; 2286 PVBOXWDDM_SWAPCHAIN pSwapchain = vboxWddmSwapchainRetainByAlloc(pDevExt, pAlloc); 2287 if (pSwapchain) 2288 { 2289 do 2290 { 2291 PVBOXVDMAPIPE_CMD_RECTSINFO pRectsCmd = (PVBOXVDMAPIPE_CMD_RECTSINFO)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_RECTSINFO, ContextsRects.UpdateRects.aRects[1])); 2292 Assert(pRectsCmd); 2293 if (pRectsCmd) 2294 { 2295 2296 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->SrcAllocInfo.srcId]; 2297 pRectsCmd->pContext = pContext; 2298 pRectsCmd->pSwapchain = pSwapchain; 2299 RECT r; 2300 r.left = pSource->VScreenPos.x; 2301 r.top = pSource->VScreenPos.y; 2302 r.right = pAlloc->SurfDesc.width + pSource->VScreenPos.x; 2303 r.bottom = pAlloc->SurfDesc.height + pSource->VScreenPos.y; 2304 pRectsCmd->ContextsRects.ContextRect = r; 2305 pRectsCmd->ContextsRects.UpdateRects.cRects = 1; 2306 pRectsCmd->ContextsRects.UpdateRects.aRects[0] = r; 2307 NTSTATUS tmpStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pRectsCmd->Hdr); 2308 Assert(tmpStatus == STATUS_SUCCESS); 2309 if (tmpStatus == STATUS_SUCCESS) 2310 break; 2311 vboxVdmaGgCmdDestroy(&pRectsCmd->Hdr); 2312 } 2313 vboxWddmSwapchainRelease(pSwapchain); 2314 } while (0); 2315 } 2287 2316 Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pPrivateData->pContext, pSubmitCommand->SubmissionFenceId); 2288 2317 break; … … 2941 2970 Status = STATUS_INVALID_PARAMETER; 2942 2971 } 2972 } 2973 case VBOXESC_SWAPCHAININFO: 2974 { 2975 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 2976 Status = vboxWddmSwapchainCtxEscape(pDevExt, pContext, (PVBOXDISPIFESCAPE_SWAPCHAININFO)pEscapeHdr, pEscape->PrivateDriverDataSize); 2977 Assert(Status == STATUS_SUCCESS); 2978 break; 2943 2979 } 2944 2980 case VBOXESC_REINITVIDEOMODES: … … 4455 4491 if (pContext) 4456 4492 { 4457 InitializeListHead(&pContext->ListEntry);4458 4493 pContext->pDevice = pDevice; 4459 4494 pContext->hContext = pCreateContext->hContext; … … 4478 4513 if (pInfo->u32IsD3D) 4479 4514 { 4480 pContext->enmType = VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D;4481 Status = vbox VideoCmCtxAdd(&pDevice->pAdapter->CmMgr, &pContext->CmContext, (HANDLE)pInfo->hUmEvent, pInfo->u64UmInfo);4515 ExInitializeFastMutex(&pContext->SwapchainMutex); 4516 Status = vboxWddmHTableCreate(&pContext->Swapchains, 4); 4482 4517 Assert(Status == STATUS_SUCCESS); 4483 4518 if (Status == STATUS_SUCCESS) 4484 4519 { 4485 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 4486 ExAcquireFastMutex(&pDevExt->ContextMutex); 4487 InsertHeadList(&pDevExt->ContextList3D, &pContext->ListEntry); 4488 ASMAtomicIncU32(&pDevExt->cContexts3D); 4489 ExReleaseFastMutex(&pDevExt->ContextMutex); 4520 pContext->enmType = VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D; 4521 Status = vboxVideoCmCtxAdd(&pDevice->pAdapter->CmMgr, &pContext->CmContext, (HANDLE)pInfo->hUmEvent, pInfo->u64UmInfo); 4522 Assert(Status == STATUS_SUCCESS); 4523 if (Status == STATUS_SUCCESS) 4524 { 4525 // Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 4526 // ExAcquireFastMutex(&pDevExt->ContextMutex); 4527 ASMAtomicIncU32(&pDevExt->cContexts3D); 4528 // ExReleaseFastMutex(&pDevExt->ContextMutex); 4529 } 4530 else 4531 { 4532 vboxWddmHTableDestroy(&pContext->Swapchains); 4533 } 4490 4534 } 4491 4535 } … … 4533 4577 { 4534 4578 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 4535 ExAcquireFastMutex(&pDevExt->ContextMutex);4536 RemoveEntryList(&pContext->ListEntry);4579 // ExAcquireFastMutex(&pDevExt->ContextMutex); 4580 // RemoveEntryList(&pContext->ListEntry); 4537 4581 uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContexts3D); 4538 ExReleaseFastMutex(&pDevExt->ContextMutex);4582 // ExReleaseFastMutex(&pDevExt->ContextMutex); 4539 4583 Assert(cContexts < UINT32_MAX/2); 4540 }4541 4542 if (pContext->pLastReportedRects)4543 {4544 vboxVideoCmCmdRelease(pContext->pLastReportedRects);4545 pContext->pLastReportedRects = NULL;4546 4584 } 4547 4585 … … 4549 4587 Assert(Status == STATUS_SUCCESS); 4550 4588 if (Status == STATUS_SUCCESS) 4589 { 4590 vboxWddmSwapchainCtxDestroyAll(pDevExt, pContext); 4551 4591 vboxWddmMemFree(pContext); 4592 } 4552 4593 4553 4594 dfprintf(("<== "__FUNCTION__ ", hContext(0x%x)\n", hContext)); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r32241 r32496 64 64 typedef struct VBOXWDDM_ALLOCATION 65 65 { 66 LIST_ENTRY SwapchainEntry; 67 struct VBOXWDDM_SWAPCHAIN *pSwapchain; 66 68 VBOXWDDM_ALLOC_TYPE enmType; 67 69 // VBOXWDDM_ALLOCUSAGE_TYPE enmCurrentUsage; … … 124 126 typedef enum 125 127 { 128 VBOXWDDM_OBJSTATE_TYPE_UNKNOWN = 0, 129 VBOXWDDM_OBJSTATE_TYPE_INITIALIZED, 130 VBOXWDDM_OBJSTATE_TYPE_TERMINATED 131 } VBOXWDDM_OBJSTATE_TYPE; 132 typedef struct VBOXWDDM_SWAPCHAIN 133 { 134 LIST_ENTRY DevExtListEntry; 135 LIST_ENTRY AllocList; 136 struct VBOXWDDM_CONTEXT *pContext; 137 RECT ViewRect; 138 VBOXWDDM_OBJSTATE_TYPE enmState; 139 volatile uint32_t cRefs; 140 VBOXDISP_UMHANDLE hSwapchainUm; 141 VBOXDISP_KMHANDLE hSwapchainKm; 142 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pLastReportedRects; 143 }VBOXWDDM_SWAPCHAIN, *PVBOXWDDM_SWAPCHAIN; 144 145 typedef enum 146 { 126 147 VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0, 127 148 VBOXWDDM_CONTEXT_TYPE_SYSTEM, … … 132 153 typedef struct VBOXWDDM_CONTEXT 133 154 { 134 LIST_ENTRY ListEntry;155 // LIST_ENTRY ListEntry; 135 156 struct VBOXWDDM_DEVICE * pDevice; 136 157 HANDLE hContext; … … 139 160 UINT EngineAffinity; 140 161 UINT uLastCompletedCmdFenceId; 141 RECT ViewRect;142 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pLastReportedRects;162 FAST_MUTEX SwapchainMutex; 163 VBOXWDDM_HTABLE Swapchains; 143 164 VBOXVIDEOCM_CTX CmContext; 144 165 } VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT; 145 166 146 #define VBOXWDDMENTRY_2_ CONTEXT(_pE) ((PVBOXWDDM_CONTEXT)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_CONTEXT,ListEntry)))167 #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry))) 147 168 148 169 typedef struct VBOXWDDM_DMA_ALLOCINFO
Note:
See TracChangeset
for help on using the changeset viewer.