Changeset 94631 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Apr 19, 2022 1:23:11 PM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp
r94622 r94631 303 303 const uint32_t cbSubmit = sizeof(uint32_t) 304 304 + sizeof(SVGAScreenObject); 305 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);305 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 306 306 if (pvCmd) 307 307 { … … 309 309 xOrigin, yOrigin, u32Width, u32Height, 310 310 /* fPrimary = */ false, u32Offset, fBlank); 311 Svga FifoCommit(pSvga, cbSubmit);311 SvgaCommit(pSvga, cbSubmit); 312 312 } 313 313 else … … 326 326 const uint32_t cbSubmit = sizeof(uint32_t) 327 327 + sizeof(SVGAFifoCmdDestroyScreen); 328 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);328 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 329 329 if (pvCmd) 330 330 { 331 331 SvgaCmdDestroyScreen(pvCmd, u32ScreenId); 332 Svga FifoCommit(pSvga, cbSubmit);332 SvgaCommit(pSvga, cbSubmit); 333 333 } 334 334 else … … 423 423 uint32_t cbSubmit = sizeof(SVGA3dCmdHeader) 424 424 + sizeof(SVGA3dCmdDefineContext); 425 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);425 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 426 426 if (pvCmd) 427 427 { 428 428 Svga3dCmdDefineContext(pvCmd, u32Cid); 429 Svga FifoCommit(pSvga, cbSubmit);429 SvgaCommit(pSvga, cbSubmit); 430 430 } 431 431 else … … 447 447 const uint32_t cbSubmit = sizeof(SVGA3dCmdHeader) 448 448 + sizeof(SVGA3dCmdDestroyContext); 449 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);449 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 450 450 if (pvCmd) 451 451 { 452 452 Svga3dCmdDestroyContext(pvCmd, u32Cid); 453 Svga FifoCommit(pSvga, cbSubmit);453 SvgaCommit(pSvga, cbSubmit); 454 454 } 455 455 else … … 468 468 const uint32_t cbSubmit = sizeof(uint32_t) 469 469 + sizeof(SVGAFifoCmdFence); 470 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);470 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 471 471 if (pvCmd) 472 472 { 473 473 SvgaCmdFence(pvCmd, u32Fence); 474 474 475 SvgaFifoCommit(pSvga, cbSubmit); 475 SvgaCommit(pSvga, cbSubmit); 476 SvgaFlush(pSvga); 476 477 } 477 478 else … … 496 497 + cSizes * sizeof(SVGA3dSize); 497 498 498 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);499 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 499 500 if (pvCmd) 500 501 { 501 502 Svga3dCmdDefineSurface(pvCmd, u32Sid, pCreateParms, paSizes, cSizes); 502 Svga FifoCommit(pSvga, cbSubmit);503 SvgaCommit(pSvga, cbSubmit); 503 504 } 504 505 else … … 517 518 const uint32_t cbSubmit = sizeof(SVGA3dCmdHeader) 518 519 + sizeof(SVGA3dCmdDestroySurface); 519 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);520 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 520 521 if (pvCmd) 521 522 { 522 523 Svga3dCmdDestroySurface(pvCmd, u32Sid); 523 Svga FifoCommit(pSvga, cbSubmit);524 SvgaCommit(pSvga, cbSubmit); 524 525 } 525 526 else … … 981 982 SvgaGenPresent(0, 0, 0, NULL, 0, &cbSubmit); 982 983 983 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);984 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 984 985 if (pvCmd) 985 986 { 986 987 SvgaGenPresent(u32Sid, u32Width, u32Height, pvCmd, cbSubmit, NULL); 987 SvgaFifoCommit(pSvga, cbSubmit); 988 SvgaCommit(pSvga, cbSubmit); 989 SvgaFlush(pSvga); 988 990 } 989 991 else … … 1041 1043 SvgaGenPresentVRAM(pSvga, 0, 0, 0, 0, NULL, 0, &cbSubmit); 1042 1044 1043 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1045 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1044 1046 if (pvCmd) 1045 1047 { 1046 1048 Status = SvgaGenPresentVRAM(pSvga, u32Sid, u32Width, u32Height, u32VRAMOffset, pvCmd, cbSubmit, NULL); 1047 1049 Assert(Status == STATUS_SUCCESS); 1048 SvgaFifoCommit(pSvga, cbSubmit); 1050 SvgaCommit(pSvga, cbSubmit); 1051 SvgaFlush(pSvga); 1049 1052 } 1050 1053 else … … 1119 1122 } 1120 1123 1121 void *SvgaReserve(PVBOXWDDM_EXT_VMSVGA pSvga, uint32_t cbReserve, uint32_t idDXContext)1122 {1123 if (pSvga->pCBState)1124 return SvgaCmdBufReserve(pSvga, cbReserve, idDXContext);1125 return SvgaFifoReserve(pSvga, cbReserve);1126 }1127 1128 void SvgaCommit(PVBOXWDDM_EXT_VMSVGA pSvga, uint32_t cbActual)1129 {1130 if (pSvga->pCBState)1131 {1132 SvgaCmdBufCommit(pSvga, cbActual);1133 return;1134 }1135 SvgaFifoCommit(pSvga, cbActual);1136 }1137 1138 void SvgaFlush(PVBOXWDDM_EXT_VMSVGA pSvga)1139 {1140 if (pSvga->pCBState)1141 SvgaCmdBufFlush(pSvga);1142 }1143 1144 1124 NTSTATUS SvgaBlitGMRFBToScreen(PVBOXWDDM_EXT_VMSVGA pSvga, 1145 1125 uint32_t idDstScreen, … … 1155 1135 NULL, 0, &cbSubmit); 1156 1136 1157 pvCmd = SvgaReserve(pSvga, cbSubmit , SVGA3D_INVALID_ID);1137 pvCmd = SvgaReserve(pSvga, cbSubmit); 1158 1138 if (pvCmd) 1159 1139 { … … 1269 1249 + sizeof(SVGAFifoCmdUpdate); 1270 1250 1271 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1251 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1272 1252 if (pvCmd) 1273 1253 { 1274 1254 /** @todo Multi-monitor. */ 1275 1255 SvgaCmdUpdate(pvCmd, u32X, u32Y, u32Width, u32Height); 1276 SvgaFifoCommit(pSvga, cbSubmit); 1256 SvgaCommit(pSvga, cbSubmit); 1257 SvgaFlush(pSvga); 1277 1258 } 1278 1259 else … … 1331 1312 NULL, 0, &cbSubmit); 1332 1313 1333 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1314 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1334 1315 if (pvCmd) 1335 1316 { … … 1340 1321 pvCmd, cbSubmit, NULL); 1341 1322 Assert(Status == STATUS_SUCCESS); 1342 Svga FifoCommit(pSvga, cbSubmit);1323 SvgaCommit(pSvga, cbSubmit); 1343 1324 } 1344 1325 else … … 1392 1373 NULL, 0, &cbSubmit); 1393 1374 1394 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1375 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1395 1376 if (pvCmd) 1396 1377 { … … 1400 1381 pvCmd, cbSubmit, NULL); 1401 1382 Assert(Status == STATUS_SUCCESS); 1402 Svga FifoCommit(pSvga, cbSubmit);1383 SvgaCommit(pSvga, cbSubmit); 1403 1384 } 1404 1385 else … … 1460 1441 NULL, 0, &cbSubmit); 1461 1442 1462 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1443 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1463 1444 if (pvCmd) 1464 1445 { … … 1466 1447 pvCmd, cbSubmit, NULL); 1467 1448 Assert(Status == STATUS_SUCCESS); 1468 Svga FifoCommit(pSvga, cbSubmit);1449 SvgaCommit(pSvga, cbSubmit); 1469 1450 } 1470 1451 else … … 1565 1546 NULL, 0, &cbSubmit); 1566 1547 1567 void *pvCmd = Svga FifoReserve(pSvga, cbSubmit);1548 void *pvCmd = SvgaReserve(pSvga, cbSubmit); 1568 1549 if (pvCmd) 1569 1550 { … … 1571 1552 pvCmd, cbSubmit, NULL); 1572 1553 AssertStmt(Status == STATUS_SUCCESS, cbSubmit = 0); 1573 Svga FifoCommit(pSvga, cbSubmit);1554 SvgaCommit(pSvga, cbSubmit); 1574 1555 } 1575 1556 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r94622 r94631 65 65 typedef struct VMSVGACBPAGE 66 66 { 67 RTR0MEMOBJ hMemObj; 67 RTR0MEMOBJ hMemObjPages; 68 RTR0MEMOBJ hMemObjMapping; 68 69 RTR0PTR pvR0; 69 70 RTHCPHYS PhysAddr; … … 75 76 typedef enum VMSVGACBTYPE 76 77 { 77 VMSVGACB_INVALID 78 VMSVGACB_CONTEXT_DEVICE = 1, 79 VMSVGACB_MINIPORT = 2, 80 VMSVGACB_UMD = 3 78 VMSVGACB_INVALID = 0, 79 VMSVGACB_CONTEXT_DEVICE = 1, /* SVGA_CB_CONTEXT_DEVICE commands. */ 80 VMSVGACB_MINIPORT = 2, /* Commands generated by the miniport. */ 81 VMSVGACB_UMD = 3 /* WDDM DMA buffer. */ 81 82 } VMSVGACBTYPE; 82 83 … … 100 101 PHYSICAL_ADDRESS DmaBufferPhysicalAddress; /* VMSVGACB_UMD */ 101 102 } commands; 103 #ifdef DEBUG 104 bool fSubmitted : 1; 105 #endif 102 106 } VMSVGACB, *PVMSVGACB; 103 107 … … 130 134 VMSVGACBHEADERPOOL HeaderPool; /* Array of buffer headers. */ 131 135 PVMSVGACB pCBCurrent; /* Current buffer for miniport commands. */ 132 FAST_MUTEX CBCurrentMutex; /* Access pCBCurrent. KGUARDED_MUTEX?*/136 FAST_MUTEX CBCurrentMutex; /* Access pCBCurrent. */ 133 137 KSPIN_LOCK SpinLock; /* Lock for aCBContexts. */ 134 138 } VMSVGACBSTATE, *PVMSVGACBSTATE; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/SvgaFifo.cpp
r94622 r94631 89 89 void *SvgaFifoReserve(PVBOXWDDM_EXT_VMSVGA pSvga, uint32_t cbReserve) 90 90 { 91 Assert(!pSvga->pCBState); 91 92 Assert((cbReserve & 0x3) == 0); 92 93 … … 289 290 static NTSTATUS svgaCBFreePage(PVMSVGACBPAGE pPage) 290 291 { 291 if (pPage->hMemObj != NIL_RTR0MEMOBJ) 292 { 293 int rc = RTR0MemObjFree(pPage->hMemObj, /* fFreeMappings */ true); 294 AssertReturn(RT_SUCCESS(rc), STATUS_INVALID_PARAMETER); 292 if (pPage->hMemObjMapping != NIL_RTR0MEMOBJ) 293 { 294 int rc = RTR0MemObjFree(pPage->hMemObjMapping, /* fFreeMappings */ true); 295 Assert(RT_SUCCESS(rc)); RT_NOREF(rc); 296 } 297 298 if (pPage->hMemObjPages != NIL_RTR0MEMOBJ) 299 { 300 int rc = RTR0MemObjFree(pPage->hMemObjPages, /* fFreeMappings */ true); 301 Assert(RT_SUCCESS(rc)); RT_NOREF(rc); 295 302 } 296 303 RT_ZERO(*pPage); … … 299 306 300 307 301 static NTSTATUS svgaCBAllocPage(PVMSVGACBPAGE pPage) 302 { 303 int rc = RTR0MemObjAllocPageTag(&pPage->hMemObj, PAGE_SIZE, 304 /* fExecutable */ false, "WDDMGA"); 308 static NTSTATUS svgaCBAllocPage(PVMSVGACBPAGE pPage, uint32_t cb) 309 { 310 int rc = RTR0MemObjAllocPhysTag(&pPage->hMemObjPages, cb, NIL_RTHCPHYS, "VMSVGACB"); 305 311 AssertReturn(RT_SUCCESS(rc), STATUS_INSUFFICIENT_RESOURCES); 306 312 307 pPage->pvR0 = RTR0MemObjAddress(pPage->hMemObj); 308 pPage->PhysAddr = RTR0MemObjGetPagePhysAddr(pPage->hMemObj, /* iPage */ 0); 313 rc = RTR0MemObjMapKernelTag(&pPage->hMemObjMapping, pPage->hMemObjPages, (void *)-1, 314 PAGE_SIZE, RTMEM_PROT_READ | RTMEM_PROT_WRITE, "VMSVGACB"); 315 AssertReturnStmt(RT_SUCCESS(rc), svgaCBFreePage(pPage), STATUS_INSUFFICIENT_RESOURCES); 316 317 pPage->pvR0 = RTR0MemObjAddress(pPage->hMemObjMapping); 318 pPage->PhysAddr = RTR0MemObjGetPagePhysAddr(pPage->hMemObjPages, /* iPage */ 0); 309 319 return STATUS_SUCCESS; 310 320 } … … 326 336 for (unsigned i = 0; i < RT_ELEMENTS(pHeaderPool->aHeaderPoolPages); ++i) 327 337 { 328 Status = svgaCBAllocPage(&pHeaderPool->aHeaderPoolPages[i] );338 Status = svgaCBAllocPage(&pHeaderPool->aHeaderPoolPages[i], PAGE_SIZE); 329 339 AssertBreak(NT_SUCCESS(Status)); 330 340 } … … 372 382 373 383 PVMSVGACBPAGE pPage = &pHeaderPool->aHeaderPoolPages[idxPage]; 374 Assert(pPage->hMemObj != NIL_RTR0MEMOBJ);384 Assert(pPage->hMemObjMapping != NIL_RTR0MEMOBJ); 375 385 376 386 uint32_t const offPage = (id - idxPage * VMSVGA_CB_HEADER_POOL_HANDLES_PER_PAGE) * sizeof(SVGACBHeader); … … 384 394 static NTSTATUS svgaCBFree(PVMSVGACBSTATE pCBState, PVMSVGACB pCB) 385 395 { 396 GALOG(("CB: %p\n", pCB)); 386 397 if (pCB->enmType != VMSVGACB_UMD) 387 398 svgaCBFreePage(&pCB->commands.page); … … 398 409 * @param enmType Kind of the buffer. 399 410 * @param idDXContext DX context of the commands in the buffer. 411 * @param cbRequired How many bytes are required for MINIPORT or CONTEXT_DEVICE buffers. 400 412 * @param ppCB Where to store the allocated buffer pointer. 401 413 */ 402 static NTSTATUS svgaCBAlloc(PVMSVGACBSTATE pCBState, VMSVGACBTYPE enmType, uint32_t idDXContext, PVMSVGACB *ppCB)414 static NTSTATUS svgaCBAlloc(PVMSVGACBSTATE pCBState, VMSVGACBTYPE enmType, uint32_t idDXContext, uint32_t cbRequired, PVMSVGACB *ppCB) 403 415 { 404 416 RT_NOREF(pCBState); … … 406 418 PVMSVGACB pCB = (PVMSVGACB)GaMemAllocZero(sizeof(VMSVGACB)); 407 419 AssertReturn(pCB, STATUS_INSUFFICIENT_RESOURCES); 420 GALOG(("CB: %p\n", pCB)); 408 421 409 422 NTSTATUS Status; … … 417 430 if (enmType != VMSVGACB_UMD) 418 431 { 419 pCB->cbBuffer = PAGE_SIZE;432 pCB->cbBuffer = RT_ALIGN_32(cbRequired, PAGE_SIZE); 420 433 pCB->cbCommand = 0; 421 Status = svgaCBAllocPage(&pCB->commands.page );434 Status = svgaCBAllocPage(&pCB->commands.page, pCB->cbBuffer); 422 435 AssertReturnStmt(NT_SUCCESS(Status), 423 436 GaMemFree(pCB), … … 456 469 457 470 PVMSVGACBSTATE pCBState = pSvga->pCBState; 471 GALOG(("CB: %p\n", pCB)); 458 472 459 473 /* Allocate a header for the buffer. */ … … 465 479 pCBHeader->status = SVGA_CB_STATUS_NONE; 466 480 pCBHeader->errorOffset = 0; 467 pCBHeader->id = 0; 481 if (pCB->enmType != VMSVGACB_UMD) 482 pCBHeader->id = 0; 483 else 484 pCBHeader->id = 1; /* An arbitrary not zero value. SVGA_DC_CMD_PREEMPT will preempt such buffers. */ 468 485 if (pCB->idDXContext != SVGA3D_INVALID_ID) 469 486 pCBHeader->flags = SVGA_CB_FLAG_DX_CONTEXT; … … 478 495 pCBHeader->dxContext = pCB->idDXContext; 479 496 RT_ZERO(pCBHeader->mustBeZero); 497 Assert(pCBHeader->ptr.pa != 0); 480 498 481 499 /* Select appropriate comamnd buffer context. */ … … 500 518 RTListAppend(&pCBCtx->QueueSubmitted, &pCB->nodeQueue); 501 519 ++pCBCtx->cSubmitted; 520 #ifdef DEBUG 521 Assert(!pCB->fSubmitted); 522 if (pCB->fSubmitted) 523 GALOG(("CB: %p already submitted\n", pCB)); 524 pCB->fSubmitted = true; 525 #endif 502 526 503 527 KeReleaseSpinLock(&pCBState->SpinLock, OldIrql); … … 515 539 516 540 PVMSVGACB pCB; 517 NTSTATUS Status = svgaCBAlloc(pCBState, VMSVGACB_CONTEXT_DEVICE, SVGA3D_INVALID_ID, &pCB);541 NTSTATUS Status = svgaCBAlloc(pCBState, VMSVGACB_CONTEXT_DEVICE, SVGA3D_INVALID_ID, cbCmd, &pCB); 518 542 AssertReturn(NT_SUCCESS(Status), Status); 519 543 … … 529 553 svgaCBFree(pCBState, pCB); 530 554 return Status; 555 } 556 557 558 NTSTATUS SvgaCmdBufSubmitMiniportCommand(PVBOXWDDM_EXT_VMSVGA pSvga, void const *pvCmd, uint32_t cbCmd) 559 { 560 PVMSVGACBSTATE pCBState = pSvga->pCBState; 561 562 PVMSVGACB pCB; 563 NTSTATUS Status = svgaCBAlloc(pCBState, VMSVGACB_MINIPORT, SVGA3D_INVALID_ID, cbCmd, &pCB); 564 AssertReturn(NT_SUCCESS(Status), Status); 565 566 memcpy(pCB->commands.page.pvR0, pvCmd, cbCmd); 567 pCB->cbCommand = cbCmd; 568 569 return svgaCBSubmit(pSvga, pCB); 531 570 } 532 571 … … 570 609 { 571 610 /* Allocate a new command buffer. */ 572 Status = svgaCBAlloc(pCBState, VMSVGACB_MINIPORT, idDXContext, &pCBState->pCBCurrent);611 Status = svgaCBAlloc(pCBState, VMSVGACB_MINIPORT, idDXContext, cbRequired, &pCBState->pCBCurrent); 573 612 AssertReturnStmt(NT_SUCCESS(Status), ExReleaseFastMutex(&pCBState->CBCurrentMutex), NULL); 574 613 pCB = pCBState->pCBCurrent; 614 AssertReturnStmt(pCB->cbBuffer - pCB->cbCommand >= cbRequired, ExReleaseFastMutex(&pCBState->CBCurrentMutex), NULL); 575 615 } 576 616 … … 619 659 * @param pSvga The device instance. 620 660 * @param cbReserve Expected size of the command data. 661 * @param idDXContext DX context of the command. 621 662 * @return Pointer to the command data. 622 663 */ … … 678 719 679 720 PVMSVGACB pCB = pCBState->pCBCurrent; 721 GALOG(("CB: %p\n", pCB)); 680 722 if (pCB && pCB->cbCommand) 681 723 { … … 687 729 688 730 ExReleaseFastMutex(&pCBState->CBCurrentMutex); 731 } 732 733 734 NTSTATUS SvgaCmdBufSubmitUMD(PVBOXWDDM_EXT_VMSVGA pSvga, PVMSVGACB pCB) 735 { 736 AssertReturn(pCB && pCB->enmType == VMSVGACB_UMD, STATUS_INVALID_PARAMETER); 737 return svgaCBSubmit(pSvga, pCB); 738 } 739 740 741 NTSTATUS SvgaCmdBufAllocUMD(PVBOXWDDM_EXT_VMSVGA pSvga, PHYSICAL_ADDRESS DmaBufferPhysicalAddress, 742 uint32_t cbBuffer, uint32_t cbCommands, uint32_t idDXContext, PVMSVGACB *ppCB) 743 { 744 PVMSVGACBSTATE pCBState = pSvga->pCBState; 745 NTSTATUS Status = svgaCBAlloc(pCBState, VMSVGACB_UMD, idDXContext, cbBuffer, ppCB); 746 AssertReturn(NT_SUCCESS(Status), Status); 747 GALOG(("CB: %p, cbBuffer %d\n", *ppCB, cbBuffer)); 748 749 (*ppCB)->cbBuffer = cbBuffer; 750 (*ppCB)->cbCommand = cbCommands; 751 (*ppCB)->commands.DmaBufferPhysicalAddress = DmaBufferPhysicalAddress; 752 return STATUS_SUCCESS; 689 753 } 690 754 … … 736 800 break; 737 801 802 case SVGA_CB_STATUS_PREEMPTED: 803 /* Delete the buffer. */ 804 GALOG(("SVGA_CB_STATUS_PREEMPTED %p\n", pIter)); 805 RTListNodeRemove(&pIter->nodeQueue); 806 svgaCBFree(pCBState, pIter); 807 break; 808 738 809 case SVGA_CB_STATUS_NONE: 739 810 case SVGA_CB_STATUS_QUEUE_FULL: 740 811 case SVGA_CB_STATUS_COMMAND_ERROR: 741 812 case SVGA_CB_STATUS_CB_HEADER_ERROR: 742 case SVGA_CB_STATUS_PREEMPTED:743 813 case SVGA_CB_STATUS_SUBMISSION_ERROR: 744 814 case SVGA_CB_STATUS_PARTIAL_COMPLETE: -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/SvgaFifo.h
r94622 r94631 33 33 34 34 NTSTATUS SvgaCmdBufDeviceCommand(PVBOXWDDM_EXT_VMSVGA pSvga, void const *pvCmd, uint32_t cbCmd); 35 NTSTATUS SvgaCmdBufSubmitMiniportCommand(PVBOXWDDM_EXT_VMSVGA pSvga, void const *pvCmd, uint32_t cbCmd); 35 36 36 37 void *SvgaCmdBuf3dCmdReserve(PVBOXWDDM_EXT_VMSVGA pSvga, SVGAFifo3dCmdId enmCmd, uint32_t cbReserve, uint32_t idDXContext); … … 41 42 void SvgaCmdBufProcess(PVBOXWDDM_EXT_VMSVGA pSvga); 42 43 44 NTSTATUS SvgaCmdBufAllocUMD(PVBOXWDDM_EXT_VMSVGA pSvga, PHYSICAL_ADDRESS DmaBufferPhysicalAddress, 45 uint32_t cbBuffer, uint32_t cbCommands, uint32_t idDXContext, PVMSVGACB *ppCB); 46 NTSTATUS SvgaCmdBufSubmitUMD(PVBOXWDDM_EXT_VMSVGA pSvga, PVMSVGACB pCB); 47 48 DECLINLINE(void *) SvgaReserve(PVBOXWDDM_EXT_VMSVGA pSvga, uint32_t cbReserve, uint32_t idDXContext = SVGA3D_INVALID_ID) 49 { 50 if (pSvga->pCBState) 51 return SvgaCmdBufReserve(pSvga, cbReserve, idDXContext); 52 return SvgaFifoReserve(pSvga, cbReserve); 53 } 54 55 DECLINLINE(void) SvgaCommit(PVBOXWDDM_EXT_VMSVGA pSvga, uint32_t cbActual) 56 { 57 if (pSvga->pCBState) 58 { 59 SvgaCmdBufCommit(pSvga, cbActual); 60 return; 61 } 62 SvgaFifoCommit(pSvga, cbActual); 63 } 64 65 DECLINLINE(void) SvgaFlush(PVBOXWDDM_EXT_VMSVGA pSvga) 66 { 67 if (pSvga->pCBState) 68 SvgaCmdBufFlush(pSvga); 69 } 70 71 43 72 #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_gallium_SvgaFifo_h */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp
r94622 r94631 327 327 memset(¬ify, 0, sizeof(notify)); 328 328 329 GALOG(("%d fence %d\n", enmType, uFenceId));330 329 switch (enmType) 331 330 { 332 331 case DXGK_INTERRUPT_DMA_COMPLETED: 332 GALOG(("COMPLETED fence %d\n", uFenceId)); 333 333 notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED; 334 334 notify.DmaCompleted.SubmissionFenceId = uFenceId; … … 337 337 338 338 case DXGK_INTERRUPT_DMA_PREEMPTED: 339 GALOG(("PREEMPTED fence %d, %d\n", uFenceId, uLastCompletedFenceId)); 339 340 notify.InterruptType = DXGK_INTERRUPT_DMA_PREEMPTED; 340 341 notify.DmaPreempted.PreemptionFenceId = uFenceId; … … 344 345 345 346 case DXGK_INTERRUPT_DMA_FAULTED: 347 GALOG(("COMPLETED fence %d\n", uFenceId)); 346 348 notify.InterruptType = DXGK_INTERRUPT_DMA_FAULTED; 347 349 notify.DmaFaulted.FaultedFenceId = uFenceId; … … 676 678 PVBOXWDDM_DEVICE pDevice = pContext->pDevice; 677 679 PVBOXMP_DEVEXT pDevExt = pDevice->pAdapter; 680 681 SvgaFlush(pDevExt->pGa->hw.pSvga); 678 682 679 683 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; … … 913 917 VBOXWDDM_EXT_GA *pGaDevExt = pDevExt->pGa; 914 918 919 SvgaFlush(pDevExt->pGa->hw.pSvga); 920 915 921 AssertReturn(pContext && pContext->enmType == VBOXWDDM_CONTEXT_TYPE_GA_3D, STATUS_INVALID_PARAMETER); 916 922 AssertReturn(pRender->CommandLength > pRender->MultipassOffset, STATUS_INVALID_PARAMETER); … … 1060 1066 NTSTATUS Status = STATUS_SUCCESS; 1061 1067 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 1068 1069 SvgaFlush(pDevExt->pGa->hw.pSvga); 1062 1070 1063 1071 GALOG(("DmaBufferPrivateData %p/%d, DmaBuffer %p/%d\n", … … 1235 1243 NTSTATUS APIENTRY GaDxgkDdiPatch(const HANDLE hAdapter, const DXGKARG_PATCH *pPatch) 1236 1244 { 1237 RT_NOREF2(hAdapter, pPatch); 1238 /* Nothing to do. */ 1245 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 1246 1247 SvgaFlush(pDevExt->pGa->hw.pSvga); 1248 1249 GALOG(("\n")); 1239 1250 1240 1251 uint8_t *pu8DMABuffer = (uint8_t *)pPatch->pDmaBuffer + pPatch->DmaBufferSubmissionStartOffset; … … 1313 1324 while (cDataBlocks--) 1314 1325 { 1326 GALOG(("pRenderData %p: u32DataType %u, pvDmaBuffer %p, cbData %u\n", 1327 pRenderData, pRenderData->u32DataType, pRenderData->pvDmaBuffer, pRenderData->cbData)); 1315 1328 AssertReturn(cbDmaBufferSubmission >= pRenderData->cbData, STATUS_INVALID_PARAMETER); 1316 1329 cbDmaBufferSubmission -= pRenderData->cbData; … … 1357 1370 } 1358 1371 1359 if (pvDmaBuffer) 1372 if (pGaDevExt->hw.pSvga->pCBState) 1373 { 1374 if (pRenderData->cbData && pvDmaBuffer) 1375 { 1376 PVMSVGACB pCB; 1377 NTSTATUS Status = SvgaCmdBufAllocUMD(pGaDevExt->hw.pSvga, pSubmitCommand->DmaBufferPhysicalAddress, 1378 pSubmitCommand->DmaBufferSize, pRenderData->cbData, 1379 SVGA3D_INVALID_ID, &pCB); 1380 GALOG(("Allocated UMD buffer %p\n", pCB)); 1381 if (NT_SUCCESS(Status)) 1382 { 1383 Status = SvgaCmdBufSubmitUMD(pGaDevExt->hw.pSvga, pCB); 1384 Assert(NT_SUCCESS(Status)); RT_NOREF(Status); 1385 } 1386 } 1387 } 1388 else if (pvDmaBuffer) 1360 1389 { 1361 1390 Assert(pSubmitCommand->DmaBufferSegmentId == 0); … … 1403 1432 1404 1433 /* Submit the fence. */ 1405 SvgaFence(pGaDevExt->hw.pSvga, pSubmitCommand->SubmissionFenceId); 1434 if (pGaDevExt->hw.pSvga->pCBState) 1435 { 1436 struct 1437 { 1438 uint32_t id; 1439 uint32_t fence; 1440 } fence; 1441 fence.id = SVGA_CMD_FENCE; 1442 fence.fence = pSubmitCommand->SubmissionFenceId; 1443 SvgaCmdBufSubmitMiniportCommand(pGaDevExt->hw.pSvga, &fence, sizeof(fence)); 1444 } 1445 else 1446 SvgaFence(pGaDevExt->hw.pSvga, pSubmitCommand->SubmissionFenceId); 1406 1447 1407 1448 GALOG(("done %d\n", pSubmitCommand->SubmissionFenceId)); … … 1572 1613 } 1573 1614 1574 /* We can not safely remove submitted data from FIFO, so just let the host process all submitted commands.1575 */1576 1615 const uint32_t u32LastCompletedFenceId = ASMAtomicReadU32(&pGaDevExt->u32LastCompletedFenceId); 1577 1616 const uint32_t u32LastSubmittedFenceId = ASMAtomicReadU32(&pGaDevExt->u32LastSubmittedFenceId); 1578 1617 if (u32LastCompletedFenceId == u32LastSubmittedFenceId) 1579 1618 { 1619 /* "the hardware is already finished processing all of the submitted DMA buffers" */ 1580 1620 GAPREEMPTCOMMANDCBCTX Ctx; 1581 1621 Ctx.pDevExt = pDevExt; … … 1591 1631 else 1592 1632 { 1593 /* Submit the fence. */ 1594 Assert(pGaDevExt->u32PreemptionFenceId == 0); 1595 ASMAtomicWriteU32(&pGaDevExt->u32PreemptionFenceId, pPreemptCommand->PreemptionFenceId); 1596 Status = SvgaFence(pGaDevExt->hw.pSvga, pPreemptCommand->PreemptionFenceId); 1633 if (pGaDevExt->hw.pSvga->pCBState) 1634 { 1635 #if 0 /** @todo later */ 1636 struct 1637 { 1638 uint32_t id; 1639 SVGADCCmdPreempt cmd; 1640 } cmd; 1641 cmd.id = SVGA_DC_CMD_PREEMPT; 1642 cmd.cmd.context = SVGA_CB_CONTEXT_0; 1643 cmd.cmd.ignoreIDZero = 1; /* Preempt only the UMD buffers. */ 1644 Status = SvgaCmdBufDeviceCommand(pGaDevExt->hw.pSvga, &cmd, sizeof(cmd)); 1645 AssertReturn(NT_SUCCESS(Status), Status); 1646 #endif 1647 1648 Assert(pGaDevExt->u32PreemptionFenceId == 0); 1649 ASMAtomicWriteU32(&pGaDevExt->u32PreemptionFenceId, pPreemptCommand->PreemptionFenceId); 1650 1651 struct 1652 { 1653 uint32_t id; 1654 uint32_t fence; 1655 } fence; 1656 fence.id = SVGA_CMD_FENCE; 1657 fence.fence = pPreemptCommand->PreemptionFenceId; 1658 Status = SvgaCmdBufSubmitMiniportCommand(pGaDevExt->hw.pSvga, &fence, sizeof(fence)); 1659 } 1660 else 1661 { 1662 /* We can not safely remove submitted data from FIFO, so just let the host process all submitted commands. 1663 */ 1664 /* Submit the fence. */ 1665 Assert(pGaDevExt->u32PreemptionFenceId == 0); 1666 ASMAtomicWriteU32(&pGaDevExt->u32PreemptionFenceId, pPreemptCommand->PreemptionFenceId); 1667 Status = SvgaFence(pGaDevExt->hw.pSvga, pPreemptCommand->PreemptionFenceId); 1668 } 1597 1669 } 1598 1670
Note:
See TracChangeset
for help on using the changeset viewer.