Changeset 50754 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
- Timestamp:
- Mar 12, 2014 5:43:09 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
r49591 r50754 114 114 } 115 115 116 static bool vboxVBVAExInformHost(PVBVAEXBUFFERCONTEXT pCtx, 117 PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, bool bEnable) 118 { 119 bool bRc = false; 120 121 #if 0 /* All callers check this */ 122 if (ppdev->bHGSMISupported) 123 #endif 124 { 125 void *p = VBoxHGSMIBufferAlloc(pHGSMICtx, 126 sizeof (VBVAENABLE_EX), 127 HGSMI_CH_VBVA, 128 pCtx->u16EnableOp); 129 if (!p) 130 { 131 LogFunc(("HGSMIHeapAlloc failed\n")); 116 static int vboxCmdVbvaSubmitHgsmi(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, HGSMIOFFSET offDr) 117 { 118 VBoxVideoCmnPortWriteUlong(pHGSMICtx->port, offDr); 119 return VINF_SUCCESS; 120 } 121 #define vboxCmdVbvaSubmit vboxCmdVbvaSubmitHgsmi 122 123 static VBOXCMDVBVA_CTL * vboxCmdVbvaCtlCreate(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCtl) 124 { 125 Assert(cbCtl >= sizeof (VBOXCMDVBVA_CTL)); 126 return (VBOXCMDVBVA_CTL*)VBoxSHGSMICommandAlloc(&pHGSMICtx->heapCtx, cbCtl, HGSMI_CH_VBVA, VBVA_CMDVBVA_CTL); 127 } 128 129 static void vboxCmdVbvaCtlFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl) 130 { 131 VBoxSHGSMICommandFree(&pHGSMICtx->heapCtx, pCtl); 132 } 133 134 static int vboxCmdVbvaCtlSubmitSync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl) 135 { 136 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepSynch(&pHGSMICtx->heapCtx, pCtl); 137 if (!pHdr) 138 { 139 WARN(("VBoxSHGSMICommandPrepSynch returnd NULL")); 140 return VERR_INVALID_PARAMETER; 141 } 142 143 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr); 144 if (offCmd == HGSMIOFFSET_VOID) 145 { 146 WARN(("VBoxSHGSMICommandOffset returnd NULL")); 147 VBoxSHGSMICommandCancelSynch(&pHGSMICtx->heapCtx, pHdr); 148 return VERR_INVALID_PARAMETER; 149 } 150 151 int rc = vboxCmdVbvaSubmit(pHGSMICtx, offCmd); 152 if (RT_SUCCESS(rc)) 153 { 154 rc = VBoxSHGSMICommandDoneSynch(&pHGSMICtx->heapCtx, pHdr); 155 if (RT_SUCCESS(rc)) 156 { 157 rc = pCtl->i32Result; 158 if (!RT_SUCCESS(rc)) 159 WARN(("pCtl->i32Result %d", pCtl->i32Result)); 160 161 return rc; 132 162 } 133 163 else 134 { 135 VBVAENABLE_EX *pEnable = (VBVAENABLE_EX *)p; 136 137 pEnable->Base.u32Flags = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 138 pEnable->Base.u32Offset = pCtx->offVRAMBuffer; 139 pEnable->Base.i32Result = VERR_NOT_SUPPORTED; 140 pEnable->Base.u32Flags |= VBVA_F_ABSOFFSET; 141 142 VBoxHGSMIBufferSubmit(pHGSMICtx, p); 143 144 if (bEnable) 145 { 146 bRc = RT_SUCCESS(pEnable->Base.i32Result); 147 } 148 else 149 { 150 bRc = true; 151 } 152 153 VBoxHGSMIBufferFree(pHGSMICtx, p); 154 } 155 } 156 157 return bRc; 164 WARN(("VBoxSHGSMICommandDoneSynch returnd %d", rc)); 165 } 166 else 167 WARN(("vboxCmdVbvaSubmit returnd %d", rc)); 168 169 VBoxSHGSMICommandCancelSynch(&pHGSMICtx->heapCtx, pHdr); 170 171 return rc; 172 } 173 174 static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletionIrq, void *pvCompletionIrq) 175 { 176 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynchIrq(&pHGSMICtx->heapCtx, pCtl, pfnCompletionIrq, pvCompletionIrq, VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE); 177 if (!pHdr) 178 { 179 WARN(("VBoxSHGSMICommandPrepAsynchIrq returnd NULL")); 180 return VERR_INVALID_PARAMETER; 181 } 182 183 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr); 184 if (offCmd == HGSMIOFFSET_VOID) 185 { 186 WARN(("VBoxSHGSMICommandOffset returnd NULL")); 187 VBoxSHGSMICommandCancelAsynch(&pHGSMICtx->heapCtx, pHdr); 188 return VERR_INVALID_PARAMETER; 189 } 190 191 int rc = vboxCmdVbvaSubmit(pHGSMICtx, offCmd); 192 if (RT_SUCCESS(rc)) 193 { 194 VBoxSHGSMICommandDoneAsynch(&pHGSMICtx->heapCtx, pHdr); 195 return rc; 196 } 197 else 198 WARN(("vboxCmdVbvaSubmit returnd %d", rc)); 199 200 VBoxSHGSMICommandCancelAsynch(&pHGSMICtx->heapCtx, pHdr); 201 202 return rc; 203 } 204 205 static int vboxVBVAExCtlSubmitEnableDisable(PVBVAEXBUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, bool fEnable) 206 { 207 VBOXCMDVBVA_CTL_ENABLE *pCtl = (VBOXCMDVBVA_CTL_ENABLE*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (*pCtl)); 208 if (!pCtl) 209 { 210 WARN(("vboxCmdVbvaCtlCreate failed")); 211 return VERR_NO_MEMORY; 212 } 213 214 pCtl->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_ENABLE; 215 pCtl->Hdr.i32Result = VERR_NOT_IMPLEMENTED; 216 memset(&pCtl->Enable, 0, sizeof (pCtl->Enable)); 217 pCtl->Enable.u32Flags = fEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 218 pCtl->Enable.u32Offset = pCtx->offVRAMBuffer; 219 pCtl->Enable.i32Result = VERR_NOT_SUPPORTED; 220 pCtl->Enable.u32Flags |= VBVA_F_ABSOFFSET; 221 222 int rc = vboxCmdVbvaCtlSubmitSync(pHGSMICtx, &pCtl->Hdr); 223 if (RT_SUCCESS(rc)) 224 { 225 rc = pCtl->Hdr.i32Result; 226 if (!RT_SUCCESS(rc)) 227 WARN(("vboxCmdVbvaCtlSubmitSync Disable failed %d", rc)); 228 } 229 else 230 WARN(("vboxCmdVbvaCtlSubmitSync returnd %d", rc)); 231 232 vboxCmdVbvaCtlFree(pHGSMICtx, &pCtl->Hdr); 233 234 return rc; 158 235 } 159 236 … … 189 266 pCtx->pVBVA = pVBVA; 190 267 191 bRc = vboxVBVAEx InformHost(pCtx, pHGSMICtx, true);268 bRc = vboxVBVAExCtlSubmitEnableDisable(pCtx, pHGSMICtx, true); 192 269 } 193 270 … … 209 286 pCtx->pVBVA = NULL; 210 287 211 vboxVBVAEx InformHost(pCtx, pHGSMICtx, false);288 vboxVBVAExCtlSubmitEnableDisable(pCtx, pHGSMICtx, false); 212 289 213 290 return; … … 539 616 uint32_t cbBuffer, 540 617 PFNVBVAEXBUFFERFLUSH pfnFlush, 541 void *pvFlush, 542 uint16_t u16EnableOp) 618 void *pvFlush) 543 619 { 544 620 memset(pCtx, 0, RT_OFFSETOF(VBVAEXBUFFERCONTEXT, pVBVA)); 545 621 pCtx->offVRAMBuffer = offVRAMBuffer; 546 622 pCtx->cbBuffer = cbBuffer; 547 pCtx->u16EnableOp = u16EnableOp;548 623 pCtx->pfnFlush = pfnFlush; 549 624 pCtx->pvFlush = pvFlush; … … 824 899 { 825 900 Assert(pVbva->Vbva.pVBVA); 826 VBoxVBVAExSetupBufferContext(&pVbva->Vbva, offBuffer, cbBuffer, voxCmdVbvaFlushCb, pDevExt , VBVA_CMDVBVA_ENABLE);901 VBoxVBVAExSetupBufferContext(&pVbva->Vbva, offBuffer, cbBuffer, voxCmdVbvaFlushCb, pDevExt); 827 902 } 828 903 else
Note:
See TracChangeset
for help on using the changeset viewer.