Changeset 31797 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Timestamp:
- Aug 19, 2010 5:03:40 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
r31713 r31797 28 28 29 29 30 /* @todo: implement a check to ensure display & miniport versions match. 31 * One would increase this whenever definitions in this file are changed */ 32 #define VBOXVIDEOIF_VERSION 4 30 /* One would increase this whenever definitions in this file are changed */ 31 #define VBOXVIDEOIF_VERSION 5 33 32 34 33 /* create allocation func */ … … 213 212 } VBOXVIDEOCM_CMD_RECTS, *PVBOXVIDEOCM_CMD_RECTS; 214 213 215 #define VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS(_cRects) (RT_OFFSETOF(VBOXVIDEOCM_CMD_RECTS, RectsInfo.aRects[(_cRects)])) 216 #define VBOXVIDEOCM_CMD_RECTS_SIZE(_pCmd) (VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS((_pCmd)->cRects)) 214 typedef struct VBOXVIDEOCM_CMD_RECTS_INTERNAL 215 { 216 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 217 UINT u32Reserved; 218 VBOXVIDEOCM_CMD_RECTS Cmd; 219 } VBOXVIDEOCM_CMD_RECTS_INTERNAL, *PVBOXVIDEOCM_CMD_RECTS_INTERNAL; 220 221 #define VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(_cRects) (RT_OFFSETOF(VBOXVIDEOCM_CMD_RECTS_INTERNAL, Cmd.RectsInfo.aRects[(_cRects)])) 222 #define VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE(_pCmd) (VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS((_pCmd)->cRects)) 217 223 218 224 typedef struct VBOXWDDM_GETVBOXVIDEOCMCMD_HDR -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r31763 r31797 310 310 PVBOXWDDM_RECTS_INFO pRects = &pRectsInfo->ContextsRects.UpdateRects; 311 311 NTSTATUS Status = STATUS_SUCCESS; 312 PVBOXVIDEOCM_CMD_RECTS pCmd= NULL;313 uint32_t cbCmd = VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS(pRects->cRects);312 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pCmdInternal = NULL; 313 uint32_t cbCmdInternal = VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(pRects->cRects); 314 314 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 315 315 ExAcquireFastMutex(&pDevExt->ContextMutex); … … 319 319 { 320 320 PVBOXWDDM_CONTEXT pCurContext = VBOXWDDMENTRY_2_CONTEXT(pCur); 321 if (!pCmd )322 { 323 pCmd = (PVBOXVIDEOCM_CMD_RECTS)vboxVideoCmCmdCreate(&pCurContext->CmContext, cbCmd);324 Assert(pCmd );325 if (!pCmd )321 if (!pCmdInternal) 322 { 323 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pCurContext->CmContext, cbCmdInternal); 324 Assert(pCmdInternal); 325 if (!pCmdInternal) 326 326 { 327 327 Status = STATUS_NO_MEMORY; … … 331 331 else 332 332 { 333 pCmd = (PVBOXVIDEOCM_CMD_RECTS)vboxVideoCmCmdReinitForContext(pCmd, &pCurContext->CmContext);333 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pCurContext->CmContext); 334 334 } 335 335 336 vboxVdmaDirtyRectsCalcIntersection(&pCurContext->ViewRect, pRects, &pCmd ->RectsInfo);337 if (pCmd ->RectsInfo.cRects)336 vboxVdmaDirtyRectsCalcIntersection(&pCurContext->ViewRect, pRects, &pCmdInternal->Cmd.RectsInfo); 337 if (pCmdInternal->Cmd.RectsInfo.cRects) 338 338 { 339 339 bool bSend = false; 340 pCmd ->fFlags.Value = 0;341 pCmd ->fFlags.bAddHiddenRects = 1;340 pCmdInternal->Cmd.fFlags.Value = 0; 341 pCmdInternal->Cmd.fFlags.bAddHiddenRects = 1; 342 342 if (pCurContext->pLastReportedRects) 343 343 { 344 if (pCurContext->pLastReportedRects-> fFlags.bSetVisibleRects)344 if (pCurContext->pLastReportedRects->Cmd.fFlags.bSetVisibleRects) 345 345 { 346 346 RECT *paPrevRects; 347 347 uint32_t cPrevRects; 348 if (pCurContext->pLastReportedRects-> fFlags.bSetViewRect)348 if (pCurContext->pLastReportedRects->Cmd.fFlags.bSetViewRect) 349 349 { 350 paPrevRects = &pCurContext->pLastReportedRects-> RectsInfo.aRects[1];351 cPrevRects = pCurContext->pLastReportedRects-> RectsInfo.cRects - 1;350 paPrevRects = &pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects[1]; 351 cPrevRects = pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects - 1; 352 352 } 353 353 else 354 354 { 355 paPrevRects = &pCurContext->pLastReportedRects-> RectsInfo.aRects[0];356 cPrevRects = pCurContext->pLastReportedRects-> RectsInfo.cRects;355 paPrevRects = &pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects[0]; 356 cPrevRects = pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects; 357 357 } 358 358 359 if (vboxVdmaDirtyRectsHasIntersections(paPrevRects, cPrevRects, pCmd->RectsInfo.aRects, pCmd->RectsInfo.cRects)) 359 if (vboxVdmaDirtyRectsHasIntersections(paPrevRects, cPrevRects, 360 pCmdInternal->Cmd.RectsInfo.aRects, pCmdInternal->Cmd.RectsInfo.cRects)) 360 361 { 361 362 bSend = true; … … 364 365 else 365 366 { 366 Assert(pCurContext->pLastReportedRects-> fFlags.bAddHiddenRects);367 if (!vboxVdmaDirtyRectsIsCover(pCurContext->pLastReportedRects-> RectsInfo.aRects,368 pCurContext->pLastReportedRects-> RectsInfo.cRects,369 pCmd ->RectsInfo.aRects, pCmd->RectsInfo.cRects))367 Assert(pCurContext->pLastReportedRects->Cmd.fFlags.bAddHiddenRects); 368 if (!vboxVdmaDirtyRectsIsCover(pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects, 369 pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects, 370 pCmdInternal->Cmd.RectsInfo.aRects, pCmdInternal->Cmd.RectsInfo.cRects)) 370 371 { 371 372 bSend = true; … … 380 381 if (pCurContext->pLastReportedRects) 381 382 vboxVideoCmCmdRelease(pCurContext->pLastReportedRects); 382 vboxVideoCmCmdRetain(pCmd); 383 pCurContext->pLastReportedRects = pCmd; 384 vboxVideoCmCmdSubmit(pCmd, VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS(pCmd->RectsInfo.cRects)); 385 pCmd = NULL; 383 384 pCmdInternal->VidPnSourceId = pRectsInfo->VidPnSourceId; 385 386 vboxVideoCmCmdRetain(pCmdInternal); 387 pCurContext->pLastReportedRects = pCmdInternal; 388 vboxVideoCmCmdSubmit(pCmdInternal, VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(pCmdInternal->Cmd.RectsInfo.cRects)); 389 pCmdInternal = NULL; 386 390 } 387 391 } … … 394 398 || pContext->ViewRect.right != pContextRect->right 395 399 || pContext->ViewRect.bottom != pContextRect->bottom); 396 PVBOXVIDEOCM_CMD_RECTS pDrCmd;400 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pDrCmdInternal; 397 401 398 402 bool bSend = false; … … 400 404 if (bRectShanged) 401 405 { 402 uint32_t cbDrCmd = VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS(pRects->cRects + 1);403 pDrCmd = (PVBOXVIDEOCM_CMD_RECTS)vboxVideoCmCmdCreate(&pContext->CmContext, cbDrCmd);404 Assert(pDrCmd );405 if (!pDrCmd )406 uint32_t cbDrCmdInternal = VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(pRects->cRects + 1); 407 pDrCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pContext->CmContext, cbDrCmdInternal); 408 Assert(pDrCmdInternal); 409 if (!pDrCmdInternal) 406 410 { 407 411 Status = STATUS_NO_MEMORY; 408 412 break; 409 413 } 410 pDrCmd ->fFlags.Value = 0;411 pDrCmd ->RectsInfo.cRects = pRects->cRects + 1;412 pDrCmd ->fFlags.bSetViewRect = 1;413 pDrCmd ->RectsInfo.aRects[0] = *pContextRect;414 pDrCmdInternal->Cmd.fFlags.Value = 0; 415 pDrCmdInternal->Cmd.RectsInfo.cRects = pRects->cRects + 1; 416 pDrCmdInternal->Cmd.fFlags.bSetViewRect = 1; 417 pDrCmdInternal->Cmd.RectsInfo.aRects[0] = *pContextRect; 414 418 pContext->ViewRect = *pContextRect; 415 memcpy(&pDrCmd ->RectsInfo.aRects[1], pRects->aRects, sizeof (RECT) * pRects->cRects);419 memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[1], pRects->aRects, sizeof (RECT) * pRects->cRects); 416 420 bSend = true; 417 421 } 418 422 else 419 423 { 420 if (pCmd )421 { 422 pDrCmd = (PVBOXVIDEOCM_CMD_RECTS)vboxVideoCmCmdReinitForContext(pCmd, &pContext->CmContext);423 pCmd = NULL;424 if (pCmdInternal) 425 { 426 pDrCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pContext->CmContext); 427 pCmdInternal = NULL; 424 428 } 425 429 else 426 430 { 427 pDrCmd = (PVBOXVIDEOCM_CMD_RECTS)vboxVideoCmCmdCreate(&pContext->CmContext, cbCmd);428 Assert(pDrCmd );429 if (!pDrCmd )431 pDrCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pContext->CmContext, cbCmdInternal); 432 Assert(pDrCmdInternal); 433 if (!pDrCmdInternal) 430 434 { 431 435 Status = STATUS_NO_MEMORY; … … 433 437 } 434 438 } 435 pDrCmd ->fFlags.Value = 0;436 pDrCmd ->RectsInfo.cRects = pRects->cRects;437 memcpy(&pDrCmd ->RectsInfo.aRects[0], pRects->aRects, sizeof (RECT) * pRects->cRects);439 pDrCmdInternal->Cmd.fFlags.Value = 0; 440 pDrCmdInternal->Cmd.RectsInfo.cRects = pRects->cRects; 441 memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[0], pRects->aRects, sizeof (RECT) * pRects->cRects); 438 442 439 443 if (pContext->pLastReportedRects) 440 444 { 441 if (pContext->pLastReportedRects-> fFlags.bSetVisibleRects)445 if (pContext->pLastReportedRects->Cmd.fFlags.bSetVisibleRects) 442 446 { 443 447 RECT *paRects; 444 448 uint32_t cRects; 445 if (pContext->pLastReportedRects-> fFlags.bSetViewRect)449 if (pContext->pLastReportedRects->Cmd.fFlags.bSetViewRect) 446 450 { 447 paRects = &pContext->pLastReportedRects-> RectsInfo.aRects[1];448 cRects = pContext->pLastReportedRects-> RectsInfo.cRects - 1;451 paRects = &pContext->pLastReportedRects->Cmd.RectsInfo.aRects[1]; 452 cRects = pContext->pLastReportedRects->Cmd.RectsInfo.cRects - 1; 449 453 } 450 454 else 451 455 { 452 paRects = &pContext->pLastReportedRects-> RectsInfo.aRects[0];453 cRects = pContext->pLastReportedRects-> RectsInfo.cRects;456 paRects = &pContext->pLastReportedRects->Cmd.RectsInfo.aRects[0]; 457 cRects = pContext->pLastReportedRects->Cmd.RectsInfo.cRects; 454 458 } 455 bSend = (pDrCmd ->RectsInfo.cRects != cRects)456 || memcmp(paRects, pDrCmd ->RectsInfo.aRects, cRects * sizeof (RECT));459 bSend = (pDrCmdInternal->Cmd.RectsInfo.cRects != cRects) 460 || memcmp(paRects, pDrCmdInternal->Cmd.RectsInfo.aRects, cRects * sizeof (RECT)); 457 461 } 458 462 else 459 463 { 460 Assert(pContext->pLastReportedRects-> fFlags.bAddHiddenRects);464 Assert(pContext->pLastReportedRects->Cmd.fFlags.bAddHiddenRects); 461 465 bSend = true; 462 466 } … … 473 477 vboxVideoCmCmdRelease(pContext->pLastReportedRects); 474 478 475 pDrCmd->fFlags.bSetVisibleRects = 1; 476 477 vboxVideoCmCmdRetain(pDrCmd); 478 pContext->pLastReportedRects = pDrCmd; 479 vboxVideoCmCmdSubmit(pDrCmd, VBOXVIDEOCM_SUBMITSIZE_DEFAULT); 479 pDrCmdInternal->Cmd.fFlags.bSetVisibleRects = 1; 480 pDrCmdInternal->VidPnSourceId = pRectsInfo->VidPnSourceId; 481 482 vboxVideoCmCmdRetain(pDrCmdInternal); 483 pContext->pLastReportedRects = pDrCmdInternal; 484 vboxVideoCmCmdSubmit(pDrCmdInternal, VBOXVIDEOCM_SUBMITSIZE_DEFAULT); 480 485 } 481 486 else 482 487 { 483 if (!pCmd )484 pCmd = pDrCmd;488 if (!pCmdInternal) 489 pCmdInternal = pDrCmdInternal; 485 490 else 486 vboxVideoCmCmdRelease(pDrCmd );491 vboxVideoCmCmdRelease(pDrCmdInternal); 487 492 } 488 493 } … … 491 496 492 497 493 if (pCmd )494 vboxVideoCmCmdRelease(pCmd );498 if (pCmdInternal) 499 vboxVideoCmCmdRelease(pCmdInternal); 495 500 496 501 return Status; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
r30953 r31797 79 79 VBOXVDMAPIPE_CMD_DR Hdr; 80 80 struct VBOXWDDM_CONTEXT *pContext; 81 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 81 82 VBOXVDMAPIPE_RECTS ContextsRects; 82 83 } VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r31763 r31797 2066 2066 } 2067 2067 2068 static void vboxWddmSubmitBltCmd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ SOURCE pSource, PVBOXWDDM_CONTEXT pContext, PVBOXWDDM_DMA_PRESENT_BLT pBlt)2068 static void vboxWddmSubmitBltCmd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_DMA_PRESENT_BLT pBlt) 2069 2069 { 2070 2070 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])); … … 2072 2072 if (pRectsCmd) 2073 2073 { 2074 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pBlt->Hdr.DstAllocInfo.srcId]; 2075 VBOXWDDM_CONTEXT *pContext = pBlt->Hdr.pContext; 2074 2076 pRectsCmd->pContext = pContext; 2077 pRectsCmd->VidPnSourceId = pBlt->Hdr.SrcAllocInfo.srcId; 2075 2078 memcpy(&pRectsCmd->ContextsRects, &pBlt->DstRects, RT_OFFSETOF(VBOXVDMAPIPE_RECTS, UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2076 2079 vboxWddmRectTranslate(&pRectsCmd->ContextsRects.ContextRect, pSource->VScreenPos.x, pSource->VScreenPos.y); … … 2184 2187 VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, pSource, &rect); 2185 2188 } 2186 vboxWddmSubmitBltCmd(pDevExt, p Source, pContext, pBlt);2189 vboxWddmSubmitBltCmd(pDevExt, pBlt); 2187 2190 break; 2188 2191 } … … 2193 2196 if (pSrcAlloc->fRcFlags.RenderTarget) 2194 2197 { 2195 vboxWddmSubmitBltCmd(pDevExt, p Source, pContext, pBlt);2198 vboxWddmSubmitBltCmd(pDevExt, pBlt); 2196 2199 } 2197 2200 break; … … 2237 2240 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->SrcAllocInfo.srcId]; 2238 2241 pRectsCmd->pContext = pContext; 2242 pRectsCmd->VidPnSourceId = pPrivateData->SrcAllocInfo.srcId; 2239 2243 RECT r; 2240 2244 r.left = pSource->VScreenPos.x; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r30973 r31797 132 132 UINT uLastCompletedCmdFenceId; 133 133 RECT ViewRect; 134 PVBOXVIDEOCM_CMD_RECTS pLastReportedRects;134 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pLastReportedRects; 135 135 VBOXVIDEOCM_CTX CmContext; 136 136 } VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
Note:
See TracChangeset
for help on using the changeset viewer.