- Timestamp:
- Jun 24, 2011 12:01:33 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
r37216 r37626 33 33 34 34 /* One would increase this whenever definitions in this file are changed */ 35 #define VBOXVIDEOIF_VERSION 9 35 #define VBOXVIDEOIF_VERSION 10 36 37 #define VBOXWDDM_NODE_ID_SYSTEM 0 38 #define VBOXWDDM_NODE_ID_3D (VBOXWDDM_NODE_ID_SYSTEM) 39 #define VBOXWDDM_NODE_ID_3D_KMT (VBOXWDDM_NODE_ID_3D) 40 #define VBOXWDDM_NODE_ID_2D_VIDEO (VBOXWDDM_NODE_ID_3D_KMT+1) 41 #define VBOXWDDM_NUM_NODES (VBOXWDDM_NODE_ID_2D_VIDEO+1) 42 43 #define VBOXWDDM_ENGINE_ID_SYSTEM 0 44 #if (VBOXWDDM_NODE_ID_3D == VBOXWDDM_NODE_ID_SYSTEM) 45 # define VBOXWDDM_ENGINE_ID_3D (VBOXWDDM_ENGINE_ID_SYSTEM+1) 46 #else 47 # define VBOXWDDM_ENGINE_ID_3D 0 48 #endif 49 #if (VBOXWDDM_NODE_ID_3D_KMT == VBOXWDDM_NODE_ID_3D) 50 # define VBOXWDDM_ENGINE_ID_3D_KMT VBOXWDDM_ENGINE_ID_3D 51 #else 52 # define VBOXWDDM_ENGINE_ID_3D_KMT 0 53 #endif 54 #if (VBOXWDDM_NODE_ID_2D_VIDEO == VBOXWDDM_NODE_ID_3D) 55 # define VBOXWDDM_ENGINE_ID_2D_VIDEO VBOXWDDM_ENGINE_ID_3D 56 #else 57 # define VBOXWDDM_ENGINE_ID_2D_VIDEO 0 58 #endif 59 36 60 37 61 /* create allocation func */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispCm.cpp
r36867 r37626 119 119 Info.u64UmInfo = (uint64_t)pContext; 120 120 121 pContext->ContextInfo.NodeOrdinal = 0; 122 pContext->ContextInfo.EngineAffinity = 0; 121 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 122 { 123 pContext->ContextInfo.NodeOrdinal = VBOXWDDM_NODE_ID_3D; 124 pContext->ContextInfo.EngineAffinity = VBOXWDDM_ENGINE_ID_3D; 125 } 126 else 127 { 128 pContext->ContextInfo.NodeOrdinal = VBOXWDDM_NODE_ID_2D_VIDEO; 129 pContext->ContextInfo.EngineAffinity = VBOXWDDM_ENGINE_ID_2D_VIDEO; 130 } 123 131 pContext->ContextInfo.Flags.Value = 0; 124 132 pContext->ContextInfo.pPrivateDriverData = &Info; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r37423 r37626 890 890 } 891 891 #endif 892 893 typedef struct VBOXWDDMDISP_NSCADD 894 { 895 VOID* pvCommandBuffer; 896 UINT cbCommandBuffer; 897 D3DDDI_ALLOCATIONLIST* pAllocationList; 898 UINT cAllocationList; 899 D3DDDI_PATCHLOCATIONLIST* pPatchLocationList; 900 UINT cPatchLocationList; 901 UINT cAllocations; 902 }VBOXWDDMDISP_NSCADD, *PVBOXWDDMDISP_NSCADD; 903 904 static HRESULT vboxWddmNSCAddAlloc(PVBOXWDDMDISP_NSCADD pData, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bWrite) 905 { 906 HRESULT hr = S_OK; 907 if (pData->cAllocationList && pData->cPatchLocationList && pData->cbCommandBuffer > 4) 908 { 909 memset(pData->pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST)); 910 pData->pAllocationList[0].hAllocation = pAlloc->hAllocation; 911 if (bWrite) 912 pData->pAllocationList[0].WriteOperation = 1; 913 914 memset(pData->pPatchLocationList, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 915 pData->pPatchLocationList[0].PatchOffset = pData->cAllocations*4; 916 pData->pPatchLocationList[0].AllocationIndex = pData->cAllocations; 917 918 pData->cbCommandBuffer -= 4; 919 --pData->cAllocationList; 920 --pData->cPatchLocationList; 921 ++pData->cAllocations; 922 923 ++pData->pAllocationList; 924 ++pData->pPatchLocationList; 925 pData->pvCommandBuffer = (VOID*)(((uint8_t*)pData->pvCommandBuffer) + 4); 926 927 } 928 else 929 hr = S_FALSE; 930 931 return hr; 932 } 933 934 static HRESULT vboxWddmDalNotifyChange(PVBOXWDDMDISP_DEVICE pDevice) 935 { 936 VBOXWDDMDISP_NSCADD NscAdd; 937 BOOL bReinitRenderData = TRUE; 938 939 do 940 { 941 if (bReinitRenderData) 942 { 943 NscAdd.pvCommandBuffer = pDevice->DefaultContext.ContextInfo.pCommandBuffer; 944 NscAdd.cbCommandBuffer = pDevice->DefaultContext.ContextInfo.CommandBufferSize; 945 NscAdd.pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList; 946 NscAdd.cAllocationList = pDevice->DefaultContext.ContextInfo.AllocationListSize; 947 NscAdd.pPatchLocationList = pDevice->DefaultContext.ContextInfo.pPatchLocationList; 948 NscAdd.cPatchLocationList = pDevice->DefaultContext.ContextInfo.PatchLocationListSize; 949 NscAdd.cAllocations = 0; 950 Assert(NscAdd.cbCommandBuffer >= sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)); 951 if (NscAdd.cbCommandBuffer < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)) 952 return E_FAIL; 953 954 PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pHdr = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)NscAdd.pvCommandBuffer; 955 pHdr->enmCmd = VBOXVDMACMD_TYPE_DMA_NOP; 956 NscAdd.pvCommandBuffer = (VOID*)(((uint8_t*)NscAdd.pvCommandBuffer) + sizeof (*pHdr)); 957 NscAdd.cbCommandBuffer -= sizeof (*pHdr); 958 bReinitRenderData = FALSE; 959 } 960 961 EnterCriticalSection(&pDevice->DirtyAllocListLock); 962 963 PVBOXWDDMDISP_ALLOCATION pAlloc = RTListGetFirst(&pDevice->DirtyAllocList, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry); 964 if (pAlloc) 965 { 966 HRESULT tmpHr = vboxWddmNSCAddAlloc(&NscAdd, pAlloc, TRUE); 967 Assert(tmpHr == S_OK || tmpHr == S_FALSE); 968 if (tmpHr == S_OK) 969 { 970 RTListNodeRemove(&pAlloc->DirtyAllocListEntry); 971 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 972 continue; 973 } 974 975 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 976 977 } 978 else 979 { 980 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 981 if (!NscAdd.cAllocations) 982 break; 983 } 984 985 D3DDDICB_RENDER RenderData = {0}; 986 RenderData.CommandLength = pDevice->DefaultContext.ContextInfo.CommandBufferSize - NscAdd.cbCommandBuffer; 987 Assert(RenderData.CommandLength); 988 Assert(RenderData.CommandLength < UINT32_MAX/2); 989 RenderData.CommandOffset = 0; 990 RenderData.NumAllocations = pDevice->DefaultContext.ContextInfo.AllocationListSize - NscAdd.cAllocationList; 991 Assert(RenderData.NumAllocations == NscAdd.cAllocations); 992 RenderData.NumPatchLocations = pDevice->DefaultContext.ContextInfo.PatchLocationListSize - NscAdd.cPatchLocationList; 993 Assert(RenderData.NumPatchLocations == NscAdd.cAllocations); 994 // RenderData.NewCommandBufferSize = sizeof (VBOXVDMACMD) + 4 * (100); 995 // RenderData.NewAllocationListSize = 100; 996 // RenderData.NewPatchLocationListSize = 100; 997 RenderData.hContext = pDevice->DefaultContext.ContextInfo.hContext; 998 999 HRESULT hr = pDevice->RtCallbacks.pfnRenderCb(pDevice->hDevice, &RenderData); 1000 Assert(hr == S_OK); 1001 if (hr == S_OK) 1002 { 1003 pDevice->DefaultContext.ContextInfo.CommandBufferSize = RenderData.NewCommandBufferSize; 1004 pDevice->DefaultContext.ContextInfo.pCommandBuffer = RenderData.pNewCommandBuffer; 1005 pDevice->DefaultContext.ContextInfo.AllocationListSize = RenderData.NewAllocationListSize; 1006 pDevice->DefaultContext.ContextInfo.pAllocationList = RenderData.pNewAllocationList; 1007 pDevice->DefaultContext.ContextInfo.PatchLocationListSize = RenderData.NewPatchLocationListSize; 1008 pDevice->DefaultContext.ContextInfo.pPatchLocationList = RenderData.pNewPatchLocationList; 1009 bReinitRenderData = TRUE; 1010 } 1011 else 1012 break; 1013 } while (1); 1014 1015 return S_OK; 1016 } 1017 1018 static BOOLEAN vboxWddmDalCheckAdd(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc) 1019 { 1020 if (!pAlloc->pRc->RcDesc.fFlags.SharedResource) 1021 { 1022 Assert(!pAlloc->DirtyAllocListEntry.pNext); 1023 return FALSE; 1024 } 1025 1026 EnterCriticalSection(&pDevice->DirtyAllocListLock); 1027 if (!pAlloc->DirtyAllocListEntry.pNext) 1028 { 1029 RTListAppend(&pDevice->DirtyAllocList, &pAlloc->DirtyAllocListEntry); 1030 } 1031 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 1032 1033 return TRUE; 1034 } 1035 1036 static VOID vboxWddmDalCheckAddRts(PVBOXWDDMDISP_DEVICE pDevice) 1037 { 1038 for (UINT i = 0; i < pDevice->cRTs; ++i) 1039 { 1040 if (pDevice->apRTs[i]) 1041 { 1042 vboxWddmDalCheckAdd(pDevice, pDevice->apRTs[i]); 1043 } 1044 } 1045 } 1046 1047 static BOOLEAN vboxWddmDalCheckRemove(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc) 1048 { 1049 BOOLEAN fRemoved = FALSE; 1050 1051 EnterCriticalSection(&pDevice->DirtyAllocListLock); 1052 if (pAlloc->DirtyAllocListEntry.pNext) 1053 { 1054 RTListNodeRemove(&pAlloc->DirtyAllocListEntry); 1055 fRemoved = TRUE; 1056 } 1057 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 1058 1059 return fRemoved; 1060 } 892 1061 893 1062 #ifdef VBOX_WITH_VIDEOHWACCEL … … 3514 3683 3515 3684 // vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitive\n")); 3516 #if 03517 IDirect3DVertexDeclaration9* pDecl;3518 hr = pDevice9If->GetVertexDeclaration(&pDecl);3519 Assert(hr == S_OK);3520 if (hr == S_OK)3521 {3522 Assert(pDecl);3523 D3DVERTEXELEMENT9 aDecls9[MAXD3DDECLLENGTH];3524 UINT cDecls9 = 0;3525 hr = pDecl->GetDeclaration(aDecls9, &cDecls9);3526 Assert(hr == S_OK);3527 if (hr == S_OK)3528 {3529 Assert(cDecls9);3530 for (UINT i = 0; i < cDecls9 - 1 /* the last one is D3DDECL_END */; ++i)3531 {3532 D3DVERTEXELEMENT9 *pDecl9 = &aDecls9[i];3533 Assert(pDecl9->Stream < RT_ELEMENTS(pDevice->aStreamSourceUm) || pDecl9->Stream == 0xff);3534 if (pDecl9->Stream != 0xff)3535 {3536 PVBOXWDDMDISP_STREAMSOURCEUM pStrSrc = &pDevice->aStreamSourceUm[pDecl9->Stream];3537 if (pStrSrc->pvBuffer)3538 {3539 WORD iStream = pDecl9->Stream;3540 D3DVERTEXELEMENT9 *pLastCDecl9 = pDecl9;3541 for (UINT j = i+1; j < cDecls9 - 1 /* the last one is D3DDECL_END */; ++j)3542 {3543 pDecl9 = &aDecls9[j];3544 if (iStream == pDecl9->Stream)3545 {3546 pDecl9->Stream = 0xff; /* mark as done */3547 Assert(pDecl9->Offset != pLastCDecl9->Offset);3548 if (pDecl9->Offset > pLastCDecl9->Offset)3549 pLastCDecl9 = pDecl9;3550 }3551 }3552 /* vertex size is MAX(all Offset's) + sizeof (data_type with MAX offset) + stride*/3553 UINT cbVertex = pLastCDecl9->Offset + pStrSrc->cbStride;3554 UINT cbType;3555 switch (pLastCDecl9->Type)3556 {3557 case D3DDECLTYPE_FLOAT1:3558 cbType = sizeof (float);3559 break;3560 case D3DDECLTYPE_FLOAT2:3561 cbType = sizeof (float) * 2;3562 break;3563 case D3DDECLTYPE_FLOAT3:3564 cbType = sizeof (float) * 3;3565 break;3566 case D3DDECLTYPE_FLOAT4:3567 cbType = sizeof (float) * 4;3568 break;3569 case D3DDECLTYPE_D3DCOLOR:3570 cbType = 4;3571 break;3572 case D3DDECLTYPE_UBYTE4:3573 cbType = 4;3574 break;3575 case D3DDECLTYPE_SHORT2:3576 cbType = sizeof (short) * 2;3577 break;3578 case D3DDECLTYPE_SHORT4:3579 cbType = sizeof (short) * 4;3580 break;3581 case D3DDECLTYPE_UBYTE4N:3582 cbType = 4;3583 break;3584 case D3DDECLTYPE_SHORT2N:3585 cbType = sizeof (short) * 2;3586 break;3587 case D3DDECLTYPE_SHORT4N:3588 cbType = sizeof (short) * 4;3589 break;3590 case D3DDECLTYPE_USHORT2N:3591 cbType = sizeof (short) * 2;3592 break;3593 case D3DDECLTYPE_USHORT4N:3594 cbType = sizeof (short) * 4;3595 break;3596 case D3DDECLTYPE_UDEC3:3597 cbType = sizeof (signed) * 3;3598 break;3599 case D3DDECLTYPE_DEC3N:3600 cbType = sizeof (unsigned) * 3;3601 break;3602 case D3DDECLTYPE_FLOAT16_2:3603 cbType = 2 * 2;3604 break;3605 case D3DDECLTYPE_FLOAT16_4:3606 cbType = 2 * 4;3607 break;3608 default:3609 Assert(0);3610 cbType = 1;3611 }3612 cbVertex += cbType;3613 3614 UINT cVertexes;3615 switch (pData->PrimitiveType)3616 {3617 case D3DPT_POINTLIST:3618 cVertexes = pData->PrimitiveCount;3619 break;3620 case D3DPT_LINELIST:3621 cVertexes = pData->PrimitiveCount * 2;3622 break;3623 case D3DPT_LINESTRIP:3624 cVertexes = pData->PrimitiveCount + 1;3625 break;3626 case D3DPT_TRIANGLELIST:3627 cVertexes = pData->PrimitiveCount * 3;3628 break;3629 case D3DPT_TRIANGLESTRIP:3630 cVertexes = pData->PrimitiveCount + 2;3631 break;3632 case D3DPT_TRIANGLEFAN:3633 cVertexes = pData->PrimitiveCount + 2;3634 break;3635 default:3636 Assert(0);3637 cVertexes = pData->PrimitiveCount;3638 }3639 UINT cbVertexes = cVertexes * cbVertex;3640 IDirect3DVertexBuffer9 *pCurVb = NULL, *pVb = NULL;3641 UINT cbOffset;3642 UINT cbStride;3643 hr = pDevice9If->GetStreamSource(iStream, &pCurVb, &cbOffset, &cbStride);3644 Assert(hr == S_OK);3645 if (hr == S_OK)3646 {3647 if (pCurVb)3648 {3649 if (cbStride == pStrSrc->cbStride)3650 {3651 /* ensure our data feets in the buffer */3652 D3DVERTEXBUFFER_DESC Desc;3653 hr = pCurVb->GetDesc(&Desc);3654 Assert(hr == S_OK);3655 if (hr == S_OK)3656 {3657 if (Desc.Size >= cbVertexes)3658 pVb = pCurVb;3659 }3660 }3661 }3662 }3663 else3664 {3665 pCurVb = NULL;3666 }3667 3668 if (!pVb)3669 {3670 hr = pDevice9If->CreateVertexBuffer(cbVertexes,3671 0, /* DWORD Usage */3672 0, /* DWORD FVF */3673 D3DPOOL_DEFAULT, /* D3DPOOL Pool */3674 &pVb,3675 NULL /*HANDLE* pSharedHandle*/);3676 Assert(hr == S_OK);3677 if (hr == S_OK)3678 {3679 hr = pDevice9If->SetStreamSource(iStream, pVb, 0, pStrSrc->cbStride);3680 Assert(hr == S_OK);3681 if (hr == S_OK)3682 {3683 if (pCurVb)3684 pCurVb->Release();3685 }3686 else3687 {3688 pVb->Release();3689 pVb = NULL;3690 }3691 }3692 }3693 3694 if (pVb)3695 {3696 Assert(hr == S_OK);3697 VOID *pvData;3698 hr = pVb->Lock(0, /* UINT OffsetToLock */3699 cbVertexes,3700 &pvData,3701 D3DLOCK_DISCARD);3702 Assert(hr == S_OK);3703 if (hr == S_OK)3704 {3705 memcpy (pvData, ((uint8_t*)pStrSrc->pvBuffer) + pData->VStart * cbVertex, cbVertexes);3706 HRESULT tmpHr = pVb->Unlock();3707 Assert(tmpHr == S_OK);3708 }3709 }3710 }3711 }3712 }3713 }3714 if (hr == S_OK)3715 {3716 hr = pDevice9If->DrawPrimitive(pData->PrimitiveType,3717 0 /* <- since we use our own StreamSource buffer which has data at the very beginning*/,3718 pData->PrimitiveCount);3719 Assert(hr == S_OK);3720 }3721 }3722 #endif3723 3685 } 3724 3686 … … 3898 3860 { 3899 3861 VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(); 3862 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3863 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 3864 Assert(pDevice); 3865 VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 3866 Assert(0); 3900 3867 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3901 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;3902 Assert(pDevice);3903 VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);3904 Assert(0);3905 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice));3906 3868 return E_FAIL; 3907 3869 } … … 3991 3953 pDstSurfIf->Release(); 3992 3954 } 3955 } 3956 3957 for (UINT i = 0; i < pDstRc->cAllocations; ++i) 3958 { 3959 PVBOXWDDMDISP_ALLOCATION pDAlloc = &pDstRc->aAllocations[i]; 3993 3960 } 3994 3961 … … 5521 5488 } 5522 5489 5523 EnterCriticalSection(&pDevice->DirtyAllocListLock); 5524 if (pAlloc->DirtyAllocListEntry.pNext) 5525 RTListNodeRemove(&pAlloc->DirtyAllocListEntry); 5526 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 5490 vboxWddmDalCheckRemove(pDevice, pAlloc); 5527 5491 } 5528 5492 } … … 5657 5621 #ifdef VBOXWDDM_TEST_UHGSMI 5658 5622 { 5659 // Assert(0);5660 5623 static uint32_t cCals = 100000; 5661 5624 static uint32_t cbData = 8 * 1024 * 1024; … … 5663 5626 int rc = vboxUhgsmiTst(&pDevice->Uhgsmi.Base, cbData, cCals, &TimeMs); 5664 5627 uint32_t cCPS = (((uint64_t)cCals) * 1000ULL)/TimeMs; 5665 // Assert(0);5666 // vboxVDbgDoMpPrintF(pDevice, "Time : %I64u ms, calls: %d, cps: %d\n", TimeMs, cCals, cCPS);5667 5628 } 5668 5629 #endif … … 5778 5739 } 5779 5740 5780 typedef struct VBOXWDDMDISP_NSCADD5781 {5782 VOID* pvCommandBuffer;5783 UINT cbCommandBuffer;5784 D3DDDI_ALLOCATIONLIST* pAllocationList;5785 UINT cAllocationList;5786 D3DDDI_PATCHLOCATIONLIST* pPatchLocationList;5787 UINT cPatchLocationList;5788 UINT cAllocations;5789 }VBOXWDDMDISP_NSCADD, *PVBOXWDDMDISP_NSCADD;5790 5791 static HRESULT vboxWddmNSCAddAlloc(PVBOXWDDMDISP_NSCADD pData, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bWrite)5792 {5793 HRESULT hr = S_OK;5794 if (pData->cAllocationList && pData->cPatchLocationList && pData->cbCommandBuffer > 4)5795 {5796 memset(pData->pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST));5797 pData->pAllocationList[0].hAllocation = pAlloc->hAllocation;5798 if (bWrite)5799 pData->pAllocationList[0].WriteOperation = 1;5800 5801 memset(pData->pPatchLocationList, 0, sizeof (D3DDDI_PATCHLOCATIONLIST));5802 pData->pPatchLocationList[0].PatchOffset = pData->cAllocations*4;5803 pData->pPatchLocationList[0].AllocationIndex = pData->cAllocations;5804 5805 pData->cbCommandBuffer -= 4;5806 --pData->cAllocationList;5807 --pData->cPatchLocationList;5808 ++pData->cAllocations;5809 5810 ++pData->pAllocationList;5811 ++pData->pPatchLocationList;5812 pData->pvCommandBuffer = (VOID*)(((uint8_t*)pData->pvCommandBuffer) + 4);5813 5814 }5815 else5816 hr = S_FALSE;5817 5818 return hr;5819 }5820 5821 static HRESULT vboxWddmNotifySharedChange(PVBOXWDDMDISP_DEVICE pDevice)5822 {5823 VBOXWDDMDISP_NSCADD NscAdd;5824 BOOL bReinitRenderData = TRUE;5825 5826 do5827 {5828 if (bReinitRenderData)5829 {5830 NscAdd.pvCommandBuffer = pDevice->DefaultContext.ContextInfo.pCommandBuffer;5831 NscAdd.cbCommandBuffer = pDevice->DefaultContext.ContextInfo.CommandBufferSize;5832 NscAdd.pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList;5833 NscAdd.cAllocationList = pDevice->DefaultContext.ContextInfo.AllocationListSize;5834 NscAdd.pPatchLocationList = pDevice->DefaultContext.ContextInfo.pPatchLocationList;5835 NscAdd.cPatchLocationList = pDevice->DefaultContext.ContextInfo.PatchLocationListSize;5836 NscAdd.cAllocations = 0;5837 Assert(NscAdd.cbCommandBuffer >= sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR));5838 if (NscAdd.cbCommandBuffer < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))5839 return E_FAIL;5840 5841 PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pHdr = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)NscAdd.pvCommandBuffer;5842 pHdr->enmCmd = VBOXVDMACMD_TYPE_DMA_NOP;5843 NscAdd.pvCommandBuffer = (VOID*)(((uint8_t*)NscAdd.pvCommandBuffer) + sizeof (*pHdr));5844 NscAdd.cbCommandBuffer -= sizeof (*pHdr);5845 bReinitRenderData = FALSE;5846 }5847 5848 EnterCriticalSection(&pDevice->DirtyAllocListLock);5849 5850 PVBOXWDDMDISP_ALLOCATION pAlloc = RTListGetFirst(&pDevice->DirtyAllocList, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry);5851 if (pAlloc)5852 {5853 HRESULT tmpHr = vboxWddmNSCAddAlloc(&NscAdd, pAlloc, TRUE);5854 Assert(tmpHr == S_OK || tmpHr == S_FALSE);5855 if (tmpHr == S_OK)5856 {5857 RTListNodeRemove(&pAlloc->DirtyAllocListEntry);5858 LeaveCriticalSection(&pDevice->DirtyAllocListLock);5859 continue;5860 }5861 5862 LeaveCriticalSection(&pDevice->DirtyAllocListLock);5863 5864 }5865 else5866 {5867 LeaveCriticalSection(&pDevice->DirtyAllocListLock);5868 if (!NscAdd.cAllocations)5869 break;5870 }5871 5872 D3DDDICB_RENDER RenderData = {0};5873 RenderData.CommandLength = pDevice->DefaultContext.ContextInfo.CommandBufferSize - NscAdd.cbCommandBuffer;5874 Assert(RenderData.CommandLength);5875 Assert(RenderData.CommandLength < UINT32_MAX/2);5876 RenderData.CommandOffset = 0;5877 RenderData.NumAllocations = pDevice->DefaultContext.ContextInfo.AllocationListSize - NscAdd.cAllocationList;5878 Assert(RenderData.NumAllocations == NscAdd.cAllocations);5879 RenderData.NumPatchLocations = pDevice->DefaultContext.ContextInfo.PatchLocationListSize - NscAdd.cPatchLocationList;5880 Assert(RenderData.NumPatchLocations == NscAdd.cAllocations);5881 // RenderData.NewCommandBufferSize = sizeof (VBOXVDMACMD) + 4 * (100);5882 // RenderData.NewAllocationListSize = 100;5883 // RenderData.NewPatchLocationListSize = 100;5884 RenderData.hContext = pDevice->DefaultContext.ContextInfo.hContext;5885 5886 HRESULT hr = pDevice->RtCallbacks.pfnRenderCb(pDevice->hDevice, &RenderData);5887 Assert(hr == S_OK);5888 if (hr == S_OK)5889 {5890 pDevice->DefaultContext.ContextInfo.CommandBufferSize = RenderData.NewCommandBufferSize;5891 pDevice->DefaultContext.ContextInfo.pCommandBuffer = RenderData.pNewCommandBuffer;5892 pDevice->DefaultContext.ContextInfo.AllocationListSize = RenderData.NewAllocationListSize;5893 pDevice->DefaultContext.ContextInfo.pAllocationList = RenderData.pNewAllocationList;5894 pDevice->DefaultContext.ContextInfo.PatchLocationListSize = RenderData.NewPatchLocationListSize;5895 pDevice->DefaultContext.ContextInfo.pPatchLocationList = RenderData.pNewPatchLocationList;5896 bReinitRenderData = TRUE;5897 }5898 else5899 break;5900 } while (1);5901 5902 return S_OK;5903 }5904 5905 5741 static HRESULT APIENTRY vboxWddmDDevFlush(HANDLE hDevice) 5906 5742 { … … 5913 5749 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 5914 5750 { 5915 // Assert(pDevice->cScreens); 5916 // UINT cProcessed = 0; 5917 // for (UINT i = 0; cProcessed < pDevice->cScreens && i < RT_ELEMENTS(pDevice->aScreens); ++i) 5918 // { 5919 // PVBOXWDDMDISP_SCREEN pScreen = &pDevice->aScreens[i]; 5920 // if (pScreen->pDevice9If) 5921 // { 5922 // ++cProcessed; 5923 //// if (pScreen->pRenderTargetRc->cAllocations == 1) 5924 //// { 5925 //// hr = pScreen->pDevice9If->Present(NULL, NULL, NULL, NULL); 5926 //// Assert(hr == S_OK); 5927 //// } 5928 //// else 5929 { 5930 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If); 5931 Assert(hr == S_OK); 5932 } 5933 // } 5934 // } 5935 5936 vboxWddmNotifySharedChange(pDevice); 5751 5752 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If); 5753 Assert(hr == S_OK); 5754 5755 vboxWddmDalNotifyChange(pDevice); 5937 5756 } 5938 5757 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); … … 6491 6310 #endif 6492 6311 6493 if (pDstRc->RcDesc.fFlags.SharedResource) 6494 { 6495 PVBOXWDDMDISP_ALLOCATION pAlloc = &pDstRc->aAllocations[pData->DstSubResourceIndex]; 6496 EnterCriticalSection(&pDevice->DirtyAllocListLock); 6497 if (!pAlloc->DirtyAllocListEntry.pNext) 6498 RTListAppend(&pDevice->DirtyAllocList, &pAlloc->DirtyAllocListEntry); 6499 LeaveCriticalSection(&pDevice->DirtyAllocListLock); 6500 } 6312 PVBOXWDDMDISP_ALLOCATION pDAlloc = &pDstRc->aAllocations[pData->DstSubResourceIndex]; 6313 vboxWddmDalCheckAdd(pDevice, pDAlloc); 6501 6314 6502 6315 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispKmt.cpp
r37300 r37626 259 259 D3DKMT_CREATECONTEXT ContextData = {0}; 260 260 ContextData.hDevice = pDevice->hDevice; 261 ContextData.NodeOrdinal = 0;262 ContextData.EngineAffinity = 0;261 ContextData.NodeOrdinal = VBOXWDDM_NODE_ID_3D_KMT; 262 ContextData.EngineAffinity = VBOXWDDM_ENGINE_ID_3D_KMT; 263 263 ContextData.pPrivateDriverData = &Info; 264 264 ContextData.PrivateDriverDataSize = sizeof (Info); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk
r36867 r37626 83 83 VBoxVideoWddm_DEFS += VBOX_WITH_CRHGSMI 84 84 endif 85 86 85 ifdef DEBUG_misha 87 86 VBoxVideoWddm_DEFS += LOG_ENABLED -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
r36867 r37626 88 88 /* hgsmi allocation manager */ 89 89 VBOXVIDEOCM_ALLOC_MGR AllocMgr; 90 VBOXVDMADDI_CMD_QUEUE DdiCmdQueue; 90 VBOXVDMADDI_NODE aNodes[VBOXWDDM_NUM_NODES]; 91 LIST_ENTRY DpcCmdQueue; 91 92 LIST_ENTRY SwapchainList3D; 92 93 /* mutex for context list operations */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r37490 r37626 1260 1260 { 1261 1261 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr); 1262 vboxVdmaDdiCmdInit(pDdiCmd, 0, NULL, vboxVideoAMgrAllocSubmitCompletion, pDr);1262 vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxVideoAMgrAllocSubmitCompletion, pDr); 1263 1263 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */ 1264 1264 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd); … … 1381 1381 } 1382 1382 1383 VOID vboxWddmCounterU32Wait(uint32_t volatile * pu32, uint32_t u32Val) 1384 { 1385 LARGE_INTEGER Interval; 1386 Interval.QuadPart = -(int64_t) 2 /* ms */ * 10000; 1387 uint32_t u32CurVal; 1388 1389 while ((u32CurVal = ASMAtomicReadU32(pu32)) != u32Val) 1390 { 1391 Assert(u32CurVal >= u32Val); 1392 Assert(u32CurVal < UINT32_MAX/2); 1393 1394 KeDelayExecutionThread(KernelMode, FALSE, &Interval); 1395 } 1396 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.h
r37300 r37626 148 148 #endif 149 149 150 151 VOID vboxWddmCounterU32Wait(uint32_t volatile * pu32, uint32_t u32Val); 152 150 153 #endif /* #ifndef ___VBoxMPMisc_h__ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r37490 r37626 116 116 struct VBOXWDDM_SWAPCHAIN *pSwapchain; 117 117 VBOXWDDM_ALLOC_TYPE enmType; 118 volatile uint32_t cRefs; 118 119 // VBOXWDDM_ALLOCUSAGE_TYPE enmCurrentUsage; 119 120 D3DDDI_RESOURCEFLAGS fRcFlags; … … 123 124 VBOXVHWA_SURFHANDLE hHostHandle; 124 125 #endif 126 BOOLEAN fDeleted; 125 127 BOOLEAN bVisible; 126 128 BOOLEAN bAssigned; … … 141 143 { 142 144 uint32_t fFlags; 145 volatile uint32_t cRefs; 143 146 VBOXWDDM_RC_DESC RcDesc; 147 BOOLEAN fDeleted; 144 148 uint32_t cAllocations; 145 149 VBOXWDDM_ALLOCATION aAllocations[1]; … … 190 194 typedef struct VBOXWDDM_CONTEXT 191 195 { 192 // LIST_ENTRY ListEntry;193 196 struct VBOXWDDM_DEVICE * pDevice; 194 197 HANDLE hContext; … … 196 199 UINT NodeOrdinal; 197 200 UINT EngineAffinity; 198 // UINT uLastCompletedCmdFenceId;199 201 VBOXWDDM_HTABLE Swapchains; 200 202 VBOXVIDEOCM_CTX CmContext; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.h
r36867 r37626 51 51 #define VBOXVBVA_OP_WITHLOCK_ATDPC(_op, _pdext, _psrc, _arg) \ 52 52 do { \ 53 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); \ 53 54 KeAcquireSpinLockAtDpcLevel(&(_psrc)->Vbva.Lock); \ 54 55 VBOXVBVA_OP(_op, _pdext, _psrc, _arg); \ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r36867 r37626 213 213 } 214 214 215 PVBOXVDMAPIPE_CMD_DR vboxVdmaGgCmdCreate(PVBOXVDMAGG pVdma, VBOXVDMAPIPE_CMD_TYPE enmType, uint32_t cbCmd) 216 { 217 PVBOXVDMAPIPE_CMD_DR pHdr = (PVBOXVDMAPIPE_CMD_DR)vboxWddmMemAllocZero(cbCmd); 218 Assert(pHdr); 219 if (pHdr) 220 { 221 pHdr->enmType = enmType; 222 return pHdr; 223 } 224 return NULL; 225 } 226 227 void vboxVdmaGgCmdDestroy(PVBOXVDMAPIPE_CMD_DR pDr) 228 { 215 PVBOXVDMAPIPE_CMD_DR vboxVdmaGgCmdCreate(PVBOXMP_DEVEXT pDevExt, VBOXVDMAPIPE_CMD_TYPE enmType, uint32_t cbCmd) 216 { 217 PVBOXVDMAPIPE_CMD_DR pHdr; 218 #ifdef VBOX_WDDM_IRQ_COMPLETION 219 if (enmType == VBOXVDMAPIPE_CMD_TYPE_DMACMD) 220 { 221 UINT cbAlloc = VBOXVDMACMD_SIZE_FROMBODYSIZE(cbCmd); 222 VBOXVDMACBUF_DR* pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbAlloc); 223 if (!pDr) 224 { 225 WARN(("dr allocation failed")); 226 return NULL; 227 } 228 pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR; 229 pDr->cbBuf = VBOXVDMACMD_HEADER_SIZE(); 230 pDr->rc = VINF_SUCCESS; 231 232 233 PVBOXVDMACMD pDmaHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); 234 pDmaHdr->enmType = VBOXVDMACMD_TYPE_DMA_NOP; 235 pDmaHdr->u32CmdSpecific = 0; 236 237 pHdr = VBOXVDMACMD_BODY(pDmaHdr, VBOXVDMAPIPE_CMD_DR); 238 } 239 else 240 #endif 241 { 242 pHdr = (PVBOXVDMAPIPE_CMD_DR)vboxWddmMemAllocZero(cbCmd); 243 if (!pHdr) 244 { 245 WARN(("cmd allocation failed")); 246 return NULL; 247 } 248 } 249 pHdr->enmType = enmType; 250 return pHdr; 251 } 252 253 #ifdef VBOX_WDDM_IRQ_COMPLETION 254 DECLINLINE(VBOXVDMACBUF_DR*) vboxVdmaGgCmdDmaGetDr(PVBOXVDMAPIPE_CMD_DMACMD pDr) 255 { 256 VBOXVDMACMD* pDmaCmd = VBOXVDMACMD_FROM_BODY(pDr); 257 VBOXVDMACBUF_DR* pDmaDr = VBOXVDMACBUF_DR_FROM_TAIL(pDmaCmd); 258 return pDmaDr; 259 } 260 261 DECLINLINE(PVBOXVDMADDI_CMD) vboxVdmaGgCmdDmaGetDdiCmd(PVBOXVDMAPIPE_CMD_DMACMD pDr) 262 { 263 VBOXVDMACBUF_DR* pDmaDr = vboxVdmaGgCmdDmaGetDr(pDr); 264 return VBOXVDMADDI_CMD_FROM_BUF_DR(pDmaDr); 265 } 266 267 #endif 268 269 void vboxVdmaGgCmdDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DR pDr) 270 { 271 #ifdef VBOX_WDDM_IRQ_COMPLETION 272 if (pDr->enmType == VBOXVDMAPIPE_CMD_TYPE_DMACMD) 273 { 274 VBOXVDMACBUF_DR* pDmaDr = vboxVdmaGgCmdDmaGetDr((PVBOXVDMAPIPE_CMD_DMACMD)pDr); 275 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDmaDr); 276 return; 277 } 278 #endif 229 279 vboxWddmMemFree(pDr); 230 280 } … … 232 282 DECLCALLBACK(VOID) vboxVdmaGgDdiCmdDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext) 233 283 { 234 vboxVdmaGgCmdDestroy( (PVBOXVDMAPIPE_CMD_DR)pvContext);284 vboxVdmaGgCmdDestroy(pDevExt, (PVBOXVDMAPIPE_CMD_DR)pvContext); 235 285 } 236 286 … … 528 578 } 529 579 530 static NTSTATUS vboxVdmaGgDmaColorFill(PVBOX VDMAPIPE_CMD_DMACMD_CLRFILL pCF)580 static NTSTATUS vboxVdmaGgDmaColorFill(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCF) 531 581 { 532 582 NTSTATUS Status = STATUS_UNSUCCESSFUL; 533 PVBOXWDDM_CONTEXT pContext = pCF->Hdr.DdiCmd.pContext;534 PVBOXMP_DEVEXT pDevExt = pContext->pDevice->pAdapter;535 583 Assert (pDevExt->pvVisibleVram); 536 584 if (pDevExt->pvVisibleVram) … … 593 641 { 594 642 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pCF->ClrFill.Alloc.pAlloc->SurfDesc.VidPnSourceId]; 595 VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UnionRect); 643 uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled); 644 if (!cUnlockedVBVADisabled) 645 { 646 VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &UnionRect); 647 } 648 else 649 { 650 VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UnionRect); 651 } 596 652 } 597 653 } … … 682 738 * @return on success the number of bytes the command contained, otherwise - VERR_xxx error code 683 739 */ 684 static NTSTATUS vboxVdmaGgDmaBlt(PVBOX VDMAPIPE_CMD_DMACMD_BLT pBlt)740 static NTSTATUS vboxVdmaGgDmaBlt(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD_BLT pBlt) 685 741 { 686 742 /* we do not support stretching for now */ … … 694 750 695 751 NTSTATUS Status = STATUS_SUCCESS; 696 PVBOXMP_DEVEXT pDevExt = pBlt->Hdr.pDevExt;697 752 698 753 if (pBlt->Blt.DstRects.UpdateRects.cRects) … … 734 789 } 735 790 736 static NTSTATUS vboxVdmaGgDmaCmdProcess(VBOXVDMAPIPE_CMD_DMACMD *pDmaCmd) 737 { 738 PVBOXMP_DEVEXT pDevExt = pDmaCmd->pDevExt; 739 PVBOXWDDM_CONTEXT pContext = pDmaCmd->DdiCmd.pContext; 791 static NTSTATUS vboxVdmaGgDmaCmdProcessFast(PVBOXMP_DEVEXT pDevExt, VBOXVDMAPIPE_CMD_DMACMD *pDmaCmd) 792 { 740 793 NTSTATUS Status = STATUS_SUCCESS; 794 PVBOXWDDM_CONTEXT pContext = pDmaCmd->pContext; 741 795 DXGK_INTERRUPT_TYPE enmComplType = DXGK_INTERRUPT_DMA_COMPLETED; 742 796 switch (pDmaCmd->enmCmd) … … 763 817 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM); 764 818 765 if (pBlt->Hdr.fFlags.b2DRelated || pBlt->Hdr.fFlags.b3DRelated)819 if (pBlt->Hdr.fFlags.b2DRelated) 766 820 { 767 POINT pos; 768 BOOLEAN bPosMoved = FALSE; 769 if (pBlt->Hdr.fFlags.b3DRelated) 821 RECT OverlayUnionRect; 822 RECT UpdateRect; 823 UpdateRect = pBlt->Blt.DstRects.UpdateRects.aRects[0]; 824 for (UINT i = 1; i < pBlt->Blt.DstRects.UpdateRects.cRects; ++i) 770 825 { 771 pos = pSource->VScreenPos; 772 if (pos.x || pos.y) 773 { 774 vboxWddmBltPipeRectsTranslate(&pBlt->Blt.DstRects, pos.x, pos.y); 775 bPosMoved = TRUE; 776 } 777 Status = vboxVdmaGgDirtyRectsProcess(pDevExt, pContext, NULL, &pBlt->Blt.DstRects); 778 Assert(Status == STATUS_SUCCESS); 826 vboxWddmRectUnite(&UpdateRect, &pBlt->Blt.DstRects.UpdateRects.aRects[i]); 779 827 } 780 781 782 if (pBlt->Hdr.fFlags.b2DRelated) 828 vboxVhwaHlpOverlayDstRectUnion(pDevExt, pDstAlloc->SurfDesc.VidPnSourceId, &OverlayUnionRect); 829 Assert(pBlt->Blt.DstRects.ContextRect.left == 0); /* <-| otherwise we would probably need to translate the UpdateRects to left;top first??*/ 830 Assert(pBlt->Blt.DstRects.ContextRect.top == 0); /* <--| */ 831 vboxVdmaDirtyRectsCalcIntersection(&OverlayUnionRect, &pBlt->Blt.DstRects.UpdateRects, &pBlt->Blt.DstRects.UpdateRects); 832 if (pBlt->Blt.DstRects.UpdateRects.cRects) 783 833 { 784 if (bPosMoved) 785 { 786 vboxWddmBltPipeRectsTranslate(&pBlt->Blt.DstRects, -pos.x, -pos.y); 787 } 788 789 RECT OverlayUnionRect; 790 RECT UpdateRect; 791 UpdateRect = pBlt->Blt.DstRects.UpdateRects.aRects[0]; 792 for (UINT i = 1; i < pBlt->Blt.DstRects.UpdateRects.cRects; ++i) 793 { 794 vboxWddmRectUnite(&UpdateRect, &pBlt->Blt.DstRects.UpdateRects.aRects[i]); 795 } 796 vboxVhwaHlpOverlayDstRectUnion(pDevExt, pDstAlloc->SurfDesc.VidPnSourceId, &OverlayUnionRect); 797 Assert(pBlt->Blt.DstRects.ContextRect.left == 0); /* <-| otherwise we would probably need to translate the UpdateRects to left;top first??*/ 798 Assert(pBlt->Blt.DstRects.ContextRect.top == 0); /* <--| */ 799 vboxVdmaDirtyRectsCalcIntersection(&OverlayUnionRect, &pBlt->Blt.DstRects.UpdateRects, &pBlt->Blt.DstRects.UpdateRects); 800 if (pBlt->Blt.DstRects.UpdateRects.cRects) 801 { 802 vboxVdmaGgDmaBlt(pBlt); 803 } 834 vboxVdmaGgDmaBlt(pDevExt, pBlt); 835 } 836 837 uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled); 838 if (!cUnlockedVBVADisabled) 839 { 840 VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &UpdateRect); 841 } 842 else 843 { 804 844 VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect); 805 845 } 846 847 } 848 849 if (pBlt->Hdr.fFlags.b3DRelated) 850 { 851 Status = STATUS_MORE_PROCESSING_REQUIRED; 806 852 } 807 853 … … 816 862 if (pBlt->Hdr.fFlags.b3DRelated) 817 863 { 818 PVBOXWDDM_SWAPCHAIN pSwapchain; 819 pSwapchain = vboxWddmSwapchainRetainByAlloc(pDevExt, pSrcAlloc); 820 if (pSwapchain) 821 { 822 Status = vboxVdmaGgDirtyRectsProcess(pDevExt, pContext, pSwapchain, &pBlt->Blt.DstRects); 823 Assert(Status == STATUS_SUCCESS); 824 vboxWddmSwapchainRelease(pSwapchain); 825 } 864 Status = STATUS_MORE_PROCESSING_REQUIRED; 826 865 } 827 866 } … … 846 885 if (pBlt->Blt.DstRects.UpdateRects.cRects) 847 886 { 848 vboxVdmaGgDmaBlt(p Blt);887 vboxVdmaGgDmaBlt(pDevExt, pBlt); 849 888 } 850 889 } … … 859 898 } 860 899 900 if (Status == STATUS_MORE_PROCESSING_REQUIRED) 901 { 902 vboxWddmAllocationRetain(pDstAlloc); 903 vboxWddmAllocationRetain(pSrcAlloc); 904 } 861 905 break; 862 906 } … … 865 909 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlip = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)pDmaCmd; 866 910 Assert(pFlip->Hdr.fFlags.b3DRelated); 867 Assert(!pFlip->Hdr.fFlags.bDecVBVAUnlock); 911 Assert(!pFlip->Hdr.fFlags.b2DRelated); 912 if (pFlip->Hdr.fFlags.b3DRelated) 913 { 914 Status = STATUS_MORE_PROCESSING_REQUIRED; 915 vboxWddmAllocationRetain(pFlip->Flip.Alloc.pAlloc); 916 } 917 918 break; 919 } 920 case VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL: 921 { 922 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCF = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)pDmaCmd; 923 Assert(pCF->Hdr.fFlags.b2DRelated); 924 Assert(!pCF->Hdr.fFlags.b3DRelated); 925 Status = vboxVdmaGgDmaColorFill(pDevExt, pCF); 926 Assert(Status == STATUS_SUCCESS); 927 break; 928 } 929 default: 930 Assert(0); 931 break; 932 } 933 934 NTSTATUS tmpStatus = vboxVdmaGgCmdDmaNotifyCompleted(pDevExt, pDmaCmd, enmComplType); 935 Assert(tmpStatus == STATUS_SUCCESS); 936 if (Status != STATUS_MORE_PROCESSING_REQUIRED) 937 { 938 vboxVdmaGgCmdDestroy(pDevExt, &pDmaCmd->Hdr); 939 } 940 941 return Status; 942 } 943 944 static NTSTATUS vboxVdmaGgDmaCmdProcessSlow(PVBOXMP_DEVEXT pDevExt, VBOXVDMAPIPE_CMD_DMACMD *pDmaCmd) 945 { 946 NTSTATUS Status = STATUS_SUCCESS; 947 PVBOXWDDM_CONTEXT pContext = pDmaCmd->pContext; 948 DXGK_INTERRUPT_TYPE enmComplType = DXGK_INTERRUPT_DMA_COMPLETED; 949 switch (pDmaCmd->enmCmd) 950 { 951 case VBOXVDMACMD_TYPE_DMA_PRESENT_BLT: 952 { 953 PVBOXVDMAPIPE_CMD_DMACMD_BLT pBlt = (PVBOXVDMAPIPE_CMD_DMACMD_BLT)pDmaCmd; 954 PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc; 955 PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc; 956 BOOLEAN bComplete = TRUE; 957 switch (pDstAlloc->enmType) 958 { 959 case VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE: 960 case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC: 961 { 962 if (pDstAlloc->bAssigned) 963 { 964 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->SurfDesc.VidPnSourceId]; 965 Assert(pSource->pPrimaryAllocation == pDstAlloc); 966 switch (pSrcAlloc->enmType) 967 { 968 case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE: 969 { 970 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM); 971 972 if (pBlt->Hdr.fFlags.b3DRelated) 973 { 974 POINT pos = pSource->VScreenPos; 975 if (pos.x || pos.y) 976 { 977 vboxWddmBltPipeRectsTranslate(&pBlt->Blt.DstRects, pos.x, pos.y); 978 } 979 980 Status = vboxVdmaGgDirtyRectsProcess(pDevExt, pContext, NULL, &pBlt->Blt.DstRects); 981 Assert(Status == STATUS_SUCCESS); 982 } 983 984 break; 985 } 986 case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC: 987 { 988 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D); 989 Assert(pSrcAlloc->fRcFlags.RenderTarget); 990 if (pSrcAlloc->fRcFlags.RenderTarget) 991 { 992 if (pBlt->Hdr.fFlags.b3DRelated) 993 { 994 POINT pos = pSource->VScreenPos; 995 if (pos.x || pos.y) 996 { 997 vboxWddmBltPipeRectsTranslate(&pBlt->Blt.DstRects, pos.x, pos.y); 998 } 999 1000 PVBOXWDDM_SWAPCHAIN pSwapchain; 1001 pSwapchain = vboxWddmSwapchainRetainByAlloc(pDevExt, pSrcAlloc); 1002 if (pSwapchain) 1003 { 1004 Status = vboxVdmaGgDirtyRectsProcess(pDevExt, pContext, pSwapchain, &pBlt->Blt.DstRects); 1005 Assert(Status == STATUS_SUCCESS); 1006 vboxWddmSwapchainRelease(pSwapchain); 1007 } 1008 } 1009 } 1010 break; 1011 } 1012 default: 1013 AssertBreakpoint(); 1014 break; 1015 } 1016 } 1017 break; 1018 } 1019 default: 1020 Assert(0); 1021 } 1022 1023 vboxWddmAllocationRelease(pDstAlloc); 1024 vboxWddmAllocationRelease(pSrcAlloc); 1025 break; 1026 } 1027 case VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP: 1028 { 1029 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlip = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)pDmaCmd; 1030 Assert(pFlip->Hdr.fFlags.b3DRelated); 868 1031 Assert(!pFlip->Hdr.fFlags.b2DRelated); 869 1032 PVBOXWDDM_ALLOCATION pAlloc = pFlip->Flip.Alloc.pAlloc; … … 889 1052 } 890 1053 891 break; 892 } 893 case VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL: 894 { 895 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCF = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)pDmaCmd; 896 Assert(pCF->Hdr.fFlags.b2DRelated); 897 Assert(pCF->Hdr.fFlags.bDecVBVAUnlock); 898 Assert(!pCF->Hdr.fFlags.b3DRelated); 899 Status = vboxVdmaGgDmaColorFill(pCF); 900 Assert(Status == STATUS_SUCCESS); 1054 vboxWddmAllocationRelease(pAlloc); 1055 901 1056 break; 902 1057 } … … 906 1061 } 907 1062 908 if (pDmaCmd->fFlags.bDecVBVAUnlock) 909 { 910 uint32_t cNew = ASMAtomicDecU32(&pDevExt->cUnlockedVBVADisabled); 911 Assert(cNew < UINT32_MAX/2); 912 } 913 914 Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pDmaCmd->DdiCmd, enmComplType); 915 Assert(Status == STATUS_SUCCESS); 1063 vboxVdmaGgCmdDestroy(pDevExt, &pDmaCmd->Hdr); 916 1064 917 1065 return Status; … … 920 1068 static VOID vboxVdmaGgWorkerThread(PVOID pvUser) 921 1069 { 922 PVBOXVDMAGG pVdma = (PVBOXVDMAGG)pvUser; 1070 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)pvUser; 1071 PVBOXVDMAGG pVdma = &pDevExt->u.primary.Vdma.DmaGg; 923 1072 924 1073 NTSTATUS Status = vboxVdmaPipeSvrOpen(&pVdma->CmdPipe); … … 940 1089 switch (pDr->enmType) 941 1090 { 942 #if 0943 case VBOXVDMAPIPE_CMD_TYPE_RECTSINFO:944 {945 PVBOXVDMAPIPE_CMD_RECTSINFO pRects = (PVBOXVDMAPIPE_CMD_RECTSINFO)pDr;946 Status = vboxVdmaGgDirtyRectsProcess(pRects);947 Assert(Status == STATUS_SUCCESS);948 vboxVdmaGgCmdDestroy(pDr);949 break;950 }951 #endif952 1091 case VBOXVDMAPIPE_CMD_TYPE_DMACMD: 953 1092 { 954 1093 PVBOXVDMAPIPE_CMD_DMACMD pDmaCmd = (PVBOXVDMAPIPE_CMD_DMACMD)pDr; 955 Status = vboxVdmaGgDmaCmdProcess (pDmaCmd);1094 Status = vboxVdmaGgDmaCmdProcessSlow(pDevExt, pDmaCmd); 956 1095 Assert(Status == STATUS_SUCCESS); 957 1096 } break; … … 959 1098 { 960 1099 PVBOXVDMAPIPE_CMD_RECTSINFO pRects = (PVBOXVDMAPIPE_CMD_RECTSINFO)pDr; 961 Status = vboxVdmaGgDirtyRectsProcess(p Rects->pDevExt, pRects->pContext, pRects->pSwapchain, &pRects->ContextsRects);1100 Status = vboxVdmaGgDirtyRectsProcess(pDevExt, pRects->pContext, pRects->pSwapchain, &pRects->ContextsRects); 962 1101 Assert(Status == STATUS_SUCCESS); 963 vboxVdmaGgCmdDestroy(pD r);1102 vboxVdmaGgCmdDestroy(pDevExt, pDr); 964 1103 break; 965 1104 } … … 979 1118 } 980 1119 981 NTSTATUS vboxVdmaGgConstruct(PVBOXVDMAGG pVdma) 982 { 1120 NTSTATUS vboxVdmaGgConstruct(PVBOXMP_DEVEXT pDevExt) 1121 { 1122 PVBOXVDMAGG pVdma = &pDevExt->u.primary.Vdma.DmaGg; 983 1123 NTSTATUS Status = vboxVdmaPipeConstruct(&pVdma->CmdPipe); 984 1124 Assert(Status == STATUS_SUCCESS); 985 1125 if (Status == STATUS_SUCCESS) 986 1126 { 987 Status = vboxVdmaGgThreadCreate(&pVdma->pThread, vboxVdmaGgWorkerThread, p Vdma);1127 Status = vboxVdmaGgThreadCreate(&pVdma->pThread, vboxVdmaGgWorkerThread, pDevExt); 988 1128 Assert(Status == STATUS_SUCCESS); 989 1129 if (Status == STATUS_SUCCESS) … … 999 1139 } 1000 1140 1001 NTSTATUS vboxVdmaGgDestruct(PVBOXVDMAGG pVdma) 1002 { 1141 NTSTATUS vboxVdmaGgDestruct(PVBOXMP_DEVEXT pDevExt) 1142 { 1143 PVBOXVDMAGG pVdma = &pDevExt->u.primary.Vdma.DmaGg; 1003 1144 /* this informs the server thread that it should complete all current commands and exit */ 1004 1145 NTSTATUS Status = vboxVdmaPipeCltClose(&pVdma->CmdPipe); … … 1018 1159 } 1019 1160 1020 NTSTATUS vboxVdmaGgCmdSubmit(PVBOXVDMAGG pVdma, PVBOXVDMAPIPE_CMD_DR pCmd) 1021 { 1022 return vboxVdmaPipeCltCmdPut(&pVdma->CmdPipe, &pCmd->PipeHdr); 1161 NTSTATUS vboxVdmaGgCmdSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DR pCmd) 1162 { 1163 switch (pCmd->enmType) 1164 { 1165 case VBOXVDMAPIPE_CMD_TYPE_DMACMD: 1166 { 1167 PVBOXVDMAPIPE_CMD_DMACMD pDmaCmd = (PVBOXVDMAPIPE_CMD_DMACMD)pCmd; 1168 NTSTATUS Status = vboxVdmaGgDmaCmdProcessFast(pDevExt, pDmaCmd); 1169 if (Status == STATUS_MORE_PROCESSING_REQUIRED) 1170 break; 1171 return Status; 1172 } 1173 default: 1174 break; 1175 } 1176 return vboxVdmaPipeCltCmdPut(&pDevExt->u.primary.Vdma.DmaGg.CmdPipe, &pCmd->PipeHdr); 1177 } 1178 1179 NTSTATUS vboxVdmaGgCmdDmaNotifySubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD pCmd) 1180 { 1181 PVBOXVDMADDI_CMD pDdiCmd; 1182 #ifdef VBOX_WDDM_IRQ_COMPLETION 1183 pDdiCmd = vboxVdmaGgCmdDmaGetDdiCmd(pCmd); 1184 #else 1185 pDdiCmd = &pCmd->DdiCmd; 1186 #endif 1187 NTSTATUS Status = vboxVdmaDdiCmdSubmitted(pDevExt, pDdiCmd); 1188 Assert(Status == STATUS_SUCCESS); 1189 return Status; 1190 } 1191 1192 NTSTATUS vboxVdmaGgCmdDmaNotifyCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1193 { 1194 #ifdef VBOX_WDDM_IRQ_COMPLETION 1195 VBOXVDMACBUF_DR* pDr = vboxVdmaGgCmdDmaGetDr(pCmd); 1196 int rc = vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr); 1197 Assert(rc == VINF_SUCCESS); 1198 if (RT_SUCCESS(rc)) 1199 { 1200 return STATUS_SUCCESS; 1201 } 1202 return STATUS_UNSUCCESSFUL; 1203 #else 1204 return vboxVdmaDdiCmdCompleted(pDevExt, &pCmd->DdiCmd, enmComplType); 1205 #endif 1206 } 1207 1208 VOID vboxVdmaGgCmdDmaNotifyInit(PVBOXVDMAPIPE_CMD_DMACMD pCmd, 1209 uint32_t u32NodeOrdinal, uint32_t u32FenceId, 1210 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete) 1211 { 1212 PVBOXVDMADDI_CMD pDdiCmd; 1213 #ifdef VBOX_WDDM_IRQ_COMPLETION 1214 pDdiCmd = vboxVdmaGgCmdDmaGetDdiCmd(pCmd); 1215 #else 1216 pDdiCmd = &pCmd->DdiCmd; 1217 #endif 1218 vboxVdmaDdiCmdInit(pDdiCmd, u32NodeOrdinal, u32FenceId, pfnComplete, pvComplete); 1023 1219 } 1024 1220 … … 1156 1352 #endif 1157 1353 { 1158 NTSTATUS Status = vboxVdmaGgConstruct( &pInfo->DmaGg);1354 NTSTATUS Status = vboxVdmaGgConstruct(pDevExt); 1159 1355 Assert(Status == STATUS_SUCCESS); 1160 1356 if (Status == STATUS_SUCCESS) … … 1231 1427 { 1232 1428 int rc = VINF_SUCCESS; 1233 NTSTATUS Status = vboxVdmaGgDestruct( &pInfo->DmaGg);1429 NTSTATUS Status = vboxVdmaGgDestruct(pDevExt); 1234 1430 Assert(Status == STATUS_SUCCESS); 1235 1431 if (Status == STATUS_SUCCESS) … … 1304 1500 } 1305 1501 1306 if (vboxVdmaDdiCmdCompletedIrq(pDevExt, &pDevExt->DdiCmdQueue,VBOXVDMADDI_CMD_FROM_BUF_DR(pDr), enmComplType))1502 if (vboxVdmaDdiCmdCompletedIrq(pDevExt, VBOXVDMADDI_CMD_FROM_BUF_DR(pDr), enmComplType)) 1307 1503 { 1308 1504 pDevExt->bNotifyDxDpc = TRUE; … … 1383 1579 1384 1580 /* ddi dma command queue */ 1385 DECLINLINE(BOOLEAN) vboxVdmaDdiCmdCanComplete(PVBOXVDMADDI_CMD_QUEUE pQueue) 1386 { 1581 1582 VOID vboxVdmaDdiCmdGetCompletedListIsr(PVBOXMP_DEVEXT pDevExt, LIST_ENTRY *pList) 1583 { 1584 vboxVideoLeDetach(&pDevExt->DpcCmdQueue, pList); 1585 } 1586 1587 BOOLEAN vboxVdmaDdiCmdIsCompletedListEmptyIsr(PVBOXMP_DEVEXT pDevExt) 1588 { 1589 return IsListEmpty(&pDevExt->DpcCmdQueue); 1590 } 1591 1592 DECLINLINE(BOOLEAN) vboxVdmaDdiCmdCanComplete(PVBOXMP_DEVEXT pDevExt, UINT u32NodeOrdinal) 1593 { 1594 PVBOXVDMADDI_CMD_QUEUE pQueue = &pDevExt->aNodes[u32NodeOrdinal].CmdQueue; 1387 1595 return ASMAtomicUoReadU32(&pQueue->cQueuedCmds) == 0; 1388 1596 } … … 1393 1601 } 1394 1602 1395 static VOID vboxVdmaDdiCmdNotifyCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1396 { 1603 static VOID vboxVdmaDdiCmdNotifyCompletedIrq(PVBOXMP_DEVEXT pDevExt, UINT u32NodeOrdinal, UINT u32FenceId, DXGK_INTERRUPT_TYPE enmComplType) 1604 { 1605 PVBOXVDMADDI_NODE pNode = &pDevExt->aNodes[u32NodeOrdinal]; 1397 1606 DXGKARGCB_NOTIFY_INTERRUPT_DATA notify; 1398 1607 memset(¬ify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA)); … … 1401 1610 case DXGK_INTERRUPT_DMA_COMPLETED: 1402 1611 notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED; 1403 notify.DmaCompleted.SubmissionFenceId = pCmd->u32FenceId; 1404 // if (pCmd->pContext) 1405 // { 1406 // notify.DmaCompleted.NodeOrdinal = pCmd->pContext->NodeOrdinal; 1407 // pCmd->pContext->uLastCompletedCmdFenceId = pCmd->u32FenceId; 1408 // } 1409 // else 1410 { 1411 pDevExt->u.primary.Vdma.uLastCompletedPagingBufferCmdFenceId = pCmd->u32FenceId; 1412 } 1413 1414 InsertTailList(&pQueue->DpcCmdQueue, &pCmd->QueueEntry); 1415 1416 break; 1612 notify.DmaCompleted.SubmissionFenceId = u32FenceId; 1613 notify.DmaCompleted.NodeOrdinal = u32NodeOrdinal; 1614 pNode->uLastCompletedFenceId = u32FenceId; 1615 break; 1616 1417 1617 case DXGK_INTERRUPT_DMA_PREEMPTED: 1418 1618 Assert(0); 1419 1619 notify.InterruptType = DXGK_INTERRUPT_DMA_PREEMPTED; 1420 notify.DmaPreempted.PreemptionFenceId = pCmd->u32FenceId; 1421 // if (pCmd->pContext) 1422 // { 1423 // notify.DmaPreempted.LastCompletedFenceId = pCmd->pContext->uLastCompletedCmdFenceId; 1424 // notify.DmaPreempted.NodeOrdinal = pCmd->pContext->NodeOrdinal; 1425 // } 1426 // else 1427 { 1428 notify.DmaPreempted.LastCompletedFenceId = pDevExt->u.primary.Vdma.uLastCompletedPagingBufferCmdFenceId; 1429 } 1620 notify.DmaPreempted.PreemptionFenceId = u32FenceId; 1621 notify.DmaPreempted.NodeOrdinal = u32NodeOrdinal; 1622 notify.DmaPreempted.LastCompletedFenceId = pNode->uLastCompletedFenceId; 1430 1623 break; 1431 1624 … … 1433 1626 Assert(0); 1434 1627 notify.InterruptType = DXGK_INTERRUPT_DMA_FAULTED; 1435 notify.DmaFaulted.FaultedFenceId = pCmd->u32FenceId;1628 notify.DmaFaulted.FaultedFenceId = u32FenceId; 1436 1629 notify.DmaFaulted.Status = STATUS_UNSUCCESSFUL; /* @todo: better status ? */ 1437 if (pCmd->pContext) 1438 { 1439 notify.DmaFaulted.NodeOrdinal = pCmd->pContext->NodeOrdinal; 1440 } 1441 break; 1630 notify.DmaFaulted.NodeOrdinal = u32NodeOrdinal; 1631 break; 1632 1442 1633 default: 1443 1634 Assert(0); … … 1448 1639 } 1449 1640 1450 DECLINLINE(VOID) vboxVdmaDdiCmdDequeueIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd) 1451 { 1641 static VOID vboxVdmaDdiCmdProcessCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1642 { 1643 vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pCmd->u32NodeOrdinal, pCmd->u32FenceId, enmComplType); 1644 switch (enmComplType) 1645 { 1646 case DXGK_INTERRUPT_DMA_COMPLETED: 1647 InsertTailList(&pDevExt->DpcCmdQueue, &pCmd->QueueEntry); 1648 break; 1649 default: 1650 AssertFailed(); 1651 break; 1652 } 1653 } 1654 1655 DECLINLINE(VOID) vboxVdmaDdiCmdDequeueIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd) 1656 { 1657 PVBOXVDMADDI_CMD_QUEUE pQueue = &pDevExt->aNodes[pCmd->u32NodeOrdinal].CmdQueue; 1452 1658 ASMAtomicDecU32(&pQueue->cQueuedCmds); 1453 1659 RemoveEntryList(&pCmd->QueueEntry); 1454 1660 } 1455 1661 1456 DECLINLINE(VOID) vboxVdmaDdiCmdEnqueueIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd) 1457 { 1662 DECLINLINE(VOID) vboxVdmaDdiCmdEnqueueIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd) 1663 { 1664 PVBOXVDMADDI_CMD_QUEUE pQueue = &pDevExt->aNodes[pCmd->u32NodeOrdinal].CmdQueue; 1458 1665 ASMAtomicIncU32(&pQueue->cQueuedCmds); 1459 1666 InsertTailList(&pQueue->CmdQueue, &pCmd->QueueEntry); 1460 1667 } 1461 1668 1462 VOID vboxVdmaDdiQueueInit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue) 1463 { 1464 pQueue->cQueuedCmds = 0; 1465 InitializeListHead(&pQueue->CmdQueue); 1466 InitializeListHead(&pQueue->DpcCmdQueue); 1467 } 1468 1469 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1669 VOID vboxVdmaDdiNodesInit(PVBOXMP_DEVEXT pDevExt) 1670 { 1671 for (UINT i = 0; i < RT_ELEMENTS(pDevExt->aNodes); ++i) 1672 { 1673 pDevExt->aNodes[i].uLastCompletedFenceId = 0; 1674 PVBOXVDMADDI_CMD_QUEUE pQueue = &pDevExt->aNodes[i].CmdQueue; 1675 pQueue->cQueuedCmds = 0; 1676 InitializeListHead(&pQueue->CmdQueue); 1677 } 1678 InitializeListHead(&pDevExt->DpcCmdQueue); 1679 } 1680 1681 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1470 1682 { 1471 1683 if (VBOXVDMADDI_STATE_NOT_DX_CMD == pCmd->enmState) 1472 1684 { 1473 InsertTailList(&p Queue->DpcCmdQueue, &pCmd->QueueEntry);1685 InsertTailList(&pDevExt->DpcCmdQueue, &pCmd->QueueEntry); 1474 1686 return FALSE; 1475 1687 } 1476 1688 1689 PVBOXVDMADDI_CMD_QUEUE pQueue = &pDevExt->aNodes[pCmd->u32NodeOrdinal].CmdQueue; 1477 1690 BOOLEAN bQueued = pCmd->enmState > VBOXVDMADDI_STATE_NOT_QUEUED; 1478 1691 BOOLEAN bComplete = FALSE; … … 1484 1697 if (pQueue->CmdQueue.Flink == &pCmd->QueueEntry) 1485 1698 { 1486 vboxVdmaDdiCmdDequeueIrq(p Queue, pCmd);1699 vboxVdmaDdiCmdDequeueIrq(pDevExt, pCmd); 1487 1700 bComplete = TRUE; 1488 1701 } … … 1494 1707 else 1495 1708 { 1496 vboxVdmaDdiCmdEnqueueIrq(p Queue, pCmd);1709 vboxVdmaDdiCmdEnqueueIrq(pDevExt, pCmd); 1497 1710 } 1498 1711 1499 1712 if (bComplete) 1500 1713 { 1501 vboxVdmaDdiCmd NotifyCompletedIrq(pDevExt, pQueue, pCmd, enmComplType);1714 vboxVdmaDdiCmdProcessCompletedIrq(pDevExt, pCmd, enmComplType); 1502 1715 1503 1716 while (!IsListEmpty(&pQueue->CmdQueue)) … … 1506 1719 if (pCmd->enmState == VBOXVDMADDI_STATE_COMPLETED) 1507 1720 { 1508 vboxVdmaDdiCmdDequeueIrq(p Queue, pCmd);1509 vboxVdmaDdiCmd NotifyCompletedIrq(pDevExt, pQueue, pCmd, pCmd->enmComplType);1721 vboxVdmaDdiCmdDequeueIrq(pDevExt, pCmd); 1722 vboxVdmaDdiCmdProcessCompletedIrq(pDevExt, pCmd, pCmd->enmComplType); 1510 1723 } 1511 1724 else … … 1522 1735 } 1523 1736 1524 VOID vboxVdmaDdiCmdSubmittedIrq(PVBOX VDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd)1737 VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd) 1525 1738 { 1526 1739 BOOLEAN bQueued = pCmd->enmState >= VBOXVDMADDI_STATE_PENDING; … … 1528 1741 pCmd->enmState = VBOXVDMADDI_STATE_SUBMITTED; 1529 1742 if (!bQueued) 1530 vboxVdmaDdiCmdEnqueueIrq(p Queue, pCmd);1743 vboxVdmaDdiCmdEnqueueIrq(pDevExt, pCmd); 1531 1744 } 1532 1745 … … 1534 1747 { 1535 1748 PVBOXMP_DEVEXT pDevExt; 1536 PVBOXVDMADDI_CMD_QUEUE pQueue;1537 1749 PVBOXVDMADDI_CMD pCmd; 1538 1750 DXGK_INTERRUPT_TYPE enmComplType; … … 1542 1754 { 1543 1755 PVBOXVDMADDI_CMD_COMPLETED_CB pdc = (PVBOXVDMADDI_CMD_COMPLETED_CB)Context; 1544 BOOLEAN bNeedDpc = vboxVdmaDdiCmdCompletedIrq(pdc->pDevExt, pdc->pQueue, pdc->pCmd, pdc->enmComplType); 1545 pdc->pDevExt->bNotifyDxDpc |= bNeedDpc; 1756 PVBOXMP_DEVEXT pDevExt = pdc->pDevExt; 1757 BOOLEAN bNeedDpc = vboxVdmaDdiCmdCompletedIrq(pDevExt, pdc->pCmd, pdc->enmComplType); 1758 pDevExt->bNotifyDxDpc |= bNeedDpc; 1759 1760 if (bNeedDpc) 1761 { 1762 BOOLEAN bRc = pDevExt->u.primary.DxgkInterface.DxgkCbQueueDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle); 1763 Assert(bRc); 1764 } 1546 1765 1547 1766 return bNeedDpc; 1548 1767 } 1549 1768 1550 NTSTATUS vboxVdmaDdiCmdCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD _QUEUE pQueue, PVBOXVDMADDI_CMDpCmd, DXGK_INTERRUPT_TYPE enmComplType)1769 NTSTATUS vboxVdmaDdiCmdCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType) 1551 1770 { 1552 1771 VBOXVDMADDI_CMD_COMPLETED_CB context; 1553 1772 context.pDevExt = pDevExt; 1554 context.pQueue = pQueue;1555 1773 context.pCmd = pCmd; 1556 1774 context.enmComplType = enmComplType; … … 1563 1781 &bNeedDps); 1564 1782 Assert(Status == STATUS_SUCCESS); 1565 if (Status == STATUS_SUCCESS && bNeedDps)1566 {1567 BOOLEAN bRc = pDevExt->u.primary.DxgkInterface.DxgkCbQueueDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle);1568 Assert(bRc);1569 }1570 1783 return Status; 1571 1784 } … … 1573 1786 typedef struct VBOXVDMADDI_CMD_SUBMITTED_CB 1574 1787 { 1575 // PVBOXMP_DEVEXT pDevExt; 1576 PVBOXVDMADDI_CMD_QUEUE pQueue; 1788 PVBOXMP_DEVEXT pDevExt; 1577 1789 PVBOXVDMADDI_CMD pCmd; 1578 1790 } VBOXVDMADDI_CMD_SUBMITTED_CB, *PVBOXVDMADDI_CMD_SUBMITTED_CB; … … 1581 1793 { 1582 1794 PVBOXVDMADDI_CMD_SUBMITTED_CB pdc = (PVBOXVDMADDI_CMD_SUBMITTED_CB)Context; 1583 vboxVdmaDdiCmdSubmittedIrq(pdc->p Queue, pdc->pCmd);1795 vboxVdmaDdiCmdSubmittedIrq(pdc->pDevExt, pdc->pCmd); 1584 1796 1585 1797 return FALSE; 1586 1798 } 1587 1799 1588 NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD _QUEUE pQueue, PVBOXVDMADDI_CMDpCmd)1800 NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd) 1589 1801 { 1590 1802 VBOXVDMADDI_CMD_SUBMITTED_CB context; 1591 context.p Queue = pQueue;1803 context.pDevExt = pDevExt; 1592 1804 context.pCmd = pCmd; 1593 1805 BOOLEAN bRc; … … 1605 1817 { 1606 1818 PVBOXMP_DEVEXT pDevExt; 1607 PVBOXWDDM_CONTEXT pContext;1819 UINT u32NodeOrdinal; 1608 1820 uint32_t u32FenceId; 1609 1821 } VBOXVDMADDI_CMD_COMPLETE_CB, *PVBOXVDMADDI_CMD_COMPLETE_CB; … … 1613 1825 PVBOXVDMADDI_CMD_COMPLETE_CB pdc = (PVBOXVDMADDI_CMD_COMPLETE_CB)Context; 1614 1826 PVBOXMP_DEVEXT pDevExt = pdc->pDevExt; 1615 DXGKARGCB_NOTIFY_INTERRUPT_DATA notify; 1616 memset(¬ify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA)); 1617 1618 notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED; 1619 notify.DmaCompleted.SubmissionFenceId = pdc->u32FenceId; 1620 notify.DmaCompleted.NodeOrdinal = pdc->pContext->NodeOrdinal; 1621 notify.DmaCompleted.EngineOrdinal = 0; 1622 1623 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, ¬ify); 1827 1828 vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pdc->u32NodeOrdinal, pdc->u32FenceId, DXGK_INTERRUPT_DMA_COMPLETED); 1624 1829 1625 1830 pDevExt->bNotifyDxDpc = TRUE; … … 1629 1834 } 1630 1835 1631 static NTSTATUS vboxVdmaDdiCmdFenceNotifyComplete(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId)1836 static NTSTATUS vboxVdmaDdiCmdFenceNotifyComplete(PVBOXMP_DEVEXT pDevExt, uint32_t u32NodeOrdinal, uint32_t u32FenceId) 1632 1837 { 1633 1838 VBOXVDMADDI_CMD_COMPLETE_CB context; 1634 1839 context.pDevExt = pDevExt; 1635 context. pContext = pContext;1840 context.u32NodeOrdinal = u32NodeOrdinal; 1636 1841 context.u32FenceId = u32FenceId; 1637 1842 BOOLEAN bRet; … … 1646 1851 } 1647 1852 1648 NTSTATUS vboxVdmaDdiCmdFenceComplete(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType)1649 { 1650 if (vboxVdmaDdiCmdCanComplete( &pDevExt->DdiCmdQueue))1651 return vboxVdmaDdiCmdFenceNotifyComplete(pDevExt, pContext, u32FenceId);1853 NTSTATUS vboxVdmaDdiCmdFenceComplete(PVBOXMP_DEVEXT pDevExt, uint32_t u32NodeOrdinal, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType) 1854 { 1855 if (vboxVdmaDdiCmdCanComplete(pDevExt, u32NodeOrdinal)) 1856 return vboxVdmaDdiCmdFenceNotifyComplete(pDevExt, u32NodeOrdinal, u32FenceId); 1652 1857 1653 1858 PVBOXVDMADDI_CMD pCmd = (PVBOXVDMADDI_CMD)vboxWddmMemAlloc(sizeof (VBOXVDMADDI_CMD)); … … 1655 1860 if (pCmd) 1656 1861 { 1657 vboxVdmaDdiCmdInit(pCmd, u32 FenceId, pContext, vboxVdmaDdiCmdCompletionCbFree, NULL);1658 NTSTATUS Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue,pCmd, enmComplType);1862 vboxVdmaDdiCmdInit(pCmd, u32NodeOrdinal, u32FenceId, vboxVdmaDdiCmdCompletionCbFree, NULL); 1863 NTSTATUS Status = vboxVdmaDdiCmdCompleted(pDevExt, pCmd, enmComplType); 1659 1864 Assert(Status == STATUS_SUCCESS); 1660 1865 if (Status == STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h
r37490 r37626 25 25 #include <VBox/HGSMI/HGSMI.h> 26 26 27 typedef struct _VBOXMP_DEVEXT *PVBOXMP_DEVEXT; 28 27 29 /* ddi dma command queue handling */ 28 30 typedef enum … … 44 46 LIST_ENTRY QueueEntry; 45 47 VBOXVDMADDI_STATE enmState; 48 uint32_t u32NodeOrdinal; 46 49 uint32_t u32FenceId; 47 50 DXGK_INTERRUPT_TYPE enmComplType; 48 PVBOXWDDM_CONTEXT pContext;49 51 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete; 50 52 PVOID pvComplete; … … 55 57 volatile uint32_t cQueuedCmds; 56 58 LIST_ENTRY CmdQueue; 57 LIST_ENTRY DpcCmdQueue;58 59 } VBOXVDMADDI_CMD_QUEUE, *PVBOXVDMADDI_CMD_QUEUE; 59 60 60 VOID vboxVdmaDdiQueueInit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue); 61 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType); 62 VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 63 64 NTSTATUS vboxVdmaDdiCmdCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType); 65 NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 61 typedef struct VBOXVDMADDI_NODE 62 { 63 VBOXVDMADDI_CMD_QUEUE CmdQueue; 64 UINT uLastCompletedFenceId; 65 } VBOXVDMADDI_NODE, *PVBOXVDMADDI_NODE; 66 67 VOID vboxVdmaDdiNodesInit(PVBOXMP_DEVEXT pDevExt); 68 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType); 69 VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd); 70 71 NTSTATUS vboxVdmaDdiCmdCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType); 72 NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd); 66 73 67 74 DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd, 68 uint32_t u32 FenceId, PVBOXWDDM_CONTEXT pContext,75 uint32_t u32NodeOrdinal, uint32_t u32FenceId, 69 76 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete) 70 77 { … … 72 79 pCmd->QueueEntry.Flink = NULL; 73 80 pCmd->enmState = VBOXVDMADDI_STATE_NOT_QUEUED; 81 pCmd->u32NodeOrdinal = u32NodeOrdinal; 74 82 pCmd->u32FenceId = u32FenceId; 75 pCmd->pContext = pContext;76 83 pCmd->pfnComplete = pfnComplete; 77 84 pCmd->pvComplete = pvComplete; … … 87 94 } 88 95 89 NTSTATUS vboxVdmaDdiCmdFenceComplete(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType);96 NTSTATUS vboxVdmaDdiCmdFenceComplete(PVBOXMP_DEVEXT pDevExt, uint32_t u32NodeOrdinal, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType); 90 97 91 98 DECLCALLBACK(VOID) vboxVdmaDdiCmdCompletionCbFree(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext); 92 99 93 DECLINLINE(VOID) vboxVdmaDdiCmdGetCompletedListIsr(PVBOXVDMADDI_CMD_QUEUE pQueue, LIST_ENTRY *pList) 94 { 95 vboxVideoLeDetach(&pQueue->DpcCmdQueue, pList); 96 } 97 98 DECLINLINE(BOOLEAN) vboxVdmaDdiCmdIsCompletedListEmptyIsr(PVBOXVDMADDI_CMD_QUEUE pQueue) 99 { 100 return IsListEmpty(&pQueue->DpcCmdQueue); 101 } 100 VOID vboxVdmaDdiCmdGetCompletedListIsr(PVBOXMP_DEVEXT pDevExt, LIST_ENTRY *pList); 101 102 BOOLEAN vboxVdmaDdiCmdIsCompletedListEmptyIsr(PVBOXMP_DEVEXT pDevExt); 102 103 103 104 #define VBOXVDMADDI_CMD_FROM_ENTRY(_pEntry) ((PVBOXVDMADDI_CMD)(((uint8_t*)(_pEntry)) - RT_OFFSETOF(VBOXVDMADDI_CMD, QueueEntry))) 104 105 105 DECLINLINE(VOID) vboxVdmaDdiCmdHandleCompletedList(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue,LIST_ENTRY *pList)106 DECLINLINE(VOID) vboxVdmaDdiCmdHandleCompletedList(PVBOXMP_DEVEXT pDevExt, LIST_ENTRY *pList) 106 107 { 107 108 LIST_ENTRY *pEntry = pList->Flink; … … 188 189 { 189 190 VBOXVDMAPIPE_CMD_DR Hdr; 190 PVBOXMP_DEVEXT pDevExt;191 191 PVBOXWDDM_CONTEXT pContext; 192 192 struct VBOXWDDM_SWAPCHAIN *pSwapchain; … … 202 202 UINT b2DRelated : 1; 203 203 UINT b3DRelated : 1; 204 UINT bDecVBVAUnlock : 1; 205 UINT Reserved : 29; 204 UINT Reserved : 30; 206 205 }; 207 206 UINT Value; … … 211 210 { 212 211 VBOXVDMAPIPE_CMD_DR Hdr; 212 #ifndef VBOX_WDDM_IRQ_COMPLETION 213 213 VBOXVDMADDI_CMD DdiCmd; 214 PVBOXMP_DEVEXT pDevExt; 214 #endif 215 PVBOXWDDM_CONTEXT pContext; 215 216 VBOXVDMACMD_TYPE enmCmd; 216 217 VBOXVDMAPIPE_FLAGS_DMACMD fFlags; … … 309 310 310 311 #endif 311 NTSTATUS vboxVdmaGgCmdSubmit(PVBOX VDMAGG pVdma, PVBOXVDMAPIPE_CMD_DR pCmd);312 PVBOXVDMAPIPE_CMD_DR vboxVdmaGgCmdCreate(PVBOX VDMAGG pVdma, VBOXVDMAPIPE_CMD_TYPE enmType, uint32_t cbCmd);313 void vboxVdmaGgCmdDestroy(PVBOX VDMAPIPE_CMD_DR pDr);312 NTSTATUS vboxVdmaGgCmdSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DR pCmd); 313 PVBOXVDMAPIPE_CMD_DR vboxVdmaGgCmdCreate(PVBOXMP_DEVEXT pDevExt, VBOXVDMAPIPE_CMD_TYPE enmType, uint32_t cbCmd); 314 void vboxVdmaGgCmdDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DR pDr); 314 315 315 316 NTSTATUS vboxVdmaPostHideSwapchain(PVBOXWDDM_SWAPCHAIN pSwapchain); 317 318 NTSTATUS vboxVdmaGgCmdDmaNotifyCompleted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD pCmd, DXGK_INTERRUPT_TYPE enmComplType); 319 NTSTATUS vboxVdmaGgCmdDmaNotifySubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAPIPE_CMD_DMACMD pCmd); 320 VOID vboxVdmaGgCmdDmaNotifyInit(PVBOXVDMAPIPE_CMD_DMACMD pCmd, 321 uint32_t u32NodeOrdinal, uint32_t u32FenceId, 322 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete); 316 323 317 324 #define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd))) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r37490 r37626 487 487 Ctx.pDr = pDr; 488 488 Ctx.pEvent = &Event; 489 vboxVdmaDdiCmdInit(pDdiCmd, 0, NULL, vboxWddmChildStatusReportCompletion, &Ctx);489 vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxWddmChildStatusReportCompletion, &Ctx); 490 490 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */ 491 491 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd); … … 946 946 LOG(("sources(%d), children(%d)", *NumberOfVideoPresentSources, *NumberOfChildren)); 947 947 948 vboxVdmaDdi QueueInit(pContext, &pContext->DdiCmdQueue);948 vboxVdmaDdiNodesInit(pContext); 949 949 vboxVideoCmInit(&pContext->CmMgr); 950 950 InitializeListHead(&pContext->SwapchainList3D); … … 1242 1242 } 1243 1243 1244 bNeedDpc |= !vboxVdmaDdiCmdIsCompletedListEmptyIsr( &pDevExt->DdiCmdQueue);1244 bNeedDpc |= !vboxVdmaDdiCmdIsCompletedListEmptyIsr(pDevExt); 1245 1245 1246 1246 if (pDevExt->bNotifyDxDpc) … … 1306 1306 vboxSHGSMIListDetach2List(&pdc->pDevExt->VhwaCmdList, &pdc->data.VhwaCmdList); 1307 1307 #endif 1308 vboxVdmaDdiCmdGetCompletedListIsr( &pdc->pDevExt->DdiCmdQueue, &pdc->data.CompletedDdiCmdQueue);1308 vboxVdmaDdiCmdGetCompletedListIsr(pdc->pDevExt, &pdc->data.CompletedDdiCmdQueue); 1309 1309 1310 1310 pdc->data.bNotifyDpc = pdc->pDevExt->bNotifyDxDpc; … … 1359 1359 #endif 1360 1360 1361 vboxVdmaDdiCmdHandleCompletedList(pDevExt, & pDevExt->DdiCmdQueue, &context.data.CompletedDdiCmdQueue);1361 vboxVdmaDdiCmdHandleCompletedList(pDevExt, &context.data.CompletedDdiCmdQueue); 1362 1362 1363 1363 // LOGF(("LEAVE, context(0x%p)", MiniportDeviceContext)); … … 1602 1602 pCaps->MemoryManagementCaps.PagingNode = 0; 1603 1603 /* @todo: this correlates with pCaps->SchedulingCaps.MultiEngineAware */ 1604 pCaps->GpuEngineTopology.NbAsymetricProcessingNodes = 1;1604 pCaps->GpuEngineTopology.NbAsymetricProcessingNodes = VBOXWDDM_NUM_NODES; 1605 1605 1606 1606 break; … … 1729 1729 } 1730 1730 1731 PVBOXWDDM_ALLOCATION vboxWddmAllocationCreateFromResource(PVBOXWDDM_RESOURCE pResource, uint32_t iIndex) 1732 { 1733 PVBOXWDDM_ALLOCATION pAllocation = NULL; 1734 if (pResource) 1735 { 1736 Assert(iIndex < pResource->cAllocations); 1737 if (iIndex < pResource->cAllocations) 1738 { 1739 pAllocation = &pResource->aAllocations[iIndex]; 1740 memset(pAllocation, 0, sizeof (VBOXWDDM_ALLOCATION)); 1741 } 1742 } 1743 else 1744 pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(sizeof (VBOXWDDM_ALLOCATION)); 1745 1746 if (pAllocation) 1747 { 1748 if (pResource) 1749 { 1750 pAllocation->pResource = pResource; 1751 pAllocation->iIndex = iIndex; 1752 } 1753 } 1754 1755 return pAllocation; 1731 PVBOXWDDM_RESOURCE vboxWddmResourceCreate(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_RCINFO pRcInfo) 1732 { 1733 PVBOXWDDM_RESOURCE pResource = (PVBOXWDDM_RESOURCE)vboxWddmMemAllocZero(RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pRcInfo->cAllocInfos])); 1734 if (!pResource) 1735 { 1736 AssertFailed(); 1737 return NULL; 1738 } 1739 pResource->cRefs = 1; 1740 pResource->cAllocations = pRcInfo->cAllocInfos; 1741 pResource->fFlags = pRcInfo->fFlags; 1742 pResource->RcDesc = pRcInfo->RcDesc; 1743 return pResource; 1744 } 1745 1746 VOID vboxWddmResourceRetain(PVBOXWDDM_RESOURCE pResource) 1747 { 1748 ASMAtomicIncU32(&pResource->cRefs); 1749 } 1750 1751 static VOID vboxWddmResourceDestroy(PVBOXWDDM_RESOURCE pResource) 1752 { 1753 vboxWddmMemFree(pResource); 1754 } 1755 1756 VOID vboxWddmResourceWaitDereference(PVBOXWDDM_RESOURCE pResource) 1757 { 1758 vboxWddmCounterU32Wait(&pResource->cRefs, 1); 1759 } 1760 1761 VOID vboxWddmResourceRelease(PVBOXWDDM_RESOURCE pResource) 1762 { 1763 uint32_t cRefs = ASMAtomicDecU32(&pResource->cRefs); 1764 Assert(cRefs < UINT32_MAX/2); 1765 if (!cRefs) 1766 { 1767 vboxWddmResourceDestroy(pResource); 1768 } 1756 1769 } 1757 1770 … … 1762 1775 { 1763 1776 Assert(&pResource->aAllocations[pAllocation->iIndex] == pAllocation); 1777 vboxWddmResourceRelease(pResource); 1764 1778 } 1765 1779 else … … 1769 1783 } 1770 1784 1771 NTSTATUS vboxWddmDestroyAllocation(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 1772 { 1773 PAGED_CODE(); 1774 1785 VOID vboxWddmAllocationCleanup(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 1786 { 1775 1787 switch (pAllocation->enmType) 1776 1788 { … … 1797 1809 } 1798 1810 #endif 1799 //#ifdef VBOX_WITH_VIDEOHWACCEL1800 // case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:1801 // {1802 // if (pAllocation->fRcFlags.Overlay)1803 // {1804 // vboxVhwaHlpDestroyOverlay(pDevExt, pAllocation);1805 // }1806 // break;1807 // }1808 //#endif1809 1811 case VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER: 1810 1812 { … … 1825 1827 vboxWddmSwapchainRelease(pSwapchain); 1826 1828 } 1829 } 1830 1831 VOID vboxWddmAllocationDestroy(PVBOXWDDM_ALLOCATION pAllocation) 1832 { 1833 PAGED_CODE(); 1827 1834 1828 1835 vboxWddmAllocationDeleteFromResource(pAllocation->pResource, pAllocation); 1829 1830 return STATUS_SUCCESS; 1831 } 1832 1833 NTSTATUS vboxWddmCreateAllocation(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_RESOURCE pResource, uint32_t iIndex, DXGK_ALLOCATIONINFO* pAllocationInfo) 1836 } 1837 1838 PVBOXWDDM_ALLOCATION vboxWddmAllocationCreateFromResource(PVBOXWDDM_RESOURCE pResource, uint32_t iIndex) 1839 { 1840 PVBOXWDDM_ALLOCATION pAllocation = NULL; 1841 if (pResource) 1842 { 1843 Assert(iIndex < pResource->cAllocations); 1844 if (iIndex < pResource->cAllocations) 1845 { 1846 pAllocation = &pResource->aAllocations[iIndex]; 1847 memset(pAllocation, 0, sizeof (VBOXWDDM_ALLOCATION)); 1848 } 1849 vboxWddmResourceRetain(pResource); 1850 } 1851 else 1852 pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(sizeof (VBOXWDDM_ALLOCATION)); 1853 1854 if (pAllocation) 1855 { 1856 if (pResource) 1857 { 1858 pAllocation->pResource = pResource; 1859 pAllocation->iIndex = iIndex; 1860 } 1861 } 1862 1863 return pAllocation; 1864 } 1865 1866 VOID vboxWddmAllocationWaitDereference(PVBOXWDDM_ALLOCATION pAllocation) 1867 { 1868 vboxWddmCounterU32Wait(&pAllocation->cRefs, 1); 1869 } 1870 1871 1872 NTSTATUS vboxWddmAllocationCreate(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_RESOURCE pResource, uint32_t iIndex, DXGK_ALLOCATIONINFO* pAllocationInfo) 1834 1873 { 1835 1874 PAGED_CODE(); … … 1862 1901 pAllocation->enmType = pAllocInfo->enmType; 1863 1902 pAllocation->offVram = VBOXVIDEOOFFSET_VOID; 1903 pAllocation->cRefs = 1; 1864 1904 pAllocation->bVisible = FALSE; 1865 1905 pAllocation->bAssigned = FALSE; … … 2036 2076 if (pResource) 2037 2077 { 2078 pResource->cRefs = 1; 2038 2079 pResource->cAllocations = pRcInfo->cAllocInfos; 2039 2080 pResource->fFlags = pRcInfo->fFlags; … … 2053 2094 for (UINT i = 0; i < pCreateAllocation->NumAllocations; ++i) 2054 2095 { 2055 Status = vboxWddm CreateAllocation(pDevExt, pResource, i, &pCreateAllocation->pAllocationInfo[i]);2096 Status = vboxWddmAllocationCreate(pDevExt, pResource, i, &pCreateAllocation->pAllocationInfo[i]); 2056 2097 Assert(Status == STATUS_SUCCESS); 2057 2098 if (Status != STATUS_SUCCESS) 2058 2099 { 2059 LOGREL(("ERROR: vboxWddm CreateAllocationerror (0x%x)", Status));2100 LOGREL(("ERROR: vboxWddmAllocationCreate error (0x%x)", Status)); 2060 2101 /* note: i-th allocation is expected to be cleared in a fail handling code above */ 2061 2102 for (UINT j = 0; j < i; ++j) 2062 2103 { 2063 vboxWddmDestroyAllocation(pDevExt, (PVBOXWDDM_ALLOCATION)pCreateAllocation->pAllocationInfo[j].hAllocation); 2104 vboxWddmAllocationCleanup(pDevExt, (PVBOXWDDM_ALLOCATION)pCreateAllocation->pAllocationInfo[j].hAllocation); 2105 vboxWddmAllocationRelease((PVBOXWDDM_ALLOCATION)pCreateAllocation->pAllocationInfo[j].hAllocation); 2064 2106 } 2065 2107 } … … 2068 2110 pCreateAllocation->hResource = pResource; 2069 2111 if (pResource && Status != STATUS_SUCCESS) 2070 vboxWddm MemFree(pResource);2112 vboxWddmResourceRelease(pResource); 2071 2113 } 2072 2114 LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter)); … … 2091 2133 2092 2134 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)pDestroyAllocation->hResource; 2135 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 2093 2136 2094 2137 if (pRc) … … 2101 2144 PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pDestroyAllocation->pAllocationList[i]; 2102 2145 Assert(pAlloc->pResource == pRc); 2103 vboxWddmDestroyAllocation((PVBOXMP_DEVEXT)hAdapter, pAlloc); 2146 /* wait for all current allocation-related ops are completed */ 2147 vboxWddmAllocationWaitDereference(pAlloc); 2148 vboxWddmAllocationCleanup(pDevExt, pAlloc); 2149 vboxWddmAllocationRelease(pAlloc); 2104 2150 } 2105 2151 2106 2152 if (pRc) 2107 2153 { 2108 vboxWddmMemFree(pRc); 2154 /* wait for all current resource-related ops are completed */ 2155 vboxWddmResourceWaitDereference(pRc); 2156 vboxWddmResourceRelease(pRc); 2109 2157 } 2110 2158 … … 2483 2531 static NTSTATUS vboxWddmSubmitCmd(PVBOXMP_DEVEXT pDevExt, VBOXVDMAPIPE_CMD_DMACMD *pCmd) 2484 2532 { 2485 NTSTATUS Status = vboxVdma DdiCmdSubmitted(pDevExt, &pDevExt->DdiCmdQueue, &pCmd->DdiCmd);2533 NTSTATUS Status = vboxVdmaGgCmdDmaNotifySubmitted(pDevExt, pCmd); 2486 2534 Assert(Status == STATUS_SUCCESS); 2487 2535 if (Status == STATUS_SUCCESS) 2488 2536 { 2489 if (pCmd->fFlags.bDecVBVAUnlock) 2490 { 2491 uint32_t cNew = ASMAtomicIncU32(&pDevExt->cUnlockedVBVADisabled); 2492 Assert(cNew < UINT32_MAX/2); 2493 } 2494 NTSTATUS submStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pCmd->Hdr); 2537 NTSTATUS submStatus = vboxVdmaGgCmdSubmit(pDevExt, &pCmd->Hdr); 2495 2538 Assert(submStatus == STATUS_SUCCESS); 2496 2539 if (submStatus != STATUS_SUCCESS) 2497 2540 { 2498 if (pCmd->fFlags.bDecVBVAUnlock) 2499 { 2500 uint32_t cNew = ASMAtomicDecU32(&pDevExt->cUnlockedVBVADisabled); 2501 Assert(cNew < UINT32_MAX/2); 2502 } 2503 vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pCmd->DdiCmd, DXGK_INTERRUPT_DMA_FAULTED); 2541 vboxVdmaGgCmdDmaNotifyCompleted(pDevExt, pCmd, DXGK_INTERRUPT_DMA_FAULTED); 2504 2542 } 2505 2543 } 2506 2544 else 2507 2545 { 2508 vboxVdmaGgCmdDestroy( &pCmd->Hdr);2546 vboxVdmaGgCmdDestroy(pDevExt, &pCmd->Hdr); 2509 2547 } 2510 2548 return Status; … … 2514 2552 { 2515 2553 NTSTATUS Status = STATUS_SUCCESS; 2516 2517 PVBOXVDMAPIPE_CMD_DMACMD_BLT pBltCmd = (PVBOXVDMAPIPE_CMD_DMACMD_BLT)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_DMACMD, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_BLT, Blt.DstRects.UpdateRects.aRects[pBlt->Blt.DstRects.UpdateRects.cRects])); 2554 PVBOXVDMAPIPE_CMD_DMACMD_BLT pBltCmd = (PVBOXVDMAPIPE_CMD_DMACMD_BLT)vboxVdmaGgCmdCreate(pDevExt, VBOXVDMAPIPE_CMD_TYPE_DMACMD, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_BLT, Blt.DstRects.UpdateRects.aRects[pBlt->Blt.DstRects.UpdateRects.cRects])); 2518 2555 Assert(pBltCmd); 2519 2556 if (pBltCmd) 2520 2557 { 2521 2558 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pBlt->Blt.DstAlloc.srcId]; 2522 vboxVdmaDdiCmdInit(&pBltCmd->Hdr.DdiCmd, u32FenceId, pContext, vboxVdmaGgDdiCmdDestroy, pBltCmd); 2523 pBltCmd->Hdr.pDevExt = pDevExt; 2559 vboxVdmaGgCmdDmaNotifyInit(&pBltCmd->Hdr, pContext->NodeOrdinal, u32FenceId, NULL, NULL); 2524 2560 pBltCmd->Hdr.fFlags = fBltFlags; 2561 pBltCmd->Hdr.pContext = pContext; 2525 2562 pBltCmd->Hdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 2526 2563 memcpy(&pBltCmd->Blt, &pBlt->Blt, RT_OFFSETOF(VBOXVDMA_BLT, DstRects.UpdateRects.aRects[pBlt->Blt.DstRects.UpdateRects.cRects])); … … 2529 2566 else 2530 2567 { 2531 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, u32FenceId, DXGK_INTERRUPT_DMA_FAULTED); 2532 } 2533 2568 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, u32FenceId, DXGK_INTERRUPT_DMA_FAULTED); 2569 } 2534 2570 return Status; 2535 2571 } … … 2627 2663 /* get DPC data at IRQL */ 2628 2664 2629 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);2665 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED); 2630 2666 break; 2631 2667 } … … 2675 2711 uint32_t cUnlockedVBVADisabled = ASMAtomicReadU32(&pDevExt->cUnlockedVBVADisabled); 2676 2712 if (!cUnlockedVBVADisabled) 2713 { 2677 2714 VBOXVBVA_OP(ReportDirtyRect, pDevExt, pSource, &rect); 2715 } 2678 2716 else 2679 2717 { 2680 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);2681 2718 VBOXVBVA_OP_WITHLOCK_ATDPC(ReportDirtyRect, pDevExt, pSource, &rect); 2682 2719 } … … 2685 2722 { 2686 2723 fBltFlags.b2DRelated = 1; 2687 fBltFlags.bDecVBVAUnlock = 1;2688 2724 } 2689 2725 … … 2748 2784 if (bComplete) 2749 2785 { 2750 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);2786 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED); 2751 2787 } 2752 2788 break; … … 2787 2823 2788 2824 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr); 2789 vboxVdmaDdiCmdInit(pDdiCmd, p SubmitCommand->SubmissionFenceId, pContext, vboxWddmDmaCompleteChromiumCmd, pDr);2790 NTSTATUS Status = vboxVdmaDdiCmdSubmitted(pDevExt, &pDevExt->DdiCmdQueue,pDdiCmd);2825 vboxVdmaDdiCmdInit(pDdiCmd, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, vboxWddmDmaCompleteChromiumCmd, pDr); 2826 NTSTATUS Status = vboxVdmaDdiCmdSubmitted(pDevExt, pDdiCmd); 2791 2827 Assert(Status == STATUS_SUCCESS); 2792 2828 if (Status == STATUS_SUCCESS) … … 2800 2836 } 2801 2837 #else 2802 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);2838 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED); 2803 2839 Assert(Status == STATUS_SUCCESS); 2804 2840 #endif … … 2808 2844 { 2809 2845 VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip = (VBOXWDDM_DMA_PRIVATEDATA_FLIP*)pPrivateDataBase; 2810 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlipCmd = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)vboxVdmaGgCmdCreate( 2811 &pDevExt->u.primary.Vdma.DmaGg,VBOXVDMAPIPE_CMD_TYPE_DMACMD, sizeof (VBOXVDMAPIPE_CMD_DMACMD_FLIP));2846 PVBOXVDMAPIPE_CMD_DMACMD_FLIP pFlipCmd = (PVBOXVDMAPIPE_CMD_DMACMD_FLIP)vboxVdmaGgCmdCreate(pDevExt, 2847 VBOXVDMAPIPE_CMD_TYPE_DMACMD, sizeof (VBOXVDMAPIPE_CMD_DMACMD_FLIP)); 2812 2848 Assert(pFlipCmd); 2813 2849 if (pFlipCmd) 2814 2850 { 2815 2851 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pFlip->Flip.Alloc.srcId]; 2816 vboxVdmaDdiCmdInit(&pFlipCmd->Hdr.DdiCmd, pSubmitCommand->SubmissionFenceId, pContext, vboxVdmaGgDdiCmdDestroy, pFlipCmd); 2817 pFlipCmd->Hdr.pDevExt = pDevExt; 2852 vboxVdmaGgCmdDmaNotifyInit(&pFlipCmd->Hdr, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, NULL, NULL); 2818 2853 pFlipCmd->Hdr.fFlags.Value = 0; 2819 2854 pFlipCmd->Hdr.fFlags.b3DRelated = 1; 2855 pFlipCmd->Hdr.pContext = pContext; 2820 2856 pFlipCmd->Hdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP; 2821 2857 memcpy(&pFlipCmd->Flip, &pFlip->Flip, sizeof (pFlipCmd->Flip)); … … 2825 2861 else 2826 2862 { 2827 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED);2863 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED); 2828 2864 Assert(Status == STATUS_SUCCESS); 2829 2865 } … … 2833 2869 { 2834 2870 PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateDataBase; 2835 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCFCmd = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)vboxVdmaGgCmdCreate( 2836 &pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_DMACMD, 2837 RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, ClrFill.Rects.aRects[pCF->ClrFill.Rects.cRects])); 2871 PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL pCFCmd = (PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL)vboxVdmaGgCmdCreate(pDevExt, 2872 VBOXVDMAPIPE_CMD_TYPE_DMACMD, RT_OFFSETOF(VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, ClrFill.Rects.aRects[pCF->ClrFill.Rects.cRects])); 2838 2873 Assert(pCFCmd); 2839 2874 if (pCFCmd) 2840 2875 { 2841 2876 // VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pFlip->Flip.Alloc.srcId]; 2842 vboxVdmaDdiCmdInit(&pCFCmd->Hdr.DdiCmd, pSubmitCommand->SubmissionFenceId, pContext, vboxVdmaGgDdiCmdDestroy, pCFCmd); 2843 pCFCmd->Hdr.pDevExt = pDevExt; 2844 pCFCmd->Hdr.pDevExt = pDevExt; 2877 vboxVdmaGgCmdDmaNotifyInit(&pCFCmd->Hdr, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, NULL, NULL); 2845 2878 pCFCmd->Hdr.fFlags.Value = 0; 2846 2879 pCFCmd->Hdr.fFlags.b2DRelated = 1; 2847 pCFCmd->Hdr. fFlags.bDecVBVAUnlock = 1;2880 pCFCmd->Hdr.pContext = pContext; 2848 2881 pCFCmd->Hdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL; 2849 2882 memcpy(&pCFCmd->ClrFill, &pCF->ClrFill, RT_OFFSETOF(VBOXVDMA_CLRFILL, Rects.aRects[pCF->ClrFill.Rects.cRects])); … … 2853 2886 else 2854 2887 { 2855 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED);2888 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED); 2856 2889 Assert(Status == STATUS_SUCCESS); 2857 2890 } … … 2861 2894 case VBOXVDMACMD_TYPE_DMA_NOP: 2862 2895 { 2863 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext , pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);2896 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED); 2864 2897 Assert(Status == STATUS_SUCCESS); 2865 2898 break; … … 2906 2939 LOGF(("ENTER, hAdapter(0x%x)", hAdapter)); 2907 2940 2908 // AssertBreakpoint();2941 AssertFailed(); 2909 2942 /* @todo: fixme: implement */ 2910 2943 … … 5318 5351 vboxVDbgBreakFv(); 5319 5352 5353 if (pCreateContext->NodeOrdinal >= VBOXWDDM_NUM_NODES) 5354 { 5355 WARN(("Invalid NodeOrdinal (%d), expected to be less that (%d)\n", pCreateContext->NodeOrdinal, VBOXWDDM_NUM_NODES)); 5356 return STATUS_INVALID_PARAMETER; 5357 } 5358 5320 5359 NTSTATUS Status = STATUS_SUCCESS; 5321 5360 PVBOXWDDM_DEVICE pDevice = (PVBOXWDDM_DEVICE)hDevice; … … 5521 5560 } 5522 5561 */ 5562 5563 #ifdef DEBUG_misha 5564 RTLogGroupSettings(0, "+default.e.l.f.l2.l3"); 5565 #endif 5523 5566 5524 5567 LOGREL(("Built %s %s", __DATE__, __TIME__)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h
r36867 r37626 62 62 } 63 63 64 VOID vboxWddmAllocationDestroy(PVBOXWDDM_ALLOCATION pAllocation); 65 66 DECLINLINE(VOID) vboxWddmAllocationRelease(PVBOXWDDM_ALLOCATION pAllocation) 67 { 68 uint32_t cRefs = ASMAtomicDecU32(&pAllocation->cRefs); 69 Assert(cRefs < UINT32_MAX/2); 70 if (!cRefs) 71 { 72 vboxWddmAllocationDestroy(pAllocation); 73 } 74 } 75 76 DECLINLINE(VOID) vboxWddmAllocationRetain(PVBOXWDDM_ALLOCATION pAllocation) 77 { 78 ASMAtomicIncU32(&pAllocation->cRefs); 79 } 80 81 64 82 #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry))) 65 83
Note:
See TracChangeset
for help on using the changeset viewer.