Changeset 37626 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
- Timestamp:
- Jun 24, 2011 12:01:33 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.