Changeset 71590 in vbox for trunk/src/VBox/Additions/common/VBoxVideo
- Timestamp:
- Mar 31, 2018 6:34:28 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121579
- Location:
- trunk/src/VBox/Additions/common/VBoxVideo
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r69309 r71590 60 60 DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMIOFFSET offLocation) 61 61 { 62 HGSMIBUFFERLOCATION *p; 63 64 /* Allocate the IO buffer. */65 p = (HGSMIBUFFERLOCATION*)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI,66 HGSMI_CC_HOST_FLAGS_LOCATION);62 63 /* Allocate the IO buffer. */ 64 HGSMIBUFFERLOCATION RT_UNTRUSTED_VOLATILE_HOST *p = 65 (HGSMIBUFFERLOCATION RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI, 66 HGSMI_CC_HOST_FLAGS_LOCATION); 67 67 if (!p) 68 68 return VERR_NO_MEMORY; … … 90 90 DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fCaps) 91 91 { 92 VBVACAPS *p; 93 94 /* Allocate the IO buffer. */95 p = (VBVACAPS*)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS);92 93 /* Allocate the IO buffer. */ 94 VBVACAPS RT_UNTRUSTED_VOLATILE_HOST *p = 95 (VBVACAPS RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS); 96 96 97 97 if (!p) -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBuffers.cpp
r69309 r71590 72 72 * @param u16Op the HGSMI command to be sent, set to the descriptor 73 73 */ 74 DECLHIDDEN(void *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,75 HGSMISIZE cbData,76 uint8_t u8Ch,77 uint16_t u16Op)74 DECLHIDDEN(void RT_UNTRUSTED_VOLATILE_HOST *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx, 75 HGSMISIZE cbData, 76 uint8_t u8Ch, 77 uint16_t u16Op) 78 78 { 79 79 #ifdef VBOX_WDDM_MINIPORT 80 return VBoxSHGSMIHeapAlloc 80 return VBoxSHGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op); 81 81 #else 82 return HGSMIHeapAlloc 82 return HGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op); 83 83 #endif 84 84 } … … 91 91 * @param pvBuffer the pointer returned by @a VBoxHGSMIBufferAlloc 92 92 */ 93 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, 94 void *pvBuffer) 93 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 95 94 { 96 95 #ifdef VBOX_WDDM_MINIPORT 97 VBoxSHGSMIHeapFree 96 VBoxSHGSMIHeapFree(&pCtx->heapCtx, pvBuffer); 98 97 #else 99 HGSMIHeapFree 98 HGSMIHeapFree(&pCtx->heapCtx, pvBuffer); 100 99 #endif 101 100 } … … 107 106 * @param pvBuffer the pointer returned by @a VBoxHGSMIBufferAlloc 108 107 */ 109 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, 110 void *pvBuffer) 108 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 111 109 { 112 110 /* Initialize the buffer and get the offset for port IO. */ 113 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset 111 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset(HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer); 114 112 115 113 Assert(offBuffer != HGSMIOFFSET_VOID); -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIHostCmd.cpp
r69309 r71590 76 76 * be completed 77 77 */ 78 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, 79 void *pvMem) 80 { 81 HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem); 78 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvMem) 79 { 80 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = HGSMIBufferHeaderFromData(pvMem); 82 81 HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr); 83 82 Assert(offMem != HGSMIOFFSET_VOID); 84 if(offMem != HGSMIOFFSET_VOID) 85 { 83 if (offMem != HGSMIOFFSET_VOID) 86 84 HGSMINotifyHostCmdComplete(pCtx, offMem); 87 }88 85 } 89 86 -
trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
r71488 r71590 152 152 int rc; 153 153 /* Issue the screen info command. */ 154 void *p = VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOVIEW) * u32Count,155 HGSMI_CH_VBVA, VBVA_INFO_VIEW);156 if (p)157 {158 VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p;159 rc = pfnFill(pvData, pInfo, u32Count);154 VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pInfo = 155 (VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOVIEW) * u32Count, 156 HGSMI_CH_VBVA, VBVA_INFO_VIEW); 157 if (pInfo) 158 { 159 rc = pfnFill(pvData, (VBVAINFOVIEW *)pInfo /* lazy bird */, u32Count); 160 160 if (RT_SUCCESS(rc)) 161 VBoxHGSMIBufferSubmit (pCtx, p);162 VBoxHGSMIBufferFree(pCtx, p );161 VBoxHGSMIBufferSubmit(pCtx, pInfo); 162 VBoxHGSMIBufferFree(pCtx, pInfo); 163 163 } 164 164 else … … 294 294 { 295 295 /* Issue the screen info command. */ 296 void *p = VBoxHGSMIBufferAlloc(pCtx, 297 sizeof (VBVAINFOSCREEN), 298 HGSMI_CH_VBVA, 299 VBVA_INFO_SCREEN); 300 if (!p) 301 { 302 // LogFunc(("HGSMIHeapAlloc failed\n")); 303 } 304 else 305 { 306 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p; 307 296 VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen = 297 (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOSCREEN), 298 HGSMI_CH_VBVA, VBVA_INFO_SCREEN); 299 if (pScreen != NULL) 300 { 308 301 pScreen->u32ViewIndex = cDisplay; 309 302 pScreen->i32OriginX = cOriginX; … … 316 309 pScreen->u16Flags = fFlags; 317 310 318 VBoxHGSMIBufferSubmit(pCtx, p); 319 320 VBoxHGSMIBufferFree(pCtx, p); 311 VBoxHGSMIBufferSubmit(pCtx, pScreen); 312 313 VBoxHGSMIBufferFree(pCtx, pScreen); 314 } 315 else 316 { 317 // LogFunc(("HGSMIHeapAlloc failed\n")); 321 318 } 322 319 } … … 338 335 uint32_t cWidth, uint32_t cHeight) 339 336 { 340 int rc = VINF_SUCCESS;337 int rc; 341 338 VBVAREPORTINPUTMAPPING *p; 342 339 // Log(("%s: cOriginX=%d, cOriginY=%d, cWidth=%u, cHeight=%u\n", __PRETTY_FUNCTION__, (int)cOriginX, (int)cOriginX, … … 377 374 { 378 375 int rc; 379 void *p; 380 381 AssertPtr(paHints); 382 if (!VALID_PTR(paHints)) 383 return VERR_INVALID_POINTER; 384 385 p = VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAQUERYMODEHINTS) 386 + cScreens * sizeof(VBVAMODEHINT), 387 HGSMI_CH_VBVA, VBVA_QUERY_MODE_HINTS); 388 if (!p) 389 { 390 // LogFunc(("HGSMIHeapAlloc failed\n")); 391 return VERR_NO_MEMORY; 392 } 393 else 394 { 395 VBVAQUERYMODEHINTS *pQuery = (VBVAQUERYMODEHINTS *)p; 396 376 VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_HOST *pQuery; 377 378 AssertPtrReturn(paHints, VERR_INVALID_POINTER); 379 pQuery = (VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, 380 sizeof(VBVAQUERYMODEHINTS) 381 + cScreens * sizeof(VBVAMODEHINT), 382 HGSMI_CH_VBVA, VBVA_QUERY_MODE_HINTS); 383 if (pQuery != NULL) 384 { 397 385 pQuery->cHintsQueried = cScreens; 398 386 pQuery->cbHintStructureGuest = sizeof(VBVAMODEHINT); 399 387 pQuery->rc = VERR_NOT_SUPPORTED; 400 388 401 VBoxHGSMIBufferSubmit(pCtx, p );389 VBoxHGSMIBufferSubmit(pCtx, pQuery); 402 390 rc = pQuery->rc; 403 391 if (RT_SUCCESS(rc)) 404 memcpy(paHints, ((uint8_t *)p) + sizeof(VBVAQUERYMODEHINTS), 405 cScreens * sizeof(VBVAMODEHINT)); 406 407 VBoxHGSMIBufferFree(pCtx, p); 392 memcpy(paHints, (void *)(pQuery + 1), cScreens * sizeof(VBVAMODEHINT)); 393 394 VBoxHGSMIBufferFree(pCtx, pQuery); 395 } 396 else 397 { 398 // LogFunc(("HGSMIHeapAlloc failed\n")); 399 rc = VERR_NO_MEMORY; 408 400 } 409 401 return rc; -
trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp
r69309 r71590 56 56 57 57 58 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx, 59 PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, 60 int32_t cScreen, bool bEnable) 61 { 62 bool bRc = false; 58 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, int32_t cScreen, bool fEnable) 59 { 60 bool fRc = false; 63 61 64 62 #if 0 /* All callers check this */ … … 66 64 #endif 67 65 { 68 void *p = VBoxHGSMIBufferAlloc(pHGSMICtx, 69 sizeof (VBVAENABLE_EX), 70 HGSMI_CH_VBVA, 71 VBVA_ENABLE); 72 if (!p) 73 { 74 // LogFunc(("HGSMIHeapAlloc failed\n")); 75 } 76 else 77 { 78 VBVAENABLE_EX *pEnable = (VBVAENABLE_EX *)p; 79 80 pEnable->Base.u32Flags = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 66 VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_HOST *pEnable = 67 (VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pHGSMICtx, sizeof(VBVAENABLE_EX), 68 HGSMI_CH_VBVA, VBVA_ENABLE); 69 if (pEnable != NULL) 70 { 71 pEnable->Base.u32Flags = fEnable ? VBVA_F_ENABLE : VBVA_F_DISABLE; 81 72 pEnable->Base.u32Offset = pCtx->offVRAMBuffer; 82 73 pEnable->Base.i32Result = VERR_NOT_SUPPORTED; … … 87 78 } 88 79 89 VBoxHGSMIBufferSubmit(pHGSMICtx, p); 90 91 if (bEnable) 92 { 93 bRc = RT_SUCCESS(pEnable->Base.i32Result); 94 } 80 VBoxHGSMIBufferSubmit(pHGSMICtx, pEnable); 81 82 if (fEnable) 83 fRc = RT_SUCCESS(pEnable->Base.i32Result); 95 84 else 96 { 97 bRc = true; 98 } 99 100 VBoxHGSMIBufferFree(pHGSMICtx, p); 101 } 102 } 103 104 return bRc; 85 fRc = true; 86 87 VBoxHGSMIBufferFree(pHGSMICtx, pEnable); 88 } 89 else 90 { 91 // LogFunc(("HGSMIHeapAlloc failed\n")); 92 } 93 } 94 95 return fRc; 105 96 } 106 97 … … 112 103 VBVABUFFER *pVBVA, int32_t cScreen) 113 104 { 114 bool bRc = false;105 bool fRc = false; 115 106 116 107 // LogFlowFunc(("pVBVA %p\n", pVBVA)); … … 136 127 pCtx->pVBVA = pVBVA; 137 128 138 bRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true);139 } 140 141 if (! bRc)129 fRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true); 130 } 131 132 if (!fRc) 142 133 { 143 134 VBoxVBVADisable(pCtx, pHGSMICtx, cScreen); 144 135 } 145 136 146 return bRc;137 return fRc; 147 138 } 148 139 … … 158 149 159 150 vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, false); 160 161 return;162 151 } 163 152 … … 165 154 PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx) 166 155 { 167 bool bRc = false;156 bool fRc = false; 168 157 169 158 // LogFunc(("flags = 0x%08X\n", pCtx->pVBVA? pCtx->pVBVA->u32HostEvents: -1)); … … 205 194 pCtx->pRecord = pRecord; 206 195 207 bRc = true;208 } 209 } 210 211 return bRc;196 fRc = true; 197 } 198 } 199 200 return fRc; 212 201 } 213 202 … … 228 217 pCtx->fHwBufferOverflow = false; 229 218 pCtx->pRecord = NULL; 230 231 return;232 219 } 233 220 … … 245 232 { 246 233 /* Issue the flush command. */ 247 void *p = VBoxHGSMIBufferAlloc(pCtx, 248 sizeof (VBVAFLUSH), 249 HGSMI_CH_VBVA, 250 VBVA_FLUSH); 251 if (!p) 234 VBVAFLUSH RT_UNTRUSTED_VOLATILE_HOST *pFlush = 235 (VBVAFLUSH RT_UNTRUSTED_VOLATILE_HOST * )VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAFLUSH), HGSMI_CH_VBVA, VBVA_FLUSH); 236 if (pFlush != NULL) 237 { 238 pFlush->u32Reserved = 0; 239 240 VBoxHGSMIBufferSubmit(pCtx, pFlush); 241 242 VBoxHGSMIBufferFree(pCtx, pFlush); 243 } 244 else 252 245 { 253 246 // LogFunc(("HGSMIHeapAlloc failed\n")); 254 247 } 255 else256 {257 VBVAFLUSH *pFlush = (VBVAFLUSH *)p;258 259 pFlush->u32Reserved = 0;260 261 VBoxHGSMIBufferSubmit(pCtx, p);262 263 VBoxHGSMIBufferFree(pCtx, p);264 }265 266 return;267 248 } 268 249 … … 286 267 memcpy (&pVBVA->au8Data[0], (uint8_t *)p + u32BytesTillBoundary, i32Diff); 287 268 } 288 289 return;290 269 } 291 270
Note:
See TracChangeset
for help on using the changeset viewer.