Changeset 33146 in vbox
- Timestamp:
- Oct 15, 2010 10:34:58 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h
r33116 r33146 38 38 #define SHCRGL_HOST_FN_SET_VM (7) 39 39 #define SHCRGL_HOST_FN_SCREEN_CHANGED (8) 40 #ifdef VBOX_WITH_CRHGSMI 41 #define SHCRGL_HOST_FN_CRHGSMI_CMD (10) 42 #define SHCRGL_HOST_FN_CRHGSMI_CTL (11) 43 #endif 40 44 /* crOpenGL guest functions */ 41 45 #define SHCRGL_GUEST_FN_WRITE (2) -
trunk/include/VBox/VBoxVideo.h
r33048 r33146 1048 1048 #pragma pack() 1049 1049 1050 typedef uint64_t VBOXVIDEOOFFSET; 1051 1052 #define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0) 1053 1050 1054 #ifdef VBOX_WITH_WDDM 1051 1055 # pragma pack(1) … … 1100 1104 return (PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof (VBOXSHGSMIHEADER)); 1101 1105 } 1102 1103 typedef uint64_t VBOXVIDEOOFFSET;1104 1105 #define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)1106 1106 1107 1107 typedef enum … … 1237 1237 1238 1238 #define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) ) 1239 #define VBOXVDMACBUF_DR_FROM_TAIL(_pCmd) ( (VBOXVDMACBUF_DR*)(((uint8_t*)(_pCmd)) - sizeof (VBOXVDMACBUF_DR)) ) 1239 1240 1240 1241 typedef struct VBOXVDMACMD … … 1248 1249 #define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (_t))) 1249 1250 #define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) ) 1251 #define VBOXVDMACMD_FROM_BODY(_pCmd) ( (VBOXVDMACMD*)(((uint8_t*)(_pCmd)) - VBOXVDMACMD_HEADER_SIZE()) ) 1250 1252 #define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)( VBOXVDMACMD_BODY(0, uint8_t) + RT_OFFSETOF(_t, _f) ) ) 1251 1253 … … 1293 1295 } VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL; 1294 1296 1297 # pragma pack() 1298 #endif /* #ifdef VBOX_WITH_VDMA */ 1299 1300 #ifdef VBOX_WITH_CRHGSMI 1301 # pragma pack(1) 1295 1302 typedef struct VBOXVDMACMD_CHROMIUM_BUFFER 1296 1303 { … … 1303 1310 typedef struct VBOXVDMACMD_CHROMIUM_CMD 1304 1311 { 1305 /* the number of buffers is specified in the VBOXVDMACMD::u32CmdSpecific*/ 1312 uint32_t cBuffers; 1313 uint32_t u32Reserved; 1306 1314 VBOXVDMACMD_CHROMIUM_BUFFER aBuffers[1]; 1307 1315 } VBOXVDMACMD_CHROMIUM_CMD, *PVBOXVDMACMD_CHROMIUM_CMD; 1308 1316 1317 typedef enum 1318 { 1319 VBOXVDMACMD_CHROMIUM_CTL_TYPE_UNKNOWN = 0, 1320 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP, 1321 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SIZEHACK = 0xfffffffe 1322 } VBOXVDMACMD_CHROMIUM_CTL_TYPE; 1323 1324 typedef struct VBOXVDMACMD_CHROMIUM_CTL 1325 { 1326 VBOXVDMACMD_CHROMIUM_CTL_TYPE enmType; 1327 uint32_t cbCmd; 1328 } VBOXVDMACMD_CHROMIUM_CTL, *PVBOXVDMACMD_CHROMIUM_CTL; 1329 1330 typedef struct VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP 1331 { 1332 VBOXVDMACMD_CHROMIUM_CTL Hdr; 1333 union 1334 { 1335 void *pvRamBase; 1336 uint64_t uAlignment; 1337 }; 1338 } VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP, *PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP; 1309 1339 # pragma pack() 1310 #endif /* #ifdef VBOX_WITH_VDMA */1340 #endif 1311 1341 1312 1342 #ifdef VBOXVDMA_WITH_VBVA -
trunk/include/VBox/hgcmsvc.h
r29869 r33146 318 318 typedef VBOXHGCMSVCPARM *PVBOXHGCMSVCPARM; 319 319 320 #ifdef VBOX_WITH_CRHGSMI 321 typedef void * HGCMCVSHANDLE; 322 323 typedef DECLCALLBACK(void) HGCMHOSTFASTCALLCB (int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 324 typedef HGCMHOSTFASTCALLCB *PHGCMHOSTFASTCALLCB; 325 #endif 326 327 320 328 /** Service specific extension callback. 321 329 * This callback is called by the service to perform service specific operation. -
trunk/include/VBox/pdmifs.h
r32983 r33146 595 595 typedef struct VBVAINFOVIEW *PVBVAINFOVIEW; 596 596 typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS; 597 typedef struct VBOXVDMACMD_CHROMIUM_CMD *PVBOXVDMACMD_CHROMIUM_CMD; /* <- chromium [hgsmi] command */ 598 typedef struct VBOXVDMACMD_CHROMIUM_CTL *PVBOXVDMACMD_CHROMIUM_CTL; /* <- chromium [hgsmi] command */ 597 599 598 600 /** Pointer to a display connector interface. */ … … 704 706 */ 705 707 DECLR3CALLBACKMEMBER(void, pfnVHWACommandProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd)); 708 709 /** 710 * Process the guest chromium command. 711 * 712 * @param pInterface Pointer to this interface. 713 * @param pCmd Video HW Acceleration Command to be processed. 714 * @thread The emulation thread. 715 */ 716 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiCommandProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd)); 717 718 /** 719 * Process the guest chromium control command. 720 * 721 * @param pInterface Pointer to this interface. 722 * @param pCmd Video HW Acceleration Command to be processed. 723 * @thread The emulation thread. 724 */ 725 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiControlProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl)); 726 706 727 707 728 /** … … 2699 2720 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)); 2700 2721 2722 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc)); 2723 2724 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiControlCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc)); 2701 2725 } PDMIDISPLAYVBVACALLBACKS; 2702 2726 /** PDMIDISPLAYVBVACALLBACKS */ -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxCrHgsmi.cpp
r33120 r33146 26 26 if (!g_hVBoxCrHgsmiProvider) 27 27 { 28 BOOL bRc = GetModuleHandleEx(0, "VBoxDispD3D", &g_hVBoxCrHgsmiProvider);28 BOOL bRc = GetModuleHandleEx(0, L"VBoxDispD3D", &g_hVBoxCrHgsmiProvider); 29 29 // g_hVBoxCrHgsmiProvider = GetModuleHandle(L"VBoxDispD3D"); 30 30 if (bRc) -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiBase.h
r33117 r33146 69 69 } 70 70 71 uint32_t iFirstPage = offLock >> 0x1000;72 uint32_t iAfterLastPage = (cbLock + 0xfff) >> 0x1000;71 uint32_t iFirstPage = offLock >> 12; 72 uint32_t iAfterLastPage = (cbLock + 0xfff) >> 12; 73 73 uint32_t cPages = iAfterLastPage - iFirstPage; 74 uint32_t cBufPages = pBuf->cbBuffer >> 0x1000;74 uint32_t cBufPages = pBuf->cbBuffer >> 12; 75 75 Assert(cPages <= (cBufPages)); 76 76 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiDisp.cpp
r33116 r33146 103 103 cbBuf = VBOXWDDM_ROUNDBOUND(cbBuf, 0x1000); 104 104 Assert(cbBuf); 105 uint32_t cPages = cbBuf >> 0x1000;105 uint32_t cPages = cbBuf >> 12; 106 106 Assert(cPages); 107 107 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.cpp
r33116 r33146 103 103 cbBuf = VBOXWDDM_ROUNDBOUND(cbBuf, 0x1000); 104 104 Assert(cbBuf); 105 uint32_t cPages = cbBuf >> 0x1000;105 uint32_t cPages = cbBuf >> 12; 106 106 Assert(cPages); 107 107 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk
r33048 r33146 84 84 VBoxVideoWddm_DEFS += VBOX_WITH_VDMA 85 85 endif 86 ifdef VBOX_WITH_CRHGSMI 87 VBoxVideoWddm_DEFS += VBOX_WITH_CRHGSMI 88 endif 89 86 90 ifdef DEBUG_misha 87 91 VBoxVideoWddm_DEFS += LOG_ENABLED -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r33116 r33146 1592 1592 Assert(Status == STATUS_SUCCESS); 1593 1593 break; 1594 case VBOXUHGSMI_SYNCHOBJECT_TYPE_NONE: 1595 pAllocation->pSynchEvent = NULL; 1596 Status == STATUS_SUCCESS; 1597 break; 1594 1598 default: 1595 1599 drprintf((__FUNCTION__ ": ERROR: invalid synch info type(%d)\n", pAllocInfo->enmSynchType)); … … 2159 2163 PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)pvContext; 2160 2164 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); 2161 UINT cBufs = pHdr->u32CmdSpecific;2162 2165 VBOXVDMACMD_CHROMIUM_CMD *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHROMIUM_CMD); 2166 UINT cBufs = pBody->cBuffers; 2163 2167 for (UINT i = 0; i < cBufs; ++i) 2164 2168 { … … 2179 2183 FALSE); 2180 2184 break; 2185 case VBOXUHGSMI_SYNCHOBJECT_TYPE_NONE: 2186 break; 2181 2187 default: 2182 2188 Assert(0); … … 2187 2193 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr); 2188 2194 } 2189 2190 2195 #endif 2196 2191 2197 NTSTATUS 2192 2198 APIENTRY … … 2379 2385 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); 2380 2386 pHdr->enmType = VBOXVDMACMD_TYPE_CHROMIUM_CMD; 2381 pHdr->u32CmdSpecific = pChromiumCmd->Base.u32CmdReserved;2387 pHdr->u32CmdSpecific = 0; 2382 2388 VBOXVDMACMD_CHROMIUM_CMD *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHROMIUM_CMD); 2389 pBody->cBuffers = pChromiumCmd->Base.u32CmdReserved; 2383 2390 for (UINT i = 0; i < pChromiumCmd->Base.u32CmdReserved; ++i) 2384 2391 { -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r33091 r33146 6357 6357 pThis->IPort.pfnSetRenderVRAM = vgaPortSetRenderVRAM; 6358 6358 6359 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 6359 #if defined(VBOX_WITH_HGSMI) 6360 # if defined(VBOX_WITH_VIDEOHWACCEL) 6360 6361 pThis->IVBVACallbacks.pfnVHWACommandCompleteAsynch = vbvaVHWACommandCompleteAsynch; 6362 # endif 6363 #if defined(VBOX_WITH_CRHGSMI) 6364 pThis->IVBVACallbacks.pfnCrHgsmiCommandCompleteAsync = vboxVDMACrHgsmiCommandCompleteAsync; 6365 pThis->IVBVACallbacks.pfnCrHgsmiControlCompleteAsync = vboxVDMACrHgsmiControlCompleteAsync; 6366 # endif 6361 6367 #endif 6362 6368 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r33089 r33146 492 492 # endif 493 493 494 #ifdef VBOX_WITH_HGSMI 495 #define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) ) 496 #endif 497 498 # ifdef VBOX_WITH_CRHGSMI 499 int vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc); 500 int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc); 501 # endif 502 494 503 int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM); 495 504 int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version); -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r32877 r33146 1237 1237 } 1238 1238 1239 #define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) )1240 1241 1239 int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd) 1242 1240 { -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r32904 r33146 20 20 #include <iprt/thread.h> 21 21 #include <iprt/mem.h> 22 #include <iprt/asm.h> 22 23 23 24 #include "DevVGA.h" … … 86 87 VBOXVDMAPIPE_CMD_POOL CmdPool; 87 88 } VBOXVDMAHOST, *PVBOXVDMAHOST; 89 90 91 #ifdef VBOX_WITH_CRHGSMI 92 93 typedef DECLCALLBACK(void) FNVBOXVDMACRCTL_CALLBACK(PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd, void* pvContext); 94 typedef FNVBOXVDMACRCTL_CALLBACK *PFNVBOXVDMACRCTL_CALLBACK; 95 96 typedef struct VBOXVDMACMD_CHROMIUM_CTL_PRIVATE 97 { 98 uint32_t cRefs; 99 uint32_t rc; 100 PFNVBOXVDMACRCTL_CALLBACK pfnCompletion; 101 void *pvCompletion; 102 VBOXVDMACMD_CHROMIUM_CTL Cmd; 103 } VBOXVDMACMD_CHROMIUM_CTL_PRIVATE, *PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE; 104 105 #define VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(_p) ((PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVDMACMD_CHROMIUM_CTL_PRIVATE, Cmd))) 106 107 static PVBOXVDMACMD_CHROMIUM_CTL vboxVDMACrCtlCreate(VBOXVDMACMD_CHROMIUM_CTL_TYPE enmCmd, uint32_t cbCmd) 108 { 109 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = (PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE)RTMemAllocZ(cbCmd + RT_OFFSETOF(VBOXVDMACMD_CHROMIUM_CTL_PRIVATE, Cmd)); 110 Assert(pHdr); 111 if (pHdr) 112 { 113 pHdr->cRefs = 1; 114 pHdr->rc = VERR_NOT_IMPLEMENTED; 115 pHdr->Cmd.enmType = enmCmd; 116 pHdr->Cmd.cbCmd = cbCmd; 117 return &pHdr->Cmd; 118 } 119 120 return NULL; 121 } 122 123 DECLINLINE(void) vboxVDMACrCtlRelease (PVBOXVDMACMD_CHROMIUM_CTL pCmd) 124 { 125 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd); 126 uint32_t cRefs = ASMAtomicDecU32(&pHdr->cRefs); 127 if(!cRefs) 128 { 129 RTMemFree(pHdr); 130 } 131 } 132 133 DECLINLINE(void) vboxVDMACrCtlRetain (PVBOXVDMACMD_CHROMIUM_CTL pCmd) 134 { 135 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd); 136 ASMAtomicIncU32(&pHdr->cRefs); 137 } 138 139 DECLINLINE(int) vboxVDMACrCtlGetRc (PVBOXVDMACMD_CHROMIUM_CTL pCmd) 140 { 141 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd); 142 return pHdr->rc; 143 } 144 145 static DECLCALLBACK(void) vboxVDMACrCtlCbSetEvent(PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd, void* pvContext) 146 { 147 RTSemEventSignal((RTSEMEVENT)pvContext); 148 } 149 150 static DECLCALLBACK(void) vboxVDMACrCtlCbReleaseCmd(PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd, void* pvContext) 151 { 152 vboxVDMACrCtlRelease(pCmd); 153 } 154 155 156 static int vboxVDMACrCtlPostAsync (PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd, PFNVBOXVDMACRCTL_CALLBACK pfnCompletion, void *pvCompletion) 157 { 158 if (pVGAState->pDrv->pfnCrHgsmiControlProcess) 159 { 160 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd); 161 pHdr->pfnCompletion = pfnCompletion; 162 pHdr->pvCompletion = pvCompletion; 163 pVGAState->pDrv->pfnCrHgsmiControlProcess(pVGAState->pDrv, pCmd); 164 return VINF_SUCCESS; 165 } 166 #ifdef DEBUG_misha 167 Assert(0); 168 #endif 169 return VERR_NOT_SUPPORTED; 170 } 171 172 static int vboxVDMACrCtlPost(PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd) 173 { 174 RTSEMEVENT hComplEvent; 175 int rc = RTSemEventCreate(&hComplEvent); 176 AssertRC(rc); 177 if(RT_SUCCESS(rc)) 178 { 179 rc = vboxVDMACrCtlPostAsync (pVGAState, pCmd, vboxVDMACrCtlCbSetEvent, (void*)hComplEvent); 180 #ifdef DEBUG_misha 181 AssertRC(rc); 182 #endif 183 if (RT_SUCCESS(rc)) 184 { 185 rc = RTSemEventWaitNoResume(hComplEvent, RT_INDEFINITE_WAIT); 186 AssertRC(rc); 187 if(RT_SUCCESS(rc)) 188 { 189 RTSemEventDestroy(hComplEvent); 190 } 191 } 192 else 193 { 194 /* the command is completed */ 195 RTSemEventDestroy(hComplEvent); 196 } 197 } 198 return rc; 199 } 200 201 static int vboxVDMACrCtlHgsmiSetupAsync(struct VBOXVDMAHOST *pVdma) 202 { 203 PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP pCmd = (PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP)vboxVDMACrCtlCreate( 204 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP, sizeof (*pCmd)); 205 if (pCmd) 206 { 207 PVGASTATE pVGAState = pVdma->pVGAState; 208 pCmd->pvRamBase = pVGAState->vram_ptrR3; 209 int rc = vboxVDMACrCtlPostAsync(pVGAState, &pCmd->Hdr, vboxVDMACrCtlCbReleaseCmd, NULL); 210 #ifdef DEBUG_misha 211 AssertRC(rc); 212 #endif 213 #if 0 214 if (RT_SUCCESS(rc)) 215 { 216 rc = vboxVDMACrCtlGetRc(&pCmd->Hdr); 217 } 218 vboxVDMACrCtlRelease(&pCmd->Hdr); 219 #endif 220 return rc; 221 } 222 return VERR_NO_MEMORY; 223 } 224 225 /* check if this is external cmd to be passed to chromium backend */ 226 static bool vboxVDMACmdCheckCrCmd(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmd) 227 { 228 PVBOXVDMACMD pDmaCmd; 229 uint8_t * pvRam = pVdma->pVGAState->vram_ptrR3; 230 231 if (pCmd->fFlags & VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR) 232 pDmaCmd = VBOXVDMACBUF_DR_TAIL(pCmd, VBOXVDMACMD); 233 else 234 pDmaCmd = NULL; 235 236 if (pDmaCmd) 237 { 238 uint32_t cbCmd = pCmd->cbBuf; 239 Assert(cbCmd >= VBOXVDMACMD_HEADER_SIZE()); 240 241 if (cbCmd >= VBOXVDMACMD_HEADER_SIZE()) 242 { 243 if (pDmaCmd->enmType == VBOXVDMACMD_TYPE_CHROMIUM_CMD) 244 { 245 PVBOXVDMACMD_CHROMIUM_CMD pCrCmd = VBOXVDMACMD_BODY(pDmaCmd, VBOXVDMACMD_CHROMIUM_CMD); 246 PVGASTATE pVGAState = pVdma->pVGAState; 247 if (pVGAState->pDrv->pfnCrHgsmiCommandProcess) 248 { 249 pVGAState->pDrv->pfnCrHgsmiCommandProcess(pVGAState->pDrv, pCrCmd); 250 return true; 251 } 252 else 253 { 254 Assert(0); 255 } 256 257 int tmpRc = VBoxSHGSMICommandComplete (pVdma->pHgsmi, pCmd); 258 AssertRC(tmpRc); 259 // uint32_t cBufs = pCrCmd->cBuffers; 260 // for (uint32_t i = 0; i < cBufs; ++i) 261 // { 262 // PVBOXVDMACMD_CHROMIUM_BUFFER pBuf = &pCrCmd->aBuffers[i]; 263 // void *pvBuffer = pvRam + pBuf->offBuffer; 264 // uint32_t cbBuffer = pBuf->cbBuffer; 265 // } 266 } 267 } 268 } 269 return false; 270 } 271 272 int vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc) 273 { 274 PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface); 275 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 276 VBOXVDMACMD *pDmaHdr = VBOXVDMACMD_FROM_BODY(pCmd); 277 VBOXVDMACBUF_DR *pDr = VBOXVDMACBUF_DR_FROM_TAIL(pDmaHdr); 278 pDr->rc = rc; 279 280 Assert(pVGAState->fGuestCaps & VBVACAPS_COMPLETEGCMD_BY_IOREAD); 281 rc = HGSMICompleteGuestCommand(pIns, pDr, true /* do Irq */); 282 AssertRC(rc); 283 return rc; 284 } 285 286 int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc) 287 { 288 PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface); 289 PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pCmdPrivate = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd); 290 pCmdPrivate->rc = rc; 291 if (pCmdPrivate->pfnCompletion) 292 { 293 pCmdPrivate->pfnCompletion(pVGAState, pCmd, pCmdPrivate->pvCompletion); 294 } 295 return VINF_SUCCESS; 296 } 297 298 #endif 299 88 300 89 301 /* to simplify things and to avoid extra backend if modifications we assume the VBOXVDMA_RECTL is the same as VBVACMDHDR */ … … 739 951 hgsmiListAppend(&pVdma->CmdPool.List, &pVdma->CmdPool.aCmds[i].Entry); 740 952 } 953 #if 0 //def VBOX_WITH_CRHGSMI 954 int tmpRc = vboxVDMACrCtlHgsmiSetup(pVdma); 955 # ifdef DEBUG_misha 956 AssertRC(tmpRc); 957 # endif 958 #endif 741 959 *ppVdma = pVdma; 742 960 return VINF_SUCCESS; … … 797 1015 { 798 1016 case VBOXVDMA_CTL_TYPE_ENABLE: 1017 { 799 1018 pVdma->bEnabled = true; 800 1019 pCmd->i32Result = VINF_SUCCESS; 1020 #ifdef VBOX_WITH_CRHGSMI 1021 /* @todo: use async completion to ensure we notify a status to guest */ 1022 int tmpRc = vboxVDMACrCtlHgsmiSetupAsync(pVdma); 1023 AssertRC(tmpRc); 1024 #endif 1025 } 801 1026 break; 802 1027 case VBOXVDMA_CTL_TYPE_DISABLE: … … 846 1071 void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmd) 847 1072 { 1073 #ifdef VBOX_WITH_CRHGSMI 1074 if (vboxVDMACmdCheckCrCmd(pVdma, pCmd)) 1075 return; 1076 #endif 1077 848 1078 VBOXVDMACMD_SUBMIT_CONTEXT Context; 849 1079 Context.pVdma = pVdma; -
trunk/src/VBox/Devices/Makefile.kmk
r33037 r33146 350 350 Graphics/DevVGA_VDMA.cpp 351 351 endif 352 ifdef VBOX_WITH_CRHGSMI 353 DevicesR3_DEFS += VBOX_WITH_CRHGSMI 354 endif 355 352 356 ifdef VBOXWDDM_TEST_UHGSMI 353 357 DevicesR3_DEFS += VBOXWDDM_TEST_UHGSMI … … 588 592 VBoxDDGC_DEFS += VBOX_WITH_VDMA 589 593 endif 594 ifdef VBOX_WITH_CRHGSMI 595 VBoxDDGC_DEFS += VBOX_WITH_CRHGSMI 596 endif 590 597 591 598 ifdef VBOXWDDM_WITH_VBVA … … 617 624 VBoxDDGC_DEFS += VBOX_WITH_VDMA 618 625 endif 626 ifdef VBOX_WITH_CRHGSMI 627 VBoxDDGC_DEFS += VBOX_WITH_CRHGSMI 628 endif 629 619 630 ifdef VBOXWDDM_WITH_VBVA 620 631 VBoxDDGC_DEFS += VBOXWDDM_WITH_VBVA … … 707 718 VBoxDDR0_DEFS += VBOX_WITH_VDMA 708 719 endif 720 ifdef VBOX_WITH_CRHGSMI 721 VBoxDDR0_DEFS += VBOX_WITH_CRHGSMI 722 endif 723 709 724 ifdef VBOXWDDM_WITH_VBVA 710 725 VBoxDDR0_DEFS += VBOXWDDM_WITH_VBVA … … 756 771 VBoxDDR0_DEFS += VBOX_WITH_VDMA 757 772 endif 773 ifdef VBOX_WITH_CRHGSMI 774 VBoxDDR0_DEFS += VBOX_WITH_CRHGSMI 775 endif 776 758 777 ifdef VBOXWDDM_WITH_VBVA 759 778 VBoxDDR0_DEFS += VBOXWDDM_WITH_VBVA -
trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
r32175 r33146 90 90 VBoxSharedCrOpenGL_LIBS += \ 91 91 $(LIB_XPCOM) 92 endif 93 ifdef VBOX_WITH_CRHGSMI 94 VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI 92 95 endif 93 96 -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r32420 r33146 53 53 #endif /* RT_OS_WINDOWS */ 54 54 55 #ifdef VBOX_WITH_CRHGSMI 56 #include <VBox/VBoxVideo.h> 57 #endif 58 55 59 #include <VBox/com/errorprint.h> 56 60 … … 58 62 static IConsole* g_pConsole = NULL; 59 63 static PVM g_pVM = NULL; 64 #ifdef VBOX_WITH_CRHGSMI 65 static uint8_t* g_pvVRamBase; 66 #endif 60 67 61 68 #ifndef RT_OS_WINDOWS … … 450 457 } 451 458 459 #ifdef VBOX_WITH_CRHGSMI 460 static int vboxCrHgsmiCtl(PVBOXVDMACMD_CHROMIUM_CTL pCtl) 461 { 462 int rc; 463 switch (pCtl->enmType) 464 { 465 case VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP: 466 { 467 PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP pSetup = (PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP)pCtl; 468 g_pvVRamBase = (uint8_t*)pSetup->pvRamBase; 469 rc = VINF_SUCCESS; 470 } break; 471 default: 472 Assert(0); 473 rc = VERR_INVALID_PARAMETER; 474 } 475 476 return rc; 477 } 478 479 #define VBOXCRHGSMI_PTR(_off, _t) ((_t*)(g_pvVRamBase + (_off))) 480 static int vboxCrHgsmiCmd(PVBOXVDMACMD_CHROMIUM_CMD pCmd) 481 { 482 int rc; 483 uint32_t cBuffers = pCmd->cBuffers; 484 uint32_t cParams; 485 486 if (!g_pvVRamBase) 487 { 488 Assert(0); 489 return VERR_INVALID_STATE; 490 } 491 492 if (!cBuffers) 493 { 494 Assert(0); 495 return VERR_INVALID_PARAMETER; 496 } 497 498 cParams = cBuffers-1; 499 500 CRVBOXHGSMIHDR *pHdr = VBOXCRHGSMI_PTR(pCmd->aBuffers[0].offBuffer, CRVBOXHGSMIHDR); 501 uint32_t u32Function = pHdr->u32Function; 502 uint32_t u32ClientID = pHdr->u32ClientID; 503 /* now we compile HGCM params out of HGSMI 504 * @todo: can we avoid this ? */ 505 switch (u32Function) 506 { 507 508 case SHCRGL_GUEST_FN_WRITE: 509 { 510 Log(("svcCall: SHCRGL_GUEST_FN_WRITE\n")); 511 512 CRVBOXHGSMIWRITE* pFnCmd = (CRVBOXHGSMIWRITE*)pHdr; 513 514 /* @todo: Verify */ 515 if (cParams == 1) 516 { 517 VBOXVDMACMD_CHROMIUM_BUFFER *pBuf = &pCmd->aBuffers[1]; 518 /* Fetch parameters. */ 519 uint8_t *pBuffer = VBOXCRHGSMI_PTR(pBuf->offBuffer, uint8_t); 520 uint32_t cbBuffer = pBuf->cbBuffer; 521 522 /* Execute the function. */ 523 rc = crVBoxServerClientWrite(u32ClientID, pBuffer, cbBuffer); 524 if (!RT_SUCCESS(rc)) 525 { 526 Assert(VERR_NOT_SUPPORTED==rc); 527 svcClientVersionUnsupported(0, 0); 528 } 529 } 530 else 531 { 532 Assert(0); 533 rc = VERR_INVALID_PARAMETER; 534 } 535 break; 536 } 537 538 case SHCRGL_GUEST_FN_INJECT: 539 { 540 Log(("svcCall: SHCRGL_GUEST_FN_INJECT\n")); 541 542 CRVBOXHGSMIINJECT *pFnCmd = (CRVBOXHGSMIINJECT*)pHdr; 543 544 /* @todo: Verify */ 545 if (cParams == 1) 546 { 547 /* Fetch parameters. */ 548 uint32_t u32InjectClientID = pFnCmd->u32ClientID; 549 VBOXVDMACMD_CHROMIUM_BUFFER *pBuf = &pCmd->aBuffers[1]; 550 uint8_t *pBuffer = VBOXCRHGSMI_PTR(pBuf->offBuffer, uint8_t); 551 uint32_t cbBuffer = pBuf->cbBuffer; 552 553 /* Execute the function. */ 554 rc = crVBoxServerClientWrite(u32InjectClientID, pBuffer, cbBuffer); 555 if (!RT_SUCCESS(rc)) 556 { 557 if (VERR_NOT_SUPPORTED==rc) 558 { 559 svcClientVersionUnsupported(0, 0); 560 } 561 else 562 { 563 crWarning("SHCRGL_GUEST_FN_INJECT failed to inject for %i from %i", u32InjectClientID, u32ClientID); 564 } 565 } 566 } 567 else 568 { 569 Assert(0); 570 rc = VERR_INVALID_PARAMETER; 571 } 572 break; 573 } 574 575 case SHCRGL_GUEST_FN_READ: 576 { 577 Log(("svcCall: SHCRGL_GUEST_FN_READ\n")); 578 579 /* @todo: Verify */ 580 if (cParams == 1) 581 { 582 CRVBOXHGSMIREAD *pFnCmd = (CRVBOXHGSMIREAD*)pHdr; 583 VBOXVDMACMD_CHROMIUM_BUFFER *pBuf = &pCmd->aBuffers[1]; 584 /* Fetch parameters. */ 585 uint8_t *pBuffer = VBOXCRHGSMI_PTR(pBuf->offBuffer, uint8_t); 586 uint32_t cbBuffer = pBuf->cbBuffer; 587 588 /* Execute the function. */ 589 rc = crVBoxServerClientRead(u32ClientID, pBuffer, &cbBuffer); 590 591 if (RT_SUCCESS(rc)) 592 { 593 /* Update parameters.*/ 594 // paParms[0].u.pointer.size = cbBuffer; //@todo guest doesn't see this change somehow? 595 } else if (VERR_NOT_SUPPORTED==rc) 596 { 597 svcClientVersionUnsupported(0, 0); 598 } 599 600 /* Return the required buffer size always */ 601 pFnCmd->cbBuffer = cbBuffer; 602 } 603 else 604 { 605 Assert(0); 606 rc = VERR_INVALID_PARAMETER; 607 } 608 609 break; 610 } 611 612 case SHCRGL_GUEST_FN_WRITE_READ: 613 { 614 Log(("svcCall: SHCRGL_GUEST_FN_WRITE_READ\n")); 615 616 /* @todo: Verify */ 617 if (cParams == 2) 618 { 619 CRVBOXHGSMIWRITEREAD *pFnCmd = (CRVBOXHGSMIWRITEREAD*)pHdr; 620 VBOXVDMACMD_CHROMIUM_BUFFER *pBuf = &pCmd->aBuffers[1]; 621 VBOXVDMACMD_CHROMIUM_BUFFER *pWbBuf = &pCmd->aBuffers[2]; 622 623 /* Fetch parameters. */ 624 uint8_t *pBuffer = VBOXCRHGSMI_PTR(pBuf->offBuffer, uint8_t); 625 uint32_t cbBuffer = pBuf->cbBuffer; 626 627 uint8_t *pWriteback = VBOXCRHGSMI_PTR(pWbBuf->offBuffer, uint8_t); 628 uint32_t cbWriteback = pWbBuf->cbBuffer; 629 630 /* Execute the function. */ 631 rc = crVBoxServerClientWrite(u32ClientID, pBuffer, cbBuffer); 632 if (!RT_SUCCESS(rc)) 633 { 634 Assert(VERR_NOT_SUPPORTED==rc); 635 svcClientVersionUnsupported(0, 0); 636 } 637 638 rc = crVBoxServerClientRead(u32ClientID, pWriteback, &cbWriteback); 639 640 // if (RT_SUCCESS(rc)) 641 // { 642 // /* Update parameters.*/ 643 // paParms[1].u.pointer.size = cbWriteback; 644 // } 645 /* Return the required buffer size always */ 646 pFnCmd->cbWriteback = cbWriteback; 647 } 648 else 649 { 650 Assert(0); 651 rc = VERR_INVALID_PARAMETER; 652 } 653 654 break; 655 } 656 657 case SHCRGL_GUEST_FN_SET_VERSION: 658 { 659 Assert(0); 660 rc = VERR_NOT_IMPLEMENTED; 661 break; 662 } 663 664 default: 665 { 666 Assert(0); 667 rc = VERR_NOT_IMPLEMENTED; 668 } 669 670 } 671 672 pHdr->result = rc; 673 674 return VINF_SUCCESS; 675 } 676 #endif 677 452 678 /* 453 679 * We differentiate between a function handler for the guest and one for the host. … … 471 697 switch (u32Function) 472 698 { 699 #ifdef VBOX_WITH_CRHGSMI 700 case SHCRGL_HOST_FN_CRHGSMI_CMD: 701 { 702 Assert(cParms == 1 && paParms[0].type == VBOX_HGCM_SVC_PARM_PTR); 703 if (cParms == 1 && paParms[0].type == VBOX_HGCM_SVC_PARM_PTR) 704 rc = vboxCrHgsmiCmd((PVBOXVDMACMD_CHROMIUM_CMD)paParms[0].u.pointer.addr); 705 else 706 rc = VERR_INVALID_PARAMETER; 707 } break; 708 case SHCRGL_HOST_FN_CRHGSMI_CTL: 709 { 710 Assert(cParms == 1 && paParms[0].type == VBOX_HGCM_SVC_PARM_PTR); 711 if (cParms == 1 && paParms[0].type == VBOX_HGCM_SVC_PARM_PTR) 712 rc = vboxCrHgsmiCtl((PVBOXVDMACMD_CHROMIUM_CTL)paParms[0].u.pointer.addr); 713 else 714 rc = VERR_INVALID_PARAMETER; 715 } break; 716 #endif 473 717 case SHCRGL_HOST_FN_SET_CONSOLE: 474 718 { -
trunk/src/VBox/Main/DisplayImpl.cpp
r32928 r33146 2895 2895 } 2896 2896 2897 #ifdef VBOX_WITH_CRHGSMI 2898 void Display::setupCrHgsmiData(void) 2899 { 2900 VMMDev *pVMMDev = mParent->getVMMDev(); 2901 Assert(pVMMDev); 2902 int rc = VERR_GENERAL_FAILURE; 2903 if (pVMMDev) 2904 { 2905 rc = pVMMDev->hgcmHostSvcHandleCreate("VBoxSharedCrOpenGL", &mhCrOglSvc); 2906 AssertRC(rc); 2907 } 2908 2909 if (RT_FAILURE(rc)) 2910 { 2911 mhCrOglSvc = NULL; 2912 } 2913 } 2914 2915 void Display::destructCrHgsmiData(void) 2916 { 2917 if (mhCrOglSvc) 2918 { 2919 VMMDev *pVMMDev = mParent->getVMMDev(); 2920 Assert(pVMMDev); 2921 if (pVMMDev) 2922 { 2923 int rc = pVMMDev->hgcmHostSvcHandleDestroy(mhCrOglSvc); 2924 AssertRC(rc); 2925 } 2926 } 2927 } 2928 #endif 2929 2897 2930 /** 2898 2931 * Changes the current frame buffer. Called on EMT to avoid both … … 3477 3510 #endif 3478 3511 3512 #ifdef VBOX_WITH_CRHGSMI 3513 void Display::handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam) 3514 { 3515 mpDrv->pVBVACallbacks->pfnCrHgsmiCommandCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVDMACMD_CHROMIUM_CMD)pParam->u.pointer.addr, result); 3516 } 3517 3518 void Display::handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam) 3519 { 3520 mpDrv->pVBVACallbacks->pfnCrHgsmiControlCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVDMACMD_CHROMIUM_CTL)pParam->u.pointer.addr, result); 3521 } 3522 3523 void Display::handleCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd) 3524 { 3525 int rc = VERR_INVALID_FUNCTION; 3526 VBOXHGCMSVCPARM parm; 3527 parm.type = VBOX_HGCM_SVC_PARM_PTR; 3528 parm.u.pointer.addr = pCmd; 3529 parm.u.pointer.size = 0; 3530 3531 if (mhCrOglSvc) 3532 { 3533 VMMDev *pVMMDev = mParent->getVMMDev(); 3534 if (pVMMDev) 3535 { 3536 rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CRHGSMI_CMD, &parm, Display::displayCrHgsmiCommandCompletion, this); 3537 AssertRC(rc); 3538 if (RT_SUCCESS(rc)) 3539 return; 3540 } 3541 else 3542 rc = VERR_INVALID_STATE; 3543 } 3544 3545 /* we are here because something went wrong with command prosessing, complete it */ 3546 handleCrHgsmiCommandCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CMD, &parm); 3547 } 3548 3549 void Display::handleCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl) 3550 { 3551 int rc = VERR_INVALID_FUNCTION; 3552 VBOXHGCMSVCPARM parm; 3553 parm.type = VBOX_HGCM_SVC_PARM_PTR; 3554 parm.u.pointer.addr = pCtl; 3555 parm.u.pointer.size = 0; 3556 3557 if (mhCrOglSvc) 3558 { 3559 VMMDev *pVMMDev = mParent->getVMMDev(); 3560 if (pVMMDev) 3561 { 3562 rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm, Display::displayCrHgsmiControlCompletion, this); 3563 AssertRC(rc); 3564 if (RT_SUCCESS(rc)) 3565 return; 3566 } 3567 else 3568 rc = VERR_INVALID_STATE; 3569 } 3570 3571 /* we are here because something went wrong with command prosessing, complete it */ 3572 handleCrHgsmiControlCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm); 3573 } 3574 3575 DECLCALLBACK(void) Display::displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd) 3576 { 3577 PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface); 3578 3579 pDrv->pDisplay->handleCrHgsmiCommandProcess(pInterface, pCmd); 3580 } 3581 3582 DECLCALLBACK(void) Display::displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd) 3583 { 3584 PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface); 3585 3586 pDrv->pDisplay->handleCrHgsmiControlProcess(pInterface, pCmd); 3587 } 3588 3589 DECLCALLBACK(void) Display::displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext) 3590 { 3591 Display *pDisplay = (Display *)pvContext; 3592 pDisplay->handleCrHgsmiCommandCompletion(result, u32Function, pParam); 3593 } 3594 3595 DECLCALLBACK(void) Display::displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext) 3596 { 3597 Display *pDisplay = (Display *)pvContext; 3598 pDisplay->handleCrHgsmiControlCompletion(result, u32Function, pParam); 3599 } 3600 #endif 3601 3602 3479 3603 #ifdef VBOX_WITH_HGSMI 3480 3604 DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags) … … 3817 3941 { 3818 3942 AutoWriteLock displayLock(pData->pDisplay COMMA_LOCKVAL_SRC_POS); 3943 #ifdef VBOX_WITH_CRHGSMI 3944 pData->pDisplay->destructCrHgsmiData(); 3945 #endif 3819 3946 pData->pDisplay->mpDrv = NULL; 3820 3947 pData->pDisplay->mpVMMDev = NULL; … … 3863 3990 pData->IConnector.pfnVHWACommandProcess = Display::displayVHWACommandProcess; 3864 3991 #endif 3992 #ifdef VBOX_WITH_CRHGSMI 3993 pData->IConnector.pfnCrHgsmiCommandProcess = Display::displayCrHgsmiCommandProcess; 3994 pData->IConnector.pfnCrHgsmiControlProcess = Display::displayCrHgsmiControlProcess; 3995 #endif 3865 3996 #ifdef VBOX_WITH_HGSMI 3866 3997 pData->IConnector.pfnVBVAEnable = Display::displayVBVAEnable; … … 3883 4014 return VERR_PDM_MISSING_INTERFACE_ABOVE; 3884 4015 } 3885 #if defined(VBOX_WITH_VIDEOHWACCEL) 4016 #if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI) 3886 4017 pData->pVBVACallbacks = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIDISPLAYVBVACALLBACKS); 3887 4018 if (!pData->pVBVACallbacks) … … 3913 4044 */ 3914 4045 pData->pUpPort->pfnSetRefreshRate(pData->pUpPort, 20); 4046 4047 #ifdef VBOX_WITH_CRHGSMI 4048 pData->pDisplay->setupCrHgsmiData(); 4049 #endif 3915 4050 3916 4051 return VINF_SUCCESS; -
trunk/src/VBox/Main/Makefile.kmk
r33060 r33146 668 668 endif 669 669 670 ifdef VBOX_WITH_CRHGSMI 671 VBoxC_DEFS += VBOX_WITH_CRHGSMI 672 endif 673 670 674 ifdef VBOX_WITH_USB 671 675 VBoxC_SOURCES += \ -
trunk/src/VBox/Main/VMMDevInterface.cpp
r32851 r33146 766 766 HGCMHostShutdown(); 767 767 } 768 769 # ifdef VBOX_WITH_CRHGSMI 770 int VMMDev::hgcmHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc) 771 { 772 if (!hgcmIsActive()) 773 return VERR_INVALID_STATE; 774 return HGCMHostSvcHandleCreate(pszServiceName, phSvc); 775 } 776 777 int VMMDev::hgcmHostSvcHandleDestroy (HGCMCVSHANDLE hSvc) 778 { 779 if (!hgcmIsActive()) 780 return VERR_INVALID_STATE; 781 return HGCMHostSvcHandleDestroy(hSvc); 782 } 783 784 int VMMDev::hgcmHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion) 785 { 786 if (!hgcmIsActive()) 787 return VERR_INVALID_STATE; 788 return HGCMHostFastCallAsync(hSvc, function, pParm, pfnCompletion, pvCompletion); 789 } 790 # endif 768 791 769 792 #endif /* HGCM */ -
trunk/src/VBox/Main/hgcm/HGCM.cpp
r29071 r33146 151 151 152 152 int HostCall (uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms); 153 154 #ifdef VBOX_WITH_CRHGSMI 155 int HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion); 156 #endif 153 157 154 158 uint32_t SizeOfClient (void) { return m_fntable.cbClient; }; … … 347 351 #define SVC_MSG_REGEXT (9) /* pfnRegisterExtension */ 348 352 #define SVC_MSG_UNREGEXT (10) /* pfnRegisterExtension */ 353 #ifdef VBOX_WITH_CRHGSMI 354 # define SVC_MSG_HOSTFASTCALLASYNC (21) /* pfnHostCall */ 355 #endif 349 356 350 357 class HGCMMsgSvcLoad: public HGCMMsgCore … … 435 442 }; 436 443 444 #ifdef VBOX_WITH_CRHGSMI 445 class HGCMMsgHostFastCallAsyncSvc: public HGCMMsgCore 446 { 447 public: 448 /* function number */ 449 uint32_t u32Function; 450 /* parameter */ 451 VBOXHGCMSVCPARM Param; 452 /* completion info */ 453 PHGCMHOSTFASTCALLCB pfnCompletion; 454 void *pvCompletion; 455 }; 456 #endif 457 437 458 static HGCMMsgCore *hgcmMessageAllocSvc (uint32_t u32MsgId) 438 459 { 439 460 switch (u32MsgId) 440 461 { 462 #ifdef VBOX_WITH_CRHGSMI 463 case SVC_MSG_HOSTFASTCALLASYNC: return new HGCMMsgHostFastCallAsyncSvc (); 464 #endif 441 465 case SVC_MSG_LOAD: return new HGCMMsgSvcLoad (); 442 466 case SVC_MSG_UNLOAD: return new HGCMMsgSvcUnload (); … … 483 507 switch (u32MsgId) 484 508 { 509 #ifdef VBOX_WITH_CRHGSMI 510 case SVC_MSG_HOSTFASTCALLASYNC: 511 { 512 HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pMsgCore; 513 514 LogFlowFunc(("SVC_MSG_HOSTFASTCALLASYNC u32Function = %d, pParm = %p\n", pMsg->u32Function, &pMsg->Param)); 515 516 rc = pSvc->m_fntable.pfnHostCall (pSvc->m_fntable.pvService, pMsg->u32Function, 1, &pMsg->Param); 517 } break; 518 #endif 485 519 case SVC_MSG_LOAD: 486 520 { … … 1517 1551 } 1518 1552 1553 #ifdef VBOX_WITH_CRHGSMI 1554 static DECLCALLBACK(void) hgcmMsgFastCallCompletionCallback (int32_t result, HGCMMsgCore *pMsgCore) 1555 { 1556 /* Call the VMMDev port interface to issue IRQ notification. */ 1557 LogFlow(("MAIN::hgcmMsgFastCallCompletionCallback: message %p\n", pMsgCore)); 1558 1559 HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pMsgCore; 1560 if (pMsg->pfnCompletion) 1561 { 1562 pMsg->pfnCompletion (result, pMsg->u32Function, &pMsg->Param, pMsg->pvCompletion); 1563 } 1564 } 1565 1566 int HGCMService::HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion) 1567 { 1568 LogFlowFunc(("%s u32Function = %d, pParm = %p\n", 1569 m_pszSvcName, u32Function, pParm)); 1570 1571 HGCMMSGHANDLE hMsg = 0; 1572 int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc); 1573 1574 if (RT_SUCCESS(rc)) 1575 { 1576 HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)hgcmObjReference (hMsg, HGCMOBJ_MSG); 1577 AssertRelease(pMsg); 1578 1579 pMsg->u32Function = u32Function; 1580 pMsg->Param = *pParm; 1581 pMsg->pfnCompletion = pfnCompletion; 1582 pMsg->pvCompletion = pvCompletion; 1583 1584 hgcmObjDereference (pMsg); 1585 1586 rc = hgcmMsgPost(hMsg, hgcmMsgFastCallCompletionCallback); 1587 } 1588 1589 LogFlowFunc(("rc = %Rrc\n", rc)); 1590 return rc; 1591 } 1592 #endif 1519 1593 1520 1594 /* … … 1533 1607 #define HGCM_MSG_REGEXT (18) /* Register a service extension. */ 1534 1608 #define HGCM_MSG_UNREGEXT (19) /* Unregister a service extension. */ 1609 #ifdef VBOX_WITH_CRHGSMI 1610 # define HGCM_MSG_SVCAQUIRE (30) /* Acquire a service handle (for fast host calls) */ 1611 # define HGCM_MSG_SVCRELEASE (31) /* Release a service */ 1612 #endif 1535 1613 1536 1614 class HGCMMsgMainConnect: public HGCMMsgHeader … … 1607 1685 }; 1608 1686 1687 #ifdef VBOX_WITH_CRHGSMI 1688 class HGCMMsgMainSvcAcquire: public HGCMMsgCore 1689 { 1690 public: 1691 /* Which service to call. */ 1692 const char *pszServiceName; 1693 /* Returned service. */ 1694 HGCMService *pService; 1695 }; 1696 1697 class HGCMMsgMainSvcRelease: public HGCMMsgCore 1698 { 1699 public: 1700 /* Svc . */ 1701 HGCMService *pService; 1702 }; 1703 #endif 1704 1705 1609 1706 static HGCMMsgCore *hgcmMainMessageAlloc (uint32_t u32MsgId) 1610 1707 { … … 1621 1718 case HGCM_MSG_REGEXT: return new HGCMMsgMainRegisterExtension (); 1622 1719 case HGCM_MSG_UNREGEXT: return new HGCMMsgMainUnregisterExtension (); 1720 #ifdef VBOX_WITH_CRHGSMI 1721 case HGCM_MSG_SVCAQUIRE: return new HGCMMsgMainSvcAcquire(); 1722 case HGCM_MSG_SVCRELEASE: return new HGCMMsgMainSvcRelease(); 1723 #endif 1724 1623 1725 default: 1624 1726 AssertReleaseMsgFailed(("Msg id = %08X\n", u32MsgId)); … … 1729 1831 } 1730 1832 } break; 1833 1834 #ifdef VBOX_WITH_CRHGSMI 1835 case HGCM_MSG_SVCAQUIRE: 1836 { 1837 HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)pMsgCore; 1838 1839 LogFlowFunc(("HGCM_MSG_SVCAQUIRE pszServiceName %s\n", pMsg->pszServiceName)); 1840 1841 /* Resolve the service name to the pointer to service instance. */ 1842 HGCMService *pService; 1843 rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName); 1844 if (RT_SUCCESS(rc)) 1845 { 1846 pMsg->pService = pService; 1847 } 1848 } break; 1849 1850 case HGCM_MSG_SVCRELEASE: 1851 { 1852 HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)pMsgCore; 1853 1854 LogFlowFunc(("HGCM_MSG_SVCARELEASE pService %p\n", pMsg->pService)); 1855 1856 /* Resolve the service name to the pointer to service instance. */ 1857 1858 pMsg->pService->ReleaseService (); 1859 1860 rc = VINF_SUCCESS; 1861 } break; 1862 #endif 1731 1863 1732 1864 case HGCM_MSG_RESET: … … 2201 2333 } 2202 2334 2335 #ifdef VBOX_WITH_CRHGSMI 2336 int HGCMHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc) 2337 { 2338 LogFlowFunc(("name = %s\n", pszServiceName)); 2339 2340 if (!pszServiceName) 2341 { 2342 return VERR_INVALID_PARAMETER; 2343 } 2344 2345 if (!phSvc) 2346 { 2347 return VERR_INVALID_PARAMETER; 2348 } 2349 2350 HGCMMSGHANDLE hMsg = 0; 2351 2352 /* Host calls go to main HGCM thread that resolves the service name to the 2353 * service instance pointer and then, using the service pointer, forwards 2354 * the message to the service thread. 2355 * So it is slow but host calls are intended mostly for configuration and 2356 * other non-time-critical functions. 2357 */ 2358 int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc); 2359 2360 if (RT_SUCCESS(rc)) 2361 { 2362 HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)hgcmObjReference (hMsg, HGCMOBJ_MSG); 2363 AssertRelease(pMsg); 2364 2365 pMsg->pszServiceName = (char *)pszServiceName; 2366 pMsg->pService = NULL; 2367 2368 rc = hgcmMsgSend (hMsg); 2369 if (RT_SUCCESS(rc)) 2370 { 2371 /* for simplicity just use a svc ptr as handle for now */ 2372 *phSvc = (HGCMCVSHANDLE)pMsg->pService; 2373 } 2374 2375 hgcmObjDereference (pMsg); 2376 } 2377 2378 LogFlowFunc(("rc = %Rrc\n", rc)); 2379 return rc; 2380 } 2381 2382 int HGCMHostSvcHandleDestroy (HGCMCVSHANDLE hSvc) 2383 { 2384 LogFlowFunc(("hSvc = %p\n", hSvc)); 2385 2386 if (!hSvc) 2387 { 2388 return VERR_INVALID_PARAMETER; 2389 } 2390 2391 HGCMMSGHANDLE hMsg = 0; 2392 2393 /* Host calls go to main HGCM thread that resolves the service name to the 2394 * service instance pointer and then, using the service pointer, forwards 2395 * the message to the service thread. 2396 * So it is slow but host calls are intended mostly for configuration and 2397 * other non-time-critical functions. 2398 */ 2399 int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc); 2400 2401 if (RT_SUCCESS(rc)) 2402 { 2403 HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)hgcmObjReference (hMsg, HGCMOBJ_MSG); 2404 AssertRelease(pMsg); 2405 2406 pMsg->pService = (HGCMService *)hSvc; 2407 2408 hgcmObjDereference (pMsg); 2409 2410 rc = hgcmMsgSend (hMsg); 2411 } 2412 2413 LogFlowFunc(("rc = %Rrc\n", rc)); 2414 return rc; 2415 } 2416 2417 int HGCMHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion) 2418 { 2419 LogFlowFunc(("hSvc = %p, u32Function = %d, pParm = %p\n", 2420 hSvc, function, pParm)); 2421 2422 if (!hSvc) 2423 { 2424 return VERR_INVALID_PARAMETER; 2425 } 2426 2427 HGCMService *pService = (HGCMService *)hSvc; 2428 int rc = pService->HostFastCallAsync (function, pParm, pfnCompletion, pvCompletion); 2429 2430 LogFlowFunc(("rc = %Rrc\n", rc)); 2431 return rc; 2432 } 2433 #endif 2434 2203 2435 int HGCMHostReset (void) 2204 2436 { -
trunk/src/VBox/Main/include/DisplayImpl.h
r31958 r33146 127 127 void handleVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand); 128 128 #endif 129 #ifdef VBOX_WITH_CRHGSMI 130 void handleCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd); 131 void handleCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl); 132 133 void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam); 134 void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam); 135 #endif 129 136 IFramebuffer *getFramebuffer() 130 137 { … … 169 176 void updateDisplayData(void); 170 177 178 #ifdef VBOX_WITH_CRHGSMI 179 void setupCrHgsmiData(void); 180 void destructCrHgsmiData(void); 181 #endif 182 171 183 static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId); 172 184 … … 187 199 #endif 188 200 201 #ifdef VBOX_WITH_CRHGSMI 202 static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd); 203 static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl); 204 205 static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 206 static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 207 #endif 208 189 209 #ifdef VBOX_WITH_HGSMI 190 210 static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags); … … 237 257 uint32_t mcbVbvaPartial; 238 258 259 #ifdef VBOX_WITH_CRHGSMI 260 /* for fast host hgcm calls */ 261 HGCMCVSHANDLE mhCrOglSvc; 262 #endif 263 239 264 bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd); 240 265 void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd); -
trunk/src/VBox/Main/include/VMMDev.h
r29250 r33146 51 51 int hgcmLoadService (const char *pszServiceLibrary, const char *pszServiceName); 52 52 int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms); 53 #ifdef VBOX_WITH_CRHGSMI 54 int hgcmHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc); 55 int hgcmHostSvcHandleDestroy (HGCMCVSHANDLE hSvc); 56 int hgcmHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion); 57 #endif 53 58 void hgcmShutdown (void); 54 59 -
trunk/src/VBox/Main/include/hgcm/HGCM.h
r28800 r33146 49 49 int HGCMHostCall (const char *pszServiceName, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM aParms[]); 50 50 51 #ifdef VBOX_WITH_CRHGSMI 52 int HGCMHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc); 53 int HGCMHostSvcHandleDestroy (HGCMCVSHANDLE hSvc); 54 int HGCMHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion); 55 #endif 56 51 57 int HGCMHostSaveState (PSSMHANDLE pSSM); 52 58 int HGCMHostLoadState (PSSMHANDLE pSSM);
Note:
See TracChangeset
for help on using the changeset viewer.