Changeset 94635 in vbox
- Timestamp:
- Apr 19, 2022 3:26:18 PM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp
r94631 r94635 55 55 } 56 56 57 static NTSTATUS SvgaObjectTablesDestroy(VBOXWDDM_EXT_VMSVGA *pSvga) 58 { 59 NTSTATUS Status = STATUS_SUCCESS; 60 if (pSvga->hMemObjOTables != NIL_RTR0MEMOBJ) 61 { 62 for (uint32_t idOTable = 0; idOTable < SVGA_OTABLE_DX_MAX; idOTable++) 63 { 64 void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_SET_OTABLE_BASE64, sizeof(SVGA3dCmdSetOTableBase64), SVGA3D_INVALID_ID); 65 AssertBreakStmt(pvCmd, STATUS_INSUFFICIENT_RESOURCES); 66 67 SVGA3dCmdSetOTableBase64 *pCmd = (SVGA3dCmdSetOTableBase64 *)pvCmd; 68 pCmd->type = (SVGAOTableType)idOTable; 69 pCmd->baseAddress = 0; 70 pCmd->sizeInBytes = 0; 71 pCmd->validSizeInBytes = 0; 72 pCmd->ptDepth = SVGA3D_MOBFMT_INVALID; 73 74 SvgaCmdBufCommit(pSvga, sizeof(SVGA3dCmdSetOTableBase64)); 75 } 76 77 if (NT_SUCCESS(Status)) 78 SvgaCmdBufFlush(pSvga); 79 80 int rc = RTR0MemObjFree(pSvga->hMemObjOTables, true); 81 AssertRCStmt(rc, Status = STATUS_INVALID_PARAMETER); 82 pSvga->hMemObjOTables = NIL_RTR0MEMOBJ; 83 } 84 return Status; 85 } 57 86 58 87 static NTSTATUS svgaCBContextEnable(VBOXWDDM_EXT_VMSVGA *pSvga, SVGACBContext CBContext, bool fEnable) … … 70 99 } 71 100 72 73 static NTSTATUS svgaHwInit(VBOXWDDM_EXT_VMSVGA *pSvga) 101 static void svgaHwStop(VBOXWDDM_EXT_VMSVGA *pSvga) 102 { 103 /* Undo svgaHwStart. */ 104 105 /* Send commands to host. */ 106 if (pSvga->u32Caps & SVGA_CAP_GBOBJECTS) 107 SvgaObjectTablesDestroy(pSvga); 108 109 /* Give the host some time to process them. */ 110 LARGE_INTEGER Interval; 111 Interval.QuadPart = -(int64_t)100 /* ms */ * 10000; 112 KeDelayExecutionThread(KernelMode, FALSE, &Interval); 113 114 /* Disable IRQs. */ 115 SVGARegWrite(pSvga, SVGA_REG_IRQMASK, 0); 116 117 if (pSvga->pCBState) 118 svgaCBContextEnable(pSvga, SVGA_CB_CONTEXT_0, false); 119 120 /* Disable SVGA. */ 121 SVGARegWrite(pSvga, SVGA_REG_ENABLE, SVGA_REG_ENABLE_DISABLE); 122 123 if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS) 124 SvgaCmdBufDestroy(pSvga); 125 } 126 127 static NTSTATUS svgaHwStart(VBOXWDDM_EXT_VMSVGA *pSvga) 74 128 { 75 129 pSvga->u32Caps = SVGARegRead(pSvga, SVGA_REG_CAPABILITIES); … … 163 217 } 164 218 165 /** @todo svgaHwStop(VBOXWDDM_EXT_VMSVGA *pSvga) to undo svgaHwInit */ 166 if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS) 167 { 168 /// @todo SvgaObjectTablesDestroy(pSvga); 169 SvgaCmdBufDestroy(pSvga); 170 } 171 172 /* Disable SVGA device. */ 173 SVGARegWrite(pSvga, SVGA_REG_IRQMASK, 0); 174 SVGARegWrite(pSvga, SVGA_REG_ENABLE, SVGA_REG_ENABLE_DISABLE); 219 svgaHwStop(pSvga); 175 220 176 221 Status = pDxgkInterface->DxgkCbUnmapMemory(pDxgkInterface->DeviceHandle, … … 223 268 if (u32SvgaId == SVGA_ID_2) 224 269 { 225 Status = svgaHwInit(pSvga); 226 270 Status = svgaHwStart(pSvga); 227 271 if (NT_SUCCESS(Status)) 228 272 { -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r94631 r94635 124 124 RTLISTANCHOR QueuePending; /* Buffers which will be submitted to the host. */ 125 125 RTLISTANCHOR QueueSubmitted; /* Buffers which are being processed by the host. */ 126 RTLISTANCHOR QueuePreempted; /* Preempted buffers. */127 126 uint32_t cSubmitted; /* How many buffers were submitted to the host. 128 127 * Less than SVGA_CB_MAX_QUEUED_PER_CONTEXT */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/SvgaFifo.cpp
r94631 r94635 785 785 --pCBCtx->cSubmitted; 786 786 } 787 788 /* Try to submit pending buffers. */ 789 while (!RTListIsEmpty(&pCBCtx->QueuePending)) 790 { 791 if (pCBCtx->cSubmitted >= SVGA_CB_MAX_QUEUED_PER_CONTEXT - 1) 792 break; 793 794 PVMSVGACB pCB = RTListGetFirst(&pCBCtx->QueuePending, VMSVGACB, nodeQueue); 795 RTListNodeRemove(&pCB->nodeQueue); 796 797 RTListAppend(&pCBCtx->QueueSubmitted, &pCB->nodeQueue); 798 ++pCBCtx->cSubmitted; 799 svgaCBSubmitHeader(pSvga, pCB->CBHeaderPhysAddr, (SVGACBContext)i); 800 GALOG(("Submitted pending %p\n", pCB)); 801 } 787 802 } 788 803 KeReleaseSpinLock(&pCBState->SpinLock, OldIrql); … … 828 843 NTSTATUS SvgaCmdBufDestroy(PVBOXWDDM_EXT_VMSVGA pSvga) 829 844 { 830 /** @todo implement */831 845 PVMSVGACBSTATE pCBState = pSvga->pCBState; 832 846 if (pCBState == NULL) … … 834 848 pSvga->pCBState = NULL; 835 849 850 for (unsigned i = 0; i < RT_ELEMENTS(pCBState->aCBContexts); ++i) 851 { 852 PVMSVGACBCONTEXT pCBCtx = &pCBState->aCBContexts[i]; 853 PVMSVGACB pIter, pNext; 854 RTListForEachSafe(&pCBCtx->QueueSubmitted, pIter, pNext, VMSVGACB, nodeQueue) 855 { 856 RTListNodeRemove(&pIter->nodeQueue); 857 svgaCBFree(pCBState, pIter); 858 } 859 RTListForEachSafe(&pCBCtx->QueuePending, pIter, pNext, VMSVGACB, nodeQueue) 860 { 861 RTListNodeRemove(&pIter->nodeQueue); 862 svgaCBFree(pCBState, pIter); 863 } 864 } 865 866 if (pCBState->pCBCurrent) 867 { 868 svgaCBFree(pCBState, pCBState->pCBCurrent); 869 pCBState->pCBCurrent = NULL; 870 } 871 872 svgaCBHeaderPoolDestroy(&pCBState->HeaderPool); 873 836 874 GaMemFree(pCBState); 837 875 return STATUS_SUCCESS; … … 851 889 RTListInit(&pCBCtx->QueuePending); 852 890 RTListInit(&pCBCtx->QueueSubmitted); 853 RTListInit(&pCBCtx->QueuePreempted);854 891 //pCBCtx->cSubmitted = 0; 855 892 }
Note:
See TracChangeset
for help on using the changeset viewer.