Changeset 51036 in vbox
- Timestamp:
- Apr 10, 2014 12:38:51 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/VBoxMPVbva.cpp
r50947 r51036 930 930 } 931 931 932 int VBoxCmdVbvaSubmit(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, struct VBOXCMDVBVA_HDR *pCmd, uint32_t cbCmd)932 int VBoxCmdVbvaSubmit(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, struct VBOXCMDVBVA_HDR *pCmd, uint32_t u32FenceID, uint32_t cbCmd) 933 933 { 934 934 int rc = VINF_SUCCESS; 935 935 936 Assert( pCmd->u32FenceID);936 Assert(u32FenceID); 937 937 938 938 pCmd->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 939 939 #ifdef DEBUG_misha 940 Assert( pCmd->u32FenceID == pVbva->u32FenceSubmitted + 1);940 Assert(u32FenceID == pVbva->u32FenceSubmitted + 1); 941 941 #endif 942 pVbva->u32FenceSubmitted = pCmd->u32FenceID;943 944 942 if (VBoxVBVAExGetSize(&pVbva->Vbva) < cbCmd) 945 943 { … … 989 987 } 990 988 989 pVbva->u32FenceSubmitted = u32FenceID; 990 991 991 Assert(pvBuffer); 992 992 993 993 memcpy(pvBuffer, pCmd, cbCmd); 994 995 ((VBOXCMDVBVA_HDR*)pvBuffer)->u32FenceID = u32FenceID; 994 996 995 997 VBoxVBVAExBufferEndUpdate(&pVbva->Vbva); … … 1187 1189 *pcPagesWritten = i; 1188 1190 Assert(cbInitBuffer - cbBuffer == RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, Data.aPageNumbers[i])); 1191 Assert(cbInitBuffer - cbBuffer >= sizeof (VBOXCMDVBVA_PAGING_TRANSFER)); 1189 1192 return cbInitBuffer - cbBuffer; 1190 1193 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.h
r50947 r51036 212 212 int VBoxCmdVbvaDestroy(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva); 213 213 int VBoxCmdVbvaCreate(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, ULONG offBuffer, ULONG cbBuffer); 214 int VBoxCmdVbvaSubmit(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, struct VBOXCMDVBVA_HDR *pCmd, uint32_t cbCmd);214 int VBoxCmdVbvaSubmit(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, struct VBOXCMDVBVA_HDR *pCmd, uint32_t u32FenceID, uint32_t cbCmd); 215 215 bool VBoxCmdVbvaPreempt(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t u32FenceID); 216 216 uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r51018 r51036 2096 2096 2097 2097 pQsOut->PagingBufferSegmentId = 0; 2098 pQsOut->PagingBufferSize = 0xc00;2099 pQsOut->PagingBufferPrivateDataSize = 0;2098 pQsOut->PagingBufferSize = PAGE_SIZE; 2099 pQsOut->PagingBufferPrivateDataSize = PAGE_SIZE; 2100 2100 } 2101 2101 } … … 3107 3107 #endif 3108 3108 3109 /* the DMA command buffer is located in system RAM, the host will need to pick it from there */3110 //BufInfo.fFlags = 0; /* see VBOXVDMACBUF_FLAG_xx */3109 uint32_t cbCmd = pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset - pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset; 3110 uint32_t cbDma = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset; 3111 3111 VBOXCMDVBVA_HDR *pHdr; 3112 VBOXCMDVBVA_SYSMEMCMD SysMem; 3113 uint32_t cbCmd = pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset - pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset; 3114 if (!cbCmd) 3115 { 3116 cbCmd = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset; 3117 if (!cbCmd || VBOXWDDM_DUMMY_DMABUFFER_SIZE == cbCmd) 3118 { 3119 SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 3120 SysMem.Hdr.u8Flags = 0; 3121 SysMem.Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3122 cbCmd = sizeof (SysMem.Hdr); 3123 } 3124 else 3125 { 3126 if (cbCmd < sizeof (VBOXCMDVBVA_HDR)) 3127 { 3128 WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)", 3129 pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset, 3130 pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset, 3131 sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))); 3132 return STATUS_INVALID_PARAMETER; 3133 } 3134 3135 if (cbCmd > 0xffff) 3136 { 3137 WARN(("cbCmd too big")); 3138 return STATUS_INVALID_PARAMETER; 3139 } 3140 3141 SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_SYSMEMCMD; 3142 SysMem.Hdr.u8Flags = cbCmd & 0xff; 3143 SysMem.Hdr.u.u8PrimaryID = (cbCmd >> 8) & 0xff; 3144 SysMem.Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3112 VBOXCMDVBVA_HDR NopCmd; 3113 if (cbCmd < sizeof (VBOXCMDVBVA_HDR)) 3114 { 3115 if (cbCmd) 3116 { 3117 WARN(("invalid command data")); 3118 return STATUS_INVALID_PARAMETER; 3119 } 3120 NopCmd.u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 3121 NopCmd.u8Flags = 0; 3122 NopCmd.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3123 NopCmd.u32FenceID = sizeof (VBOXCMDVBVA_HDR); 3124 cbCmd = sizeof (VBOXCMDVBVA_HDR); 3125 pHdr = &NopCmd; 3126 } 3127 else 3128 { 3129 pHdr = (VBOXCMDVBVA_HDR*)(((uint8_t*)pSubmitCommand->pDmaBufferPrivateData) + pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset); 3130 if (cbCmd != pHdr->u32FenceID) 3131 { 3132 WARN(("partial submission start!")); 3133 cbCmd = pHdr->u32FenceID; 3134 } 3135 } 3136 3137 switch (pHdr->u8OpCode) 3138 { 3139 case VBOXCMDVBVA_OPTYPE_SYSMEMCMD: 3140 { 3141 VBOXCMDVBVA_SYSMEMCMD *pSysMem = (VBOXCMDVBVA_SYSMEMCMD*)pHdr; 3145 3142 if (pSubmitCommand->DmaBufferPhysicalAddress.QuadPart & PAGE_OFFSET_MASK) 3146 3143 { … … 3148 3145 return STATUS_INVALID_PARAMETER; 3149 3146 } 3150 SysMem.phCmd = (VBOXCMDVBVAPHADDR)(pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset); 3151 3152 cbCmd = sizeof (SysMem); 3153 } 3154 3155 pHdr = &SysMem.Hdr; 3156 } 3157 else 3158 { 3159 if (cbCmd < sizeof (VBOXCMDVBVA_HDR)) 3160 { 3161 WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)", 3162 pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset, 3163 pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset, 3164 sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))); 3165 return STATUS_INVALID_PARAMETER; 3166 } 3167 3168 pHdr = (VBOXCMDVBVA_HDR*)((uint8_t*)pSubmitCommand->pDmaBufferPrivateData + pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset); 3169 } 3170 3171 pHdr->u32FenceID = pSubmitCommand->SubmissionFenceId; 3172 int rc = VBoxCmdVbvaSubmit(pDevExt, &pDevExt->CmdVbva, pHdr, cbCmd); 3147 pSysMem->phCmd = (VBOXCMDVBVAPHADDR)(pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset); 3148 #ifdef DEBUG 3149 { 3150 uint32_t cbRealDmaCmd = (pSysMem->Hdr.u8Flags | (pSysMem->Hdr.u.u8PrimaryID << 8)); 3151 Assert(cbRealDmaCmd >= cbDma); 3152 if (cbDma < cbRealDmaCmd) 3153 WARN(("parrtial sysmem transfer")); 3154 } 3155 #endif 3156 break; 3157 } 3158 default: 3159 break; 3160 } 3161 3162 int rc = VBoxCmdVbvaSubmit(pDevExt, &pDevExt->CmdVbva, pHdr, pSubmitCommand->SubmissionFenceId, cbCmd); 3173 3163 if (RT_SUCCESS(rc)) 3174 3164 return STATUS_SUCCESS; … … 3442 3432 #endif 3443 3433 3434 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_SYSMEMCMD)) 3435 { 3436 WARN(("private data too small")); 3437 return STATUS_INVALID_PARAMETER; 3438 } 3439 3444 3440 Assert(!pBuildPagingBuffer->Transfer.MdlOffset); 3445 3441 … … 3476 3472 pPaging->Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3477 3473 pPaging->Hdr.u32FenceID = 0; 3478 3479 3474 3480 3475 PMDL pMdl; … … 3528 3523 pBuildPagingBuffer->MultipassOffset = 0; 3529 3524 3525 VBOXCMDVBVA_SYSMEMCMD *pSysMemCmd = (VBOXCMDVBVA_SYSMEMCMD*)pBuildPagingBuffer->pDmaBufferPrivateData; 3526 pSysMemCmd->Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_SYSMEMCMD; 3527 pSysMemCmd->Hdr.u8Flags = cbBuffer & 0xff; 3528 pSysMemCmd->Hdr.u.u8PrimaryID = (cbBuffer >> 8) & 0xff; 3529 pSysMemCmd->Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3530 pSysMemCmd->Hdr.u32FenceID = sizeof (*pSysMemCmd); 3531 pSysMemCmd->phCmd = 0; 3532 3533 cbPrivateData = sizeof (*pSysMemCmd); 3534 3530 3535 break; 3531 3536 } … … 3539 3544 return STATUS_INVALID_PARAMETER; 3540 3545 } 3546 3547 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR)) 3548 { 3549 WARN(("private data too small")); 3550 return STATUS_INVALID_PARAMETER; 3551 } 3552 3553 VBOXCMDVBVA_HDR *pHdr = (VBOXCMDVBVA_HDR*)pBuildPagingBuffer->pDmaBufferPrivateData; 3554 pHdr->u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 3555 pHdr->u8Flags = 0; 3556 pHdr->u.u8PrimaryID = 0; 3557 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3558 pHdr->u32FenceID = sizeof (*pHdr); 3559 3560 cbPrivateData = sizeof (*pHdr); 3541 3561 /** @todo: add necessary bits */ 3542 3562 // WARN(("Impl!")); … … 3562 3582 } 3563 3583 3564 Assert(!cbPrivateData);3565 3566 3584 Assert(pBuildPagingBuffer->Operation == DXGK_OPERATION_DISCARD_CONTENT || cbBuffer); 3585 Assert(cbBuffer <= pBuildPagingBuffer->DmaSize); 3586 Assert(cbBuffer == 0 || cbBuffer >= sizeof (VBOXCMDVBVA_PAGING_TRANSFER) || cbBuffer == VBOXWDDM_DUMMY_DMABUFFER_SIZE); 3587 AssertCompile(VBOXWDDM_DUMMY_DMABUFFER_SIZE < 8); 3567 3588 pBuildPagingBuffer->pDmaBuffer = ((uint8_t*)pBuildPagingBuffer->pDmaBuffer) + cbBuffer; 3568 3589 pBuildPagingBuffer->pDmaBufferPrivateData = ((uint8_t*)pBuildPagingBuffer->pDmaBufferPrivateData) + cbPrivateData; … … 5827 5848 uint32_t cbBuffer = 0; 5828 5849 uint32_t cbPrivateData = 0; 5850 uint32_t cbCmd = 0; 5829 5851 VBOXCMDVBVA_HDR* pCmd = (VBOXCMDVBVA_HDR*)pRender->pDmaBufferPrivateData; 5830 5852 … … 5915 5937 } 5916 5938 5939 cbCmd = cbPrivateData; 5940 5917 5941 break; 5918 5942 } … … 5946 5970 } 5947 5971 5972 cbCmd = cbPrivateData; 5973 5948 5974 break; 5949 5975 } … … 5959 5985 5960 5986 pCmd->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 5961 /* sanity */ 5962 pCmd->u32FenceID = 0; 5987 pCmd->u32FenceID = cbPrivateData; 5963 5988 } 5964 5989 __except (EXCEPTION_EXECUTE_HANDLER) … … 5967 5992 WARN(("invalid parameter")); 5968 5993 } 5969 // LOGF(("LEAVE, hContext(0x%x)", hContext));5970 5971 return Status;5972 5973 5994 // LOGF(("LEAVE, hContext(0x%x)", hContext)); 5974 5995 … … 6516 6537 6517 6538 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 6518 /* sanity */ 6519 pHdr->u32FenceID = 0;6539 6540 pHdr->u32FenceID = cbPrivateData; 6520 6541 6521 6542 Assert(cbBuffer);
Note:
See TracChangeset
for help on using the changeset viewer.