VirtualBox

Ignore:
Timestamp:
Aug 27, 2019 1:44:40 AM (5 years ago)
Author:
vboxsync
Message:

WDDM: more cleanups. bugref:9529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp

    r80422 r80435  
    11231123
    11241124
    1125 int vboxCmdVbvaConConnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
    1126         uint32_t crVersionMajor, uint32_t crVersionMinor,
    1127         uint32_t *pu32ClientID)
    1128 {
    1129     VBOXCMDVBVA_CTL_3DCTL_CONNECT RT_UNTRUSTED_VOLATILE_HOST *pConnect =
    1130         (VBOXCMDVBVA_CTL_3DCTL_CONNECT RT_UNTRUSTED_VOLATILE_HOST *)vboxCmdVbvaCtlCreate(pHGSMICtx,
    1131                                                                                          sizeof(VBOXCMDVBVA_CTL_3DCTL_CONNECT));
    1132     if (!pConnect)
    1133     {
    1134         WARN(("vboxCmdVbvaCtlCreate failed"));
    1135         return VERR_OUT_OF_RESOURCES;
    1136     }
    1137     pConnect->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL;
    1138     pConnect->Hdr.i32Result = VERR_NOT_SUPPORTED;
    1139     pConnect->Connect.Hdr.u32Type = VBOXCMDVBVA3DCTL_TYPE_CONNECT;
    1140     pConnect->Connect.Hdr.u32CmdClientId = 0;
    1141     pConnect->Connect.u32MajorVersion = crVersionMajor;
    1142     pConnect->Connect.u32MinorVersion = crVersionMinor;
    1143     pConnect->Connect.u64Pid = (uintptr_t)PsGetCurrentProcessId();
    1144 
    1145     int rc = vboxCmdVbvaCtlSubmitSync(pHGSMICtx, &pConnect->Hdr);
    1146     if (RT_SUCCESS(rc))
    1147     {
    1148         rc = pConnect->Hdr.i32Result;
    1149         if (RT_SUCCESS(rc))
    1150         {
    1151             Assert(pConnect->Connect.Hdr.u32CmdClientId);
    1152             *pu32ClientID = pConnect->Connect.Hdr.u32CmdClientId;
    1153         }
    1154         else
    1155             WARN(("VBOXCMDVBVA3DCTL_TYPE_CONNECT Disable failed %d", rc));
    1156     }
    1157     else
    1158         WARN(("vboxCmdVbvaCtlSubmitSync returnd %d", rc));
    1159 
    1160     vboxCmdVbvaCtlFree(pHGSMICtx, &pConnect->Hdr);
    1161 
    1162     return rc;
    1163 }
    1164 
    1165 int vboxCmdVbvaConDisconnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t u32ClientID)
    1166 {
    1167     VBOXCMDVBVA_CTL_3DCTL RT_UNTRUSTED_VOLATILE_HOST *pDisconnect =
    1168         (VBOXCMDVBVA_CTL_3DCTL RT_UNTRUSTED_VOLATILE_HOST*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof(VBOXCMDVBVA_CTL_3DCTL));
    1169     if (!pDisconnect)
    1170     {
    1171         WARN(("vboxCmdVbvaCtlCreate failed"));
    1172         return VERR_OUT_OF_RESOURCES;
    1173     }
    1174     pDisconnect->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL;
    1175     pDisconnect->Hdr.i32Result = VERR_NOT_SUPPORTED;
    1176     pDisconnect->Ctl.u32Type = VBOXCMDVBVA3DCTL_TYPE_DISCONNECT;
    1177     pDisconnect->Ctl.u32CmdClientId = u32ClientID;
    1178 
    1179     int rc = vboxCmdVbvaCtlSubmitSync(pHGSMICtx, &pDisconnect->Hdr);
    1180     if (RT_SUCCESS(rc))
    1181     {
    1182         rc = pDisconnect->Hdr.i32Result;
    1183         if (!RT_SUCCESS(rc))
    1184             WARN(("VBOXCMDVBVA3DCTL_TYPE_DISCONNECT Disable failed %d", rc));
    1185     }
    1186     else
    1187         WARN(("vboxCmdVbvaCtlSubmitSync returnd %d", rc));
    1188 
    1189     vboxCmdVbvaCtlFree(pHGSMICtx, &pDisconnect->Hdr);
    1190 
    1191     return rc;
    1192 }
    1193 
    1194 int VBoxCmdVbvaConConnect(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva,
    1195                           uint32_t crVersionMajor, uint32_t crVersionMinor,
    1196                           uint32_t *pu32ClientID)
    1197 {
    1198     RT_NOREF(pVbva);
    1199     return vboxCmdVbvaConConnect(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, crVersionMajor, crVersionMinor, pu32ClientID);
    1200 }
    1201 
    1202 int VBoxCmdVbvaConDisconnect(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t u32ClientID)
    1203 {
    1204     RT_NOREF(pVbva);
    1205     return vboxCmdVbvaConDisconnect(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, u32ClientID);
    1206 }
    1207 
    1208 static VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *vboxCmdVbvaConCmdAlloc(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCmd)
    1209 {
    1210     VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd =
    1211         (VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)vboxCmdVbvaCtlCreate(pHGSMICtx,
    1212                                                                                      sizeof(VBOXCMDVBVA_CTL_3DCTL_CMD) + cbCmd);
    1213     if (!pCmd)
    1214     {
    1215         WARN(("vboxCmdVbvaCtlCreate failed"));
    1216         return NULL;
    1217     }
    1218     pCmd->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_3DCTL;
    1219     pCmd->Hdr.i32Result = VERR_NOT_SUPPORTED;
    1220     pCmd->Cmd.Hdr.u32Type = VBOXCMDVBVA3DCTL_TYPE_CMD;
    1221     pCmd->Cmd.Hdr.u32CmdClientId = 0;
    1222     pCmd->Cmd.Cmd.u8OpCode = VBOXCMDVBVA_OPTYPE_CRCMD;
    1223     pCmd->Cmd.Cmd.u8Flags = 0;
    1224     pCmd->Cmd.Cmd.u8State = VBOXCMDVBVA_STATE_SUBMITTED;
    1225     pCmd->Cmd.Cmd.u.i8Result = -1;
    1226     pCmd->Cmd.Cmd.u2.u32FenceID = 0;
    1227 
    1228     return (VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *)(pCmd + 1);
    1229 }
    1230 
    1231 void vboxCmdVbvaConCmdFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    1232 {
    1233     VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)pCmd) - 1;
    1234     vboxCmdVbvaCtlFree(pHGSMICtx, &pHdr->Hdr);
    1235 }
    1236 
    1237 int vboxCmdVbvaConSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd,
    1238                               FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void RT_UNTRUSTED_VOLATILE_HOST *pvCompletion)
    1239 {
    1240     VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)pCmd)-1;
    1241     return vboxCmdVbvaCtlSubmitAsync(pHGSMICtx, &pHdr->Hdr, pfnCompletion, pvCompletion);
    1242 }
    1243 
    1244 VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *VBoxCmdVbvaConCmdAlloc(PVBOXMP_DEVEXT pDevExt, uint32_t cbCmd)
    1245 {
    1246     return vboxCmdVbvaConCmdAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, cbCmd);
    1247 }
    1248 
    1249 void VBoxCmdVbvaConCmdFree(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    1250 {
    1251     vboxCmdVbvaConCmdFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd);
    1252 }
    1253 
    1254 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd,
    1255                                  PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, void RT_UNTRUSTED_VOLATILE_HOST *pvCompletion)
    1256 {
    1257     return vboxCmdVbvaConSubmitAsync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd, pfnCompletion, pvCompletion);
    1258 }
    1259 
    1260 int VBoxCmdVbvaConCmdCompletionData(void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST **ppCmd)
    1261 {
    1262     VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)pvCmd;
    1263     if (ppCmd)
    1264         *ppCmd = (VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *)(pCmd + 1);
    1265     return pCmd->Hdr.i32Result;
    1266 }
    1267 
    1268 int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const uint32_t *pTargetMap, const POINT * pVScreenPos, uint16_t fFlags)
    1269 {
    1270     Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);
    1271 
    1272     VBOXCMDVBVA_CTL_RESIZE RT_UNTRUSTED_VOLATILE_HOST *pResize =
    1273         (VBOXCMDVBVA_CTL_RESIZE RT_UNTRUSTED_VOLATILE_HOST*)vboxCmdVbvaCtlCreate(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx,
    1274                                                                                  sizeof(VBOXCMDVBVA_CTL_RESIZE));
    1275     if (!pResize)
    1276     {
    1277         WARN(("vboxCmdVbvaCtlCreate failed"));
    1278         return VERR_OUT_OF_RESOURCES;
    1279     }
    1280 
    1281     pResize->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_RESIZE;
    1282     pResize->Hdr.i32Result = VERR_NOT_IMPLEMENTED;
    1283 
    1284     int rc = vboxWddmScreenInfoInit(&pResize->Resize.aEntries[0].Screen, pAllocData, pVScreenPos, fFlags);
    1285     if (RT_SUCCESS(rc))
    1286     {
    1287         VBOXCMDVBVA_RESIZE_ENTRY RT_UNTRUSTED_VOLATILE_HOST *pEntry = &pResize->Resize.aEntries[0];
    1288         memcpy((void *)&pEntry->aTargetMap[0], pTargetMap, sizeof(pEntry->aTargetMap));
    1289         LOG(("[%d] %dx%d, TargetMap0 0x%x, flags 0x%x",
    1290             pEntry->Screen.u32ViewIndex, pEntry->Screen.u32Width, pEntry->Screen.u32Height, pEntry->aTargetMap[0], pEntry->Screen.u16Flags));
    1291 
    1292         rc = vboxCmdVbvaCtlSubmitSync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, &pResize->Hdr);
    1293         if (RT_SUCCESS(rc))
    1294         {
    1295             rc = pResize->Hdr.i32Result;
    1296             if (RT_FAILURE(rc))
    1297                 WARN(("VBOXCMDVBVACTL_TYPE_RESIZE failed %d", rc));
    1298         }
    1299         else
    1300             WARN(("vboxCmdVbvaCtlSubmitSync failed %d", rc));
    1301     }
    1302     else
    1303         WARN(("vboxWddmScreenInfoInit failed %d", rc));
    1304 
    1305     vboxCmdVbvaCtlFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, &pResize->Hdr);
    1306 
    1307     return rc;
    1308 }
    13091125#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette