Changeset 50859 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
- Timestamp:
- Mar 25, 2014 10:46:17 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
r50831 r50859 172 172 } 173 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 174 static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 175 { 176 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, 0); 183 177 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr); 184 178 if (offCmd == HGSMIOFFSET_VOID) … … 1127 1121 } 1128 1122 1123 int vboxCmdVbvaConConnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, 1124 uint32_t crVersionMajor, uint32_t crVersionMinor, 1125 uint32_t *pu32ClientID) 1126 { 1127 VBOXCMDVBVA_CTL_3DCTL_CONNECT *pConnect = (VBOXCMDVBVA_CTL_3DCTL_CONNECT*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (VBOXCMDVBVA_CTL_3DCTL_CONNECT)); 1128 if (!pConnect) 1129 { 1130 WARN(("vboxCmdVbvaCtlCreate failed")); 1131 return VERR_OUT_OF_RESOURCES; 1132 } 1133 pConnect->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL; 1134 pConnect->Hdr.i32Result = VERR_NOT_SUPPORTED; 1135 pConnect->Connect.Hdr.u32Type = VBOXCMDVBVA3DCTL_TYPE_CONNECT; 1136 pConnect->Connect.Hdr.u32CmdClientId = 0; 1137 pConnect->Connect.u32MajorVersion = crVersionMajor; 1138 pConnect->Connect.u32MinorVersion = crVersionMinor; 1139 pConnect->Connect.u64Pid = (uint64_t)PsGetCurrentProcessId(); 1140 1141 int rc = vboxCmdVbvaCtlSubmitSync(pHGSMICtx, &pConnect->Hdr); 1142 if (RT_SUCCESS(rc)) 1143 { 1144 rc = pConnect->Hdr.i32Result; 1145 if (RT_SUCCESS(rc)) 1146 *pu32ClientID = pConnect->Connect.Hdr.u32CmdClientId; 1147 else 1148 WARN(("VBOXCMDVBVA3DCTL_TYPE_CONNECT Disable failed %d", rc)); 1149 } 1150 else 1151 WARN(("vboxCmdVbvaCtlSubmitSync returnd %d", rc)); 1152 1153 vboxCmdVbvaCtlFree(pHGSMICtx, &pConnect->Hdr); 1154 1155 return rc; 1156 } 1157 1158 int vboxCmdVbvaConDisconnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t u32ClientID) 1159 { 1160 VBOXCMDVBVA_CTL_3DCTL *pDisconnect = (VBOXCMDVBVA_CTL_3DCTL*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (VBOXCMDVBVA_CTL_3DCTL)); 1161 if (!pDisconnect) 1162 { 1163 WARN(("vboxCmdVbvaCtlCreate failed")); 1164 return VERR_OUT_OF_RESOURCES; 1165 } 1166 pDisconnect->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL; 1167 pDisconnect->Hdr.i32Result = VERR_NOT_SUPPORTED; 1168 pDisconnect->Ctl.u32Type = VBOXCMDVBVA3DCTL_TYPE_DISCONNECT; 1169 pDisconnect->Ctl.u32CmdClientId = u32ClientID; 1170 1171 int rc = vboxCmdVbvaCtlSubmitSync(pHGSMICtx, &pDisconnect->Hdr); 1172 if (RT_SUCCESS(rc)) 1173 { 1174 rc = pDisconnect->Hdr.i32Result; 1175 if (!RT_SUCCESS(rc)) 1176 WARN(("VBOXCMDVBVA3DCTL_TYPE_DISCONNECT Disable failed %d", rc)); 1177 } 1178 else 1179 WARN(("vboxCmdVbvaCtlSubmitSync returnd %d", rc)); 1180 1181 vboxCmdVbvaCtlFree(pHGSMICtx, &pDisconnect->Hdr); 1182 1183 return rc; 1184 } 1185 1186 int VBoxCmdVbvaConConnect(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, 1187 uint32_t crVersionMajor, uint32_t crVersionMinor, 1188 uint32_t *pu32ClientID) 1189 { 1190 return vboxCmdVbvaConConnect(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, crVersionMajor, crVersionMinor, pu32ClientID); 1191 } 1192 1193 int VBoxCmdVbvaConDisconnect(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t u32ClientID) 1194 { 1195 return vboxCmdVbvaConDisconnect(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, u32ClientID); 1196 } 1197 1198 VBOXCMDVBVA_CRCMD_CMD* vboxCmdVbvaConCmdAlloc(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCmd) 1199 { 1200 VBOXCMDVBVA_CTL_3DCTL_CMD *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (VBOXCMDVBVA_CTL_3DCTL_CMD) + cbCmd); 1201 if (!pCmd) 1202 { 1203 WARN(("vboxCmdVbvaCtlCreate failed")); 1204 return NULL; 1205 } 1206 pCmd->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL; 1207 pCmd->Hdr.i32Result = VERR_NOT_SUPPORTED; 1208 pCmd->Cmd.Hdr.u32Type = VBOXCMDVBVA3DCTL_TYPE_CMD; 1209 pCmd->Cmd.Hdr.u32CmdClientId = 0; 1210 pCmd->Cmd.Cmd.u8OpCode = VBOXCMDVBVA_OPTYPE_CRCMD; 1211 pCmd->Cmd.Cmd.u8Flags = 0; 1212 pCmd->Cmd.Cmd.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 1213 pCmd->Cmd.Cmd.u.i8Result = -1; 1214 pCmd->Cmd.Cmd.u32FenceID = 0; 1215 1216 return (VBOXCMDVBVA_CRCMD_CMD*)(pCmd+1); 1217 } 1218 1219 void vboxCmdVbvaConCmdFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD *pCmd) 1220 { 1221 VBOXCMDVBVA_CTL_3DCTL_CMD *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD*)pCmd)-1; 1222 vboxCmdVbvaCtlFree(pHGSMICtx, &pHdr->Hdr); 1223 } 1224 1225 int vboxCmdVbvaConSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 1226 { 1227 VBOXCMDVBVA_CTL_3DCTL_CMD *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD*)pCmd)-1; 1228 return vboxCmdVbvaCtlSubmitAsync(pHGSMICtx, &pHdr->Hdr, pfnCompletion, pvCompletion); 1229 } 1230 1231 VBOXCMDVBVA_CRCMD_CMD* VBoxCmdVbvaConCmdAlloc(PVBOXMP_DEVEXT pDevExt, uint32_t cbCmd) 1232 { 1233 return vboxCmdVbvaConCmdAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, cbCmd); 1234 } 1235 1236 void VBoxCmdVbvaConCmdFree(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD *pCmd) 1237 { 1238 vboxCmdVbvaConCmdFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd); 1239 } 1240 1241 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 1242 { 1243 return vboxCmdVbvaConSubmitAsync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd, pfnCompletion, pvCompletion); 1244 } 1245 1246 int VBoxCmdVbvaConCmdCompletionData(void *pvCmd, VBOXCMDVBVA_CRCMD_CMD **ppCmd) 1247 { 1248 VBOXCMDVBVA_CTL_3DCTL_CMD *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD*)pvCmd; 1249 if (ppCmd) 1250 *ppCmd = (VBOXCMDVBVA_CRCMD_CMD*)(pCmd+1); 1251 return pCmd->Hdr.i32Result; 1252 }
Note:
See TracChangeset
for help on using the changeset viewer.