Changeset 80422 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
- Timestamp:
- Aug 26, 2019 1:56:24 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
r76553 r80422 763 763 764 764 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, ¬ify); 765 }766 767 typedef struct VBOXCMDVBVA_NOTIFYPREEMPT_CB768 {769 PVBOXMP_DEVEXT pDevExt;770 VBOXCMDVBVA *pVbva;771 int rc;772 UINT u32SubmitFenceId;773 UINT u32PreemptFenceId;774 } VBOXCMDVBVA_NOTIFYPREEMPT_CB;775 776 static BOOLEAN vboxCmdVbvaDdiNotifyPreemptCb(PVOID pvContext)777 {778 VBOXCMDVBVA_NOTIFYPREEMPT_CB* pData = (VBOXCMDVBVA_NOTIFYPREEMPT_CB*)pvContext;779 PVBOXMP_DEVEXT pDevExt = pData->pDevExt;780 VBOXCMDVBVA *pVbva = pData->pVbva;781 Assert(pVbva->u32FenceProcessed >= pVbva->u32FenceCompleted);782 if (!pData->u32SubmitFenceId || pVbva->u32FenceProcessed == pData->u32SubmitFenceId)783 {784 vboxCmdVbvaDdiNotifyCompleteIrq(pDevExt, pVbva, pData->u32PreemptFenceId, DXGK_INTERRUPT_DMA_PREEMPTED);785 786 pDevExt->u.primary.DxgkInterface.DxgkCbQueueDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle);787 }788 else789 {790 Assert(pVbva->u32FenceProcessed < pData->u32SubmitFenceId);791 Assert(pVbva->cPreempt <= VBOXCMDVBVA_PREEMPT_EL_SIZE);792 if (pVbva->cPreempt == VBOXCMDVBVA_PREEMPT_EL_SIZE)793 {794 WARN(("no more free elements in preempt map"));795 pData->rc = VERR_BUFFER_OVERFLOW;796 return FALSE;797 }798 uint32_t iNewEl = (pVbva->iCurPreempt + pVbva->cPreempt) % VBOXCMDVBVA_PREEMPT_EL_SIZE;799 Assert(iNewEl < VBOXCMDVBVA_PREEMPT_EL_SIZE);800 pVbva->aPreempt[iNewEl].u32SubmitFence = pData->u32SubmitFenceId;801 pVbva->aPreempt[iNewEl].u32PreemptFence = pData->u32PreemptFenceId;802 ++pVbva->cPreempt;803 }804 805 pData->rc = VINF_SUCCESS;806 return TRUE;807 }808 809 static int vboxCmdVbvaDdiNotifyPreempt(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, UINT u32SubmitFenceId, UINT u32PreemptFenceId)810 {811 VBOXCMDVBVA_NOTIFYPREEMPT_CB Data;812 Data.pDevExt = pDevExt;813 Data.pVbva = pVbva;814 Data.rc = VERR_INTERNAL_ERROR;815 Data.u32SubmitFenceId = u32SubmitFenceId;816 Data.u32PreemptFenceId = u32PreemptFenceId;817 BOOLEAN bDummy;818 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution(819 pDevExt->u.primary.DxgkInterface.DeviceHandle,820 vboxCmdVbvaDdiNotifyPreemptCb,821 &Data,822 0, /* IN ULONG MessageNumber */823 &bDummy);824 if (!NT_SUCCESS(Status))825 {826 WARN(("DxgkCbSynchronizeExecution failed Status %#x", Status));827 return VERR_GENERAL_FAILURE;828 }829 830 if (!RT_SUCCESS(Data.rc))831 {832 WARN(("vboxCmdVbvaDdiNotifyPreemptCb failed rc %d", Data.rc));833 return Data.rc;834 }835 836 return VINF_SUCCESS;837 765 } 838 766 … … 1058 986 } 1059 987 1060 bool VBoxCmdVbvaPreempt(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t u32FenceID)1061 {1062 VBVAEXBUFFERBACKWARDITER Iter;1063 VBoxVBVAExBIterInit(&pVbva->Vbva, &Iter);1064 1065 uint32_t cbBuffer;1066 bool fProcessed;1067 uint8_t* pu8Cmd;1068 uint32_t u32SubmitFence = 0;1069 1070 /* we can do it right here */1071 while ((pu8Cmd = (uint8_t*)VBoxVBVAExBIterNext(&Iter, &cbBuffer, &fProcessed)) != NULL)1072 {1073 if (*pu8Cmd == VBOXCMDVBVA_OPTYPE_NOP)1074 continue;1075 1076 VBOXCMDVBVA_HDR *pCmd = (VBOXCMDVBVA_HDR*)pu8Cmd;1077 1078 if (ASMAtomicCmpXchgU8(&pCmd->u8State, VBOXCMDVBVA_STATE_CANCELLED, VBOXCMDVBVA_STATE_SUBMITTED)1079 || pCmd->u8State == VBOXCMDVBVA_STATE_CANCELLED)1080 continue;1081 1082 Assert(pCmd->u8State == VBOXCMDVBVA_STATE_IN_PROGRESS);1083 1084 u32SubmitFence = pCmd->u2.u32FenceID;1085 break;1086 }1087 1088 vboxCmdVbvaDdiNotifyPreempt(pDevExt, pVbva, u32SubmitFence, u32FenceID);1089 1090 return false;1091 }1092 1093 988 bool VBoxCmdVbvaCheckCompletedIrq(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva) 1094 989 { … … 1164 1059 } 1165 1060 1166 uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, uint32_t *pu32FenceSubmitted, uint32_t *pu32FenceProcessed)1167 {1168 return vboxCmdVbvaCheckCompleted(pDevExt, pVbva, fPingHost, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx, false /* fBufferOverflow */, pu32FenceSubmitted, pu32FenceProcessed);1169 }1170 1171 1061 #if 0 1172 1062 static uint32_t vboxCVDdiSysMemElBuild(VBOXCMDVBVA_SYSMEMEL *pEl, PMDL pMdl, uint32_t iPfn, uint32_t cPages)
Note:
See TracChangeset
for help on using the changeset viewer.