Changeset 30942 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Timestamp:
- Jul 20, 2010 6:59:43 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r30705 r30942 299 299 PDEVICE_OBJECT pPDO; 300 300 301 uint8_t * pvVisibleVram; 302 301 303 VBOXVIDEOCM_MGR CmMgr; 302 304 LIST_ENTRY ContextList3D; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r30169 r30942 1023 1023 #endif 1024 1024 1025 rc = VBoxMapAdapterMemory(PrimaryExtension, (void**)&PrimaryExtension->pvVisibleVram, 1026 0, 1027 vboxWddmVramCpuVisibleSize(PrimaryExtension)); 1028 Assert(rc == VINF_SUCCESS); 1029 if (rc != VINF_SUCCESS) 1030 PrimaryExtension->pvVisibleVram = NULL; 1031 1025 1032 if (RT_FAILURE(rc)) 1026 1033 PrimaryExtension->u.primary.bHGSMI = FALSE; … … 1049 1056 { 1050 1057 int rc = VINF_SUCCESS; 1058 1059 Assert(PrimaryExtension->pvVisibleVram); 1060 if (PrimaryExtension->pvVisibleVram) 1061 VBoxUnmapAdapterMemory(PrimaryExtension, (void**)&PrimaryExtension->pvVisibleVram, vboxWddmVramCpuVisibleSize(PrimaryExtension)); 1062 1051 1063 for (int i = PrimaryExtension->u.primary.cDisplays-1; i >= 0; --i) 1052 1064 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
r30865 r30942 303 303 * @param pDevExt 304 304 */ 305 NTSTATUS vboxVdmaGgDirtyRectsProcess(VBOXVDMAPIPE_CMD_RECTSINFO *pRectsInfo)305 static NTSTATUS vboxVdmaGgDirtyRectsProcess(VBOXVDMAPIPE_CMD_RECTSINFO *pRectsInfo) 306 306 { 307 307 PVBOXWDDM_CONTEXT pContext = pRectsInfo->pContext; … … 496 496 } 497 497 498 static NTSTATUS vboxVdmaGgDmaColorFill(PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCF) 499 { 500 NTSTATUS Status = STATUS_UNSUCCESSFUL; 501 PVBOXWDDM_CONTEXT pContext = pCF->pContext; 502 PDEVICE_EXTENSION pDevExt = pContext->pDevice->pAdapter; 503 Assert (pDevExt->pvVisibleVram); 504 if (pDevExt->pvVisibleVram) 505 { 506 PVBOXWDDM_ALLOCATION pAlloc = pCF->pAllocation; 507 Assert(pAlloc->offVram != VBOXVIDEOOFFSET_VOID); 508 if (pAlloc->offVram != VBOXVIDEOOFFSET_VOID) 509 { 510 uint8_t *pvMem = pDevExt->pvVisibleVram + pAlloc->offVram; 511 UINT bpp = pAlloc->SurfDesc.bpp; 512 Assert(bpp); 513 Assert(((bpp * pAlloc->SurfDesc.width) >> 3) == pAlloc->SurfDesc.pitch); 514 switch (bpp) 515 { 516 case 32: 517 { 518 uint8_t bytestPP = bpp >> 3; 519 for (UINT i = 0; i < pCF->Rects.cRects; ++i) 520 { 521 RECT *pRect = &pCF->Rects.aRects[i]; 522 for (LONG ir = pRect->top; ir < pRect->bottom; ++ir) 523 { 524 uint32_t * pvU32Mem = (uint32_t*)(pvMem + (ir * pAlloc->SurfDesc.pitch) + (pRect->left * bytestPP)); 525 uint32_t cRaw = (pRect->right - pRect->left) * bytestPP; 526 Assert(pRect->left >= 0); 527 Assert(pRect->right <= (LONG)pAlloc->SurfDesc.width); 528 Assert(pRect->top >= 0); 529 Assert(pRect->bottom <= (LONG)pAlloc->SurfDesc.height); 530 for (UINT j = 0; j < cRaw; ++j) 531 { 532 *pvU32Mem = pCF->Color; 533 ++pvU32Mem; 534 } 535 } 536 } 537 Status = STATUS_SUCCESS; 538 break; 539 } 540 case 16: 541 case 8: 542 default: 543 AssertBreakpoint(); 544 break; 545 } 546 } 547 } 548 549 NTSTATUS cmplStatus = vboxWddmDmaCmdNotifyCompletion(pDevExt, pContext, pCF->SubmissionFenceId); 550 Assert(cmplStatus == STATUS_SUCCESS); 551 return Status; 552 } 498 553 499 554 static VOID vboxVdmaGgWorkerThread(PVOID pvUser) … … 524 579 break; 525 580 } 526 case VBOXVDMAPIPE_CMD_TYPE_DMACMD: 581 case VBOXVDMAPIPE_CMD_TYPE_DMACMD_CLRFILL: 582 { 583 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCF = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)pDr; 584 Status = vboxVdmaGgDmaColorFill(pCF); 585 Assert(Status == STATUS_SUCCESS); 586 break; 587 } 527 588 default: 528 589 AssertBreakpoint(); … … 620 681 #endif 621 682 622 static int vboxVdmaInformHost 683 static int vboxVdmaInformHost(PDEVICE_EXTENSION pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMA_CTL_TYPE enmCtl) 623 684 { 624 685 int rc = VINF_SUCCESS; … … 674 735 675 736 /* create a DMACommand buffer */ 676 int vboxVdmaCreate 737 int vboxVdmaCreate(PDEVICE_EXTENSION pDevExt, VBOXVDMAINFO *pInfo, ULONG offBuffer, ULONG cbBuffer) 677 738 { 678 739 Assert((offBuffer & 0xfff) == 0); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
r30484 r30942 58 58 VBOXVDMAPIPE_CMD_TYPE_UNDEFINED = 0, 59 59 VBOXVDMAPIPE_CMD_TYPE_RECTSINFO = 1, 60 VBOXVDMAPIPE_CMD_TYPE_DMACMD = 260 VBOXVDMAPIPE_CMD_TYPE_DMACMD_CLRFILL = 2 61 61 } VBOXVDMAPIPE_CMD_TYPE; 62 62 … … 81 81 VBOXVDMAPIPE_RECTS ContextsRects; 82 82 } VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO; 83 84 typedef struct VBOXVDMAPIPE_CMD_DMACMD_CLRFILL 85 { 86 VBOXVDMAPIPE_CMD_DR Hdr; 87 struct VBOXWDDM_CONTEXT *pContext; 88 struct VBOXWDDM_ALLOCATION *pAllocation; 89 UINT SubmissionFenceId; 90 UINT Color; 91 VBOXWDDM_RECTS_INFO Rects; 92 } VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, *PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL; 83 93 84 94 typedef struct VBOXVDMAGG -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r30926 r30942 698 698 dfprintf(("==> "__FUNCTION__ ", context(0x%p)\n", MiniportDeviceContext)); 699 699 700 vboxVDbgBreakF ();700 vboxVDbgBreakFv(); 701 701 702 702 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext; … … 734 734 dfprintf(("==> "__FUNCTION__ ", context(0x%p)\n", MiniportDeviceContext)); 735 735 736 vboxVDbgBreakF ();736 vboxVDbgBreakFv(); 737 737 738 738 vboxWddmMemFree(MiniportDeviceContext); … … 1175 1175 dfprintf(("==> "__FUNCTION__ "\n")); 1176 1176 1177 AssertBreakpoint();1177 vboxVDbgBreakFv(); 1178 1178 1179 1179 dfprintf(("<== "__FUNCTION__ "\n")); … … 1962 1962 pPrivateData->SrcAllocInfo.segmentIdAlloc = pSrcAllocationList->SegmentId; 1963 1963 pPrivateData->SrcAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pSrcAllocationList->PhysicalAddress.QuadPart; 1964 break; 1965 } 1966 case VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL: 1967 { 1968 Assert(pPatch->PatchLocationListSubmissionLength == 1); 1969 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[pPatch->PatchLocationListSubmissionStart]; 1970 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_DESTINATION_INDEX); 1971 Assert(pPatchList->PatchOffset == 0); 1972 const DXGK_ALLOCATIONLIST *pDstAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1973 Assert(pDstAllocationList->SegmentId); 1974 pPrivateData->DstAllocInfo.segmentIdAlloc = pDstAllocationList->SegmentId; 1975 pPrivateData->DstAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pDstAllocationList->PhysicalAddress.QuadPart; 1976 break; 1964 1977 } 1965 1978 default: … … 2006 2019 { 2007 2020 PDEVICE_EXTENSION pDevExt; 2008 PVBOXWDDM_ DMA_PRIVATEDATA_HDR pTransactionData;2021 PVBOXWDDM_CONTEXT pContext; 2009 2022 UINT SubmissionFenceId; 2010 2023 } VBOXWDDM_SHADOW_UPDATE_COMPLETION, *PVBOXWDDM_SHADOW_UPDATE_COMPLETION; … … 2019 2032 notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED; 2020 2033 notify.DmaCompleted.SubmissionFenceId = pdc->SubmissionFenceId; 2021 notify.DmaCompleted.NodeOrdinal = pdc->p TransactionData->pContext->NodeOrdinal;2034 notify.DmaCompleted.NodeOrdinal = pdc->pContext->NodeOrdinal; 2022 2035 notify.DmaCompleted.EngineOrdinal = 0; 2023 pdc->pTransactionData->pContext->uLastCompletedCmdFenceId = pdc->SubmissionFenceId;2024 2036 2025 2037 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, ¬ify); … … 2030 2042 2031 2043 return bDpcQueued; 2044 } 2045 2046 NTSTATUS vboxWddmDmaCmdNotifyCompletion(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, UINT SubmissionFenceId) 2047 { 2048 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 2049 context.pDevExt = pDevExt; 2050 context.pContext = pContext; 2051 context.SubmissionFenceId = SubmissionFenceId; 2052 BOOLEAN bRet; 2053 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 2054 pDevExt->u.primary.DxgkInterface.DeviceHandle, 2055 vboxWddmNotifyShadowUpdateCompletion, 2056 &context, 2057 0, /* IN ULONG MessageNumber */ 2058 &bRet); 2059 Assert(Status == STATUS_SUCCESS); 2060 return Status; 2032 2061 } 2033 2062 #endif … … 2077 2106 2078 2107 PVBOXWDDM_DMA_PRIVATEDATA_HDR pPrivateData = (PVBOXWDDM_DMA_PRIVATEDATA_HDR)((uint8_t*)pSubmitCommand->pDmaBufferPrivateData + pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset); 2079 BOOLEAN bRet;2080 2108 Assert(pPrivateData); 2081 2109 switch (pPrivateData->enmCmd) … … 2090 2118 /* get DPC data at IRQL */ 2091 2119 2092 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 2093 context.pDevExt = pDevExt; 2094 context.pTransactionData = pPrivateData; 2095 context.SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 2096 Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 2097 pDevExt->u.primary.DxgkInterface.DeviceHandle, 2098 vboxWddmNotifyShadowUpdateCompletion, 2099 &context, 2100 0, /* IN ULONG MessageNumber */ 2101 &bRet); 2120 Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pPrivateData->pContext, pSubmitCommand->SubmissionFenceId); 2102 2121 break; 2103 2122 } … … 2182 2201 } 2183 2202 2184 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 2185 context.pDevExt = pDevExt; 2186 context.pTransactionData = pPrivateData; 2187 context.SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 2188 Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 2189 pDevExt->u.primary.DxgkInterface.DeviceHandle, 2190 vboxWddmNotifyShadowUpdateCompletion, 2191 &context, 2192 0, /* IN ULONG MessageNumber */ 2193 &bRet); 2203 Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pPrivateData->pContext, pSubmitCommand->SubmissionFenceId); 2194 2204 break; 2195 2205 } … … 2217 2227 } 2218 2228 2219 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; 2220 context.pDevExt = pDevExt; 2221 context.pTransactionData = pPrivateData; 2222 context.SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 2223 Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 2224 pDevExt->u.primary.DxgkInterface.DeviceHandle, 2225 vboxWddmNotifyShadowUpdateCompletion, 2226 &context, 2227 0, /* IN ULONG MessageNumber */ 2228 &bRet); 2229 Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pPrivateData->pContext, pSubmitCommand->SubmissionFenceId); 2230 break; 2231 } 2232 case VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL: 2233 { 2234 PVBOXWDDM_DMA_PRESENT_CLRFILL pCF = (PVBOXWDDM_DMA_PRESENT_CLRFILL)pPrivateData; 2235 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pSubmitCommand->hContext; 2236 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCFCmd = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, Rects.aRects[pCF->Rects.cRects])); 2237 NTSTATUS submStatus = STATUS_UNSUCCESSFUL; 2238 Assert(pCFCmd); 2239 if (pCFCmd) 2240 { 2241 PVBOXWDDM_ALLOCATION pDstAlloc = pPrivateData->DstAllocInfo.pAlloc; 2242 Assert(pDstAlloc); 2243 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 2244 && pDstAlloc->bAssigned) 2245 { 2246 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->DstAllocInfo.srcId]; 2247 Assert(pSource->pPrimaryAllocation == pDstAlloc); 2248 2249 Assert(pSource->pShadowAllocation); 2250 if (pSource->pShadowAllocation) 2251 pDstAlloc = pSource->pShadowAllocation; 2252 } 2253 pCFCmd->pContext = pContext; 2254 pCFCmd->pAllocation = pDstAlloc; 2255 pCFCmd->SubmissionFenceId = pSubmitCommand->SubmissionFenceId; 2256 pCFCmd->Color = pCF->Color; 2257 memcpy(&pCFCmd->Rects, &pCF->Rects, RT_OFFSETOF(VBOXWDDM_RECTS_INFO, aRects[pCF->Rects.cRects])); 2258 submStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pCFCmd->Hdr); 2259 Assert(submStatus == STATUS_SUCCESS); 2260 if (submStatus != STATUS_SUCCESS) 2261 vboxVdmaGgCmdDestroy(&pCFCmd->Hdr); 2262 } 2263 2264 if (submStatus != STATUS_SUCCESS) 2265 { 2266 Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pPrivateData->pContext, pSubmitCommand->SubmissionFenceId); 2267 } 2268 /* else - command will be completed in the clrfill handler */ 2269 2229 2270 break; 2230 2271 } … … 4088 4129 { 4089 4130 Assert(pPresent->Flags.Value == 4); /* only Blt is set, we do not support anything else for now */ 4131 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D); 4090 4132 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 4091 4133 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); … … 4114 4156 Status = STATUS_INVALID_HANDLE; 4115 4157 } 4158 } 4159 else if (pPresent->Flags.ColorFill) 4160 { 4161 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D); 4162 Assert(pPresent->Flags.Value == 2); /* only ColorFill is set, we do not support anything else for now */ 4163 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 4164 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 4165 Assert(pDstAlloc); 4166 if (pDstAlloc) 4167 { 4168 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 4169 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 4170 4171 vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 4172 4173 PVBOXWDDM_DMA_PRESENT_CLRFILL pClrFill = (PVBOXWDDM_DMA_PRESENT_CLRFILL)pPrivateData; 4174 pClrFill->Color = pPresent->Color; 4175 pClrFill->Rects.cRects = 0; 4176 UINT cbHead = RT_OFFSETOF(VBOXWDDM_DMA_PRESENT_CLRFILL, Rects.aRects[0]); 4177 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 4178 UINT cbRects = (pPresent->SubRectCnt - pPresent->MultipassOffset) * sizeof (RECT); 4179 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbHead + cbRects; 4180 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 4181 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 4182 cbCmd -= cbHead; 4183 Assert(cbCmd < UINT32_MAX/2); 4184 Assert(cbCmd > sizeof (RECT)); 4185 if (cbCmd >= cbRects) 4186 { 4187 cbCmd -= cbRects; 4188 memcpy(&pClrFill->Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbRects); 4189 pClrFill->Rects.cRects += cbRects/sizeof (RECT); 4190 } 4191 else 4192 { 4193 UINT cbFitingRects = (cbCmd/sizeof (RECT)) * sizeof (RECT); 4194 Assert(cbFitingRects); 4195 memcpy(&pClrFill->Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbFitingRects); 4196 cbCmd -= cbFitingRects; 4197 pPresent->MultipassOffset += cbFitingRects/sizeof (RECT); 4198 pClrFill->Rects.cRects += cbFitingRects/sizeof (RECT); 4199 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 4200 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 4201 } 4202 4203 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 4204 pPresent->pPatchLocationListOut->PatchOffset = 0; 4205 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 4206 ++pPresent->pPatchLocationListOut; 4207 } 4208 else 4209 { 4210 /* this should not happen actually */ 4211 drprintf((__FUNCTION__": failed to get pDst Allocation info for hDeviceSpecificAllocation(0x%x)\n",pDst->hDeviceSpecificAllocation)); 4212 Status = STATUS_INVALID_HANDLE; 4213 } 4214 4116 4215 } 4117 4216 else -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r30566 r30942 49 49 VOID vboxWddmMemFree(PVOID pvMem); 50 50 51 NTSTATUS vboxWddmDmaCmdNotifyCompletion(PDEVICE_EXTENSION pDevExt, struct VBOXWDDM_CONTEXT *pContext, UINT SubmissionFenceId); 52 51 53 /* allocation */ 52 54 //#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U) … … 187 189 } VBOXVDMACMD_DMA_PRESENT_FLIP, *PVBOXVDMACMD_DMA_PRESENT_FLIP; 188 190 191 typedef struct VBOXWDDM_DMA_PRESENT_CLRFILL 192 { 193 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr; 194 UINT Color; 195 VBOXWDDM_RECTS_INFO Rects; 196 } VBOXWDDM_DMA_PRESENT_CLRFILL, *PVBOXWDDM_DMA_PRESENT_CLRFILL; 189 197 190 198 typedef struct VBOXWDDM_OPENALLOCATION
Note:
See TracChangeset
for help on using the changeset viewer.