Changeset 50913 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Mar 27, 2014 5:56:50 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp
r50859 r50913 519 519 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); 520 520 521 PVBOXMP_CRSHGSMITRANSPORT pCon ;521 PVBOXMP_CRSHGSMITRANSPORT pCon = (PVBOXMP_CRSHGSMITRANSPORT)pvContext; 522 522 PVBOXMP_DEVEXT pDevExt = pCon->pDevExt; 523 523 VBOXCMDVBVA_CRCMD_CMD *pCmd; … … 1031 1031 } 1032 1032 1033 #if 1 /*def DEBUG_misha*/1033 #ifndef DEBUG_misha 1034 1034 g_VBoxMpCrHostCaps &= ~CR_VBOX_CAP_CMDVBVA; 1035 1035 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
r50859 r50913 174 174 static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 175 175 { 176 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, 0);176 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ); 177 177 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr); 178 178 if (offCmd == HGSMIOFFSET_VOID) … … 293 293 // LogFunc(("flags = 0x%08X\n", pCtx->pVBVA? pCtx->pVBVA->u32HostEvents: -1)); 294 294 295 if ( pCtx->pVBVA 296 && (pCtx->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED)) 295 Assert(pCtx->pVBVA); 296 /* we do not use u32HostEvents & VBVA_F_MODE_ENABLED, 297 * VBVA stays enabled once ENABLE call succeeds, until it is disabled with DISABLED call */ 298 // if ( pCtx->pVBVA 299 // && (pCtx->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED)) 297 300 { 298 301 uint32_t indexRecordNext; … … 366 369 } 367 370 371 DECLINLINE(bool) vboxVBVAExIsEntryInRangeOrEmpty(uint32_t u32First, uint32_t u32Entry, uint32_t u32Free) 372 { 373 return vboxVBVAExIsEntryInRange(u32First, u32Entry, u32Free) 374 || ( u32First == u32Entry 375 && u32Entry == u32Free); 376 } 368 377 #ifdef DEBUG 369 378 … … 371 380 { 372 381 VBVABUFFER *pVBVA = pCtx->pVBVA; 373 if (!vboxVBVAExIsEntryInRange (pCtx->indexRecordFirstUncompleted, pVBVA->indexRecordFirst, pVBVA->indexRecordFree))382 if (!vboxVBVAExIsEntryInRangeOrEmpty(pCtx->indexRecordFirstUncompleted, pVBVA->indexRecordFirst, pVBVA->indexRecordFree)) 374 383 { 375 384 WARN(("invalid record set")); 376 385 } 377 386 378 if (!vboxVBVAExIsEntryInRange (pCtx->off32DataUncompleted, pVBVA->off32Data, pVBVA->off32Free))387 if (!vboxVBVAExIsEntryInRangeOrEmpty(pCtx->off32DataUncompleted, pVBVA->off32Data, pVBVA->off32Free)) 379 388 { 380 389 WARN(("invalid data set")); … … 904 913 int rc = VINF_SUCCESS; 905 914 915 Assert(pCmd->u32FenceID); 916 906 917 pCmd->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 907 918 pVbva->u32FenceSubmitted = pCmd->u32FenceID; 908 919 909 if (VBoxVBVAExGetSize(&pVbva->Vbva) >cbCmd)920 if (VBoxVBVAExGetSize(&pVbva->Vbva) < cbCmd) 910 921 { 911 922 WARN(("buffer does not fit the vbva buffer, we do not support splitting buffers")); … … 1073 1084 } 1074 1085 1075 1086 #if 0 1076 1087 static uint32_t vboxCVDdiSysMemElBuild(VBOXCMDVBVA_SYSMEMEL *pEl, PMDL pMdl, uint32_t iPfn, uint32_t cPages) 1077 1088 { … … 1103 1114 VBOXCMDVBVA_SYSMEMEL *pEl = pCmd->aSysMem; 1104 1115 1105 if (cbBuffer < sizeof (VBOXCMDVBVA_PAGING_TRANSFER)) 1106 { 1107 WARN(("cbBuffer < sizeof (VBOXCMDVBVA_PAGING_TRANSFER)")); 1108 goto done; 1109 } 1116 Assert(cbBuffer >= sizeof (VBOXCMDVBVA_PAGING_TRANSFER)); 1110 1117 1111 1118 cbBuffer -= RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aSysMem); … … 1116 1123 } 1117 1124 1118 done:1119 1125 *pcPagesWritten = cInitPages - cPages; 1120 1126 return cbInitBuffer - cbBuffer; 1121 1127 } 1128 #endif 1129 1130 uint32_t VBoxCVDdiPTransferVRamSysBuildEls(VBOXCMDVBVA_PAGING_TRANSFER *pCmd, PMDL pMdl, uint32_t iPfn, uint32_t cPages, uint32_t cbBuffer, uint32_t *pcPagesWritten) 1131 { 1132 uint32_t cbInitBuffer = cbBuffer; 1133 uint32_t i = 0; 1134 VBOXCMDVBVAPAGEIDX *pPageNumbers = pCmd->aPageNumbers; 1135 1136 cbBuffer -= RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aPageNumbers); 1137 1138 for (; i < cPages && cbBuffer >= sizeof (*pPageNumbers); ++i, cbBuffer -= sizeof (*pPageNumbers)) 1139 { 1140 pPageNumbers[i] = (VBOXCMDVBVAPAGEIDX)(MmGetMdlPfnArray(pMdl)[iPfn + i]); 1141 } 1142 1143 *pcPagesWritten = i; 1144 Assert(cbInitBuffer - cbBuffer == RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aPageNumbers[i])); 1145 return cbInitBuffer - cbBuffer; 1146 } 1147 1122 1148 1123 1149 int vboxCmdVbvaConConnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, … … 1144 1170 rc = pConnect->Hdr.i32Result; 1145 1171 if (RT_SUCCESS(rc)) 1172 { 1173 Assert(pConnect->Connect.Hdr.u32CmdClientId); 1146 1174 *pu32ClientID = pConnect->Connect.Hdr.u32CmdClientId; 1175 } 1147 1176 else 1148 1177 WARN(("VBOXCMDVBVA3DCTL_TYPE_CONNECT Disable failed %d", rc)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r50898 r50913 1979 1979 memset(pCaps, 0, sizeof (*pCaps)); 1980 1980 #endif 1981 1982 pCaps->HighestAcceptableAddress.QuadPart = ~((uintptr_t)0); 1981 pCaps->HighestAcceptableAddress.LowPart = ~0UL; 1982 #ifdef RT_ARCH_AMD64 1983 /* driver talks to host in terms of page numbers when reffering to RAM 1984 * we use uint32_t field to pass page index to host, so max would be (~0UL) << PAGE_OFFSET, 1985 * which seems quite enough */ 1986 pCaps->HighestAcceptableAddress.HighPart = PAGE_OFFSET_MASK; 1987 #endif 1983 1988 pCaps->MaxPointerWidth = VBOXWDDM_C_POINTER_MAX_WIDTH; 1984 1989 pCaps->MaxPointerHeight = VBOXWDDM_C_POINTER_MAX_HEIGHT; … … 3095 3100 { 3096 3101 cbCmd = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset; 3097 if (cbCmd < sizeof (VBOXCMDVBVA_HDR)) 3098 { 3099 WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)", 3100 pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset, 3101 pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset, 3102 sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))); 3103 return STATUS_INVALID_PARAMETER; 3104 } 3105 3106 if (cbCmd > 0xffff) 3107 { 3108 WARN(("cbCmd too big")); 3109 return STATUS_INVALID_PARAMETER; 3110 } 3111 3112 if (VBOXWDDM_DUMMY_DMABUFFER_SIZE == cbCmd) 3102 if (!cbCmd || VBOXWDDM_DUMMY_DMABUFFER_SIZE == cbCmd) 3113 3103 { 3114 3104 SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; … … 3119 3109 else 3120 3110 { 3111 if (cbCmd < sizeof (VBOXCMDVBVA_HDR)) 3112 { 3113 WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)", 3114 pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset, 3115 pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset, 3116 sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))); 3117 return STATUS_INVALID_PARAMETER; 3118 } 3119 3120 if (cbCmd > 0xffff) 3121 { 3122 WARN(("cbCmd too big")); 3123 return STATUS_INVALID_PARAMETER; 3124 } 3125 3121 3126 SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_SYSMEMCMD; 3122 3127 SysMem.Hdr.u8Flags = cbCmd & 0xff; 3123 3128 SysMem.Hdr.u.u8PrimaryID = (cbCmd >> 8) & 0xff; 3124 3129 SysMem.Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3125 SysMem.phSysMem = pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset; 3126 if (SysMem.phSysMem & PAGE_OFFSET_MASK) 3130 if (pSubmitCommand->DmaBufferPhysicalAddress.QuadPart & PAGE_OFFSET_MASK) 3127 3131 { 3128 3132 WARN(("command should be page aligned for now")); 3129 3133 return STATUS_INVALID_PARAMETER; 3130 3134 } 3135 SysMem.iPage = (VBOXCMDVBVAPAGEIDX)(pSubmitCommand->DmaBufferPhysicalAddress.QuadPart >> PAGE_SHIFT); 3136 3137 cbCmd = sizeof (SysMem); 3131 3138 } 3132 3139 3133 3140 pHdr = &SysMem.Hdr; 3134 cbCmd = sizeof (SysMem);3135 3141 } 3136 3142 else … … 3403 3409 LOGF(("ENTER, context(0x%x)", hAdapter)); 3404 3410 3405 /* paging buffer transfer is nop for hostID allocations */3406 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR))3407 {3408 WARN(("pBuildPagingBuffer->DmaBufferPrivateDataSize(%d) < sizeof VBOXCMDVBVA_HDR (%d)", pBuildPagingBuffer->DmaBufferPrivateDataSize , sizeof (VBOXCMDVBVA_HDR)));3409 /* @todo: can this actually happen? what status to return? */3410 return STATUS_INVALID_PARAMETER;3411 }3412 3413 3411 switch (pBuildPagingBuffer->Operation) 3414 3412 { … … 3471 3469 } 3472 3470 3473 uint32_t cPages = (uint32_t)((pBuildPagingBuffer->Transfer.TransferSize + 0xfff) >> PAGE_SHIFT); 3474 uint32_t cTotalPages = cPages; 3471 Assert(!(pBuildPagingBuffer->Transfer.TransferSize & PAGE_OFFSET_MASK)); 3472 Assert(!(offVRAM & PAGE_OFFSET_MASK)); 3473 uint32_t cPages = (uint32_t)(pBuildPagingBuffer->Transfer.TransferSize >> PAGE_SHIFT); 3474 Assert(cPages > pBuildPagingBuffer->MultipassOffset); 3475 3475 cPages -= pBuildPagingBuffer->MultipassOffset; 3476 uint32_t iFirstPage = pBuildPagingBuffer-> Transfer.MdlOffset + pBuildPagingBuffer->MultipassOffset;3476 uint32_t iFirstPage = pBuildPagingBuffer->MultipassOffset; 3477 3477 uint32_t cPagesWritten; 3478 offVRAM += pBuildPagingBuffer->Transfer.TransferOffset + pBuildPagingBuffer->MultipassOffset;3478 offVRAM += pBuildPagingBuffer->Transfer.TransferOffset + (pBuildPagingBuffer->MultipassOffset << PAGE_SHIFT); 3479 3479 3480 3480 pPaging->Alloc.u.offVRAM = offVRAM; 3481 3481 if (fIn) 3482 3482 pPaging->Hdr.u8Flags |= VBOXCMDVBVA_OPF_PAGING_TRANSFER_IN; 3483 cbBuffer = VBoxCVDdiPTransferVRamSysBuildEls(pPaging, pMdl, iFirstPage, cPages, pBuildPagingBuffer->Dma BufferPrivateDataSize, &cPagesWritten);3483 cbBuffer = VBoxCVDdiPTransferVRamSysBuildEls(pPaging, pMdl, iFirstPage, cPages, pBuildPagingBuffer->DmaSize, &cPagesWritten); 3484 3484 if (cPagesWritten != cPages) 3485 3485 pBuildPagingBuffer->MultipassOffset += cPagesWritten; … … 3500 3500 /** @todo: add necessary bits */ 3501 3501 WARN(("Impl!")); 3502 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 3502 3503 break; 3503 3504 } … … 3510 3511 return STATUS_INVALID_PARAMETER; 3511 3512 } 3513 WARN(("Do we need to do anything here?")); 3512 3514 break; 3513 3515 } … … 3521 3523 Assert(!cbPrivateData); 3522 3524 3525 Assert(pBuildPagingBuffer->Operation == DXGK_OPERATION_DISCARD_CONTENT || cbBuffer); 3523 3526 pBuildPagingBuffer->pDmaBuffer = ((uint8_t*)pBuildPagingBuffer->pDmaBuffer) + cbBuffer; 3524 3527 pBuildPagingBuffer->pDmaBufferPrivateData = ((uint8_t*)pBuildPagingBuffer->pDmaBufferPrivateData) + cbPrivateData; … … 6088 6091 // LOGF(("ENTER, hContext(0x%x)", hContext)); 6089 6092 6090 vboxVDbgBreakF v();6093 vboxVDbgBreakF(); 6091 6094 6092 6095 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext; 6093 6096 PVBOXWDDM_DEVICE pDevice = pContext->pDevice; 6094 6097 PVBOXMP_DEVEXT pDevExt = pDevice->pAdapter; 6098 uint32_t cbBuffer = 0; 6099 uint32_t cbPrivateData = 0; 6095 6100 6096 6101 if (pPresent->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR)) … … 6191 6196 6192 6197 paRects = pBlt->aRects; 6193 cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects); 6198 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects); 6199 cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData; 6194 6200 } 6195 6201 else … … 6214 6220 6215 6221 paRects = pBlt->aRects; 6216 cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects); 6217 } 6222 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects); 6223 cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData; 6224 } 6225 6226 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6218 6227 } 6219 6228 else if (pPresent->Flags.Flip) … … 6247 6256 if (VBoxCVDdiFillAllocInfo(pHdr, &pFlip->src, pSrcAlloc, pSrc, false)) 6248 6257 u32SrcPatch = RT_OFFSETOF(VBOXCMDVBVA_FLIP, src.u.offVRAM); 6258 6259 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6260 cbPrivateData = sizeof (*pFlip); 6249 6261 } 6250 6262 else if (pPresent->Flags.ColorFill) … … 6278 6290 6279 6291 paRects = pCFill->aRects; 6280 cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, aRects); 6292 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, aRects); 6293 cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData; 6294 6295 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6281 6296 } 6282 6297 else … … 6300 6315 pPresent->MultipassOffset = 0; 6301 6316 6317 Assert(cRects); 6302 6318 const RECT *paDstSubRects = &pPresent->pDstSubRects[iStartRect]; 6303 6319 VBoxCVDdiPackRects(paRects, paDstSubRects, cRects); 6320 cbPrivateData += (cRects * sizeof (VBOXCMDVBVA_RECT)); 6304 6321 } 6305 6322 … … 6324 6341 pHdr->u32FenceID = 0; 6325 6342 6326 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6343 Assert(cbBuffer); 6344 Assert(cbPrivateData); 6345 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + cbBuffer; 6346 pPresent->pDmaBufferPrivateData = ((uint8_t*)pPresent->pDmaBufferPrivateData) + cbPrivateData; 6327 6347 6328 6348 if (pPresent->MultipassOffset)
Note:
See TracChangeset
for help on using the changeset viewer.